Skip to content

Commit 4fe863e

Browse files
authored
Merge pull request #26 from Diesel-Net/development
Development
2 parents d43f2f0 + 1ebbcfb commit 4fe863e

File tree

3 files changed

+39
-31
lines changed

3 files changed

+39
-31
lines changed

defaults/main.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# safe/sane defaults
2-
auto_reboots: no
2+
auto_reboots: yes
33
timezone: America/Los_Angeles
44

55
# ssh user vars
@@ -25,7 +25,6 @@ ssh_known_hosts: "{{ groups['all'] }}"
2525
apt_packages:
2626
- qemu-guest-agent
2727
- python3-pip
28-
- python3-venv
2928
- tree
3029
- wget
3130
- curl

tasks/main.yaml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,6 @@
66
shell: chage -I -1 -m 0 -M 99999 -E -1 root
77
become: yes
88

9-
- include_tasks: configure_apt_proxy.yaml
10-
11-
- name: Install apt packages
12-
apt:
13-
name: "{{ apt_packages }}"
14-
state: present
15-
autoclean: yes
16-
update_cache: yes
17-
become: yes
18-
19-
- name: Rebuild Trusted certificate store
20-
command: update-ca-certificates --fresh
21-
become: yes
22-
239
- name: Install step (PKI/ACME client for private/internal CA)
2410
block:
2511
- name: Create temp dir
@@ -51,3 +37,17 @@
5137
--fingerprint {{ ca_fingerprint }} \
5238
--install -f
5339
become: yes
40+
41+
- name: Rebuild Trusted certificate store
42+
command: update-ca-certificates --fresh
43+
become: yes
44+
45+
- include_tasks: configure_apt_proxy.yaml
46+
47+
- name: Install apt packages
48+
apt:
49+
name: "{{ apt_packages }}"
50+
state: present
51+
autoclean: yes
52+
update_cache: yes
53+
become: yes

tasks/scan_hosts.yaml

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,32 @@
1-
- name: For each host, scan for its ssh public key
1+
# failures from unreachable/offline hosts ignored
2+
- name: scan for hosts public keys
3+
delegate_to: localhost
4+
with_items: '{{ inventory_hostname }}'
25
shell: "ssh-keyscan {{ item }},{{ lookup ('dig', item) }}"
3-
with_items: "{{ inventory_hostname }}"
4-
register: ssh_known_host_results
6+
register: keyscan
57
ignore_errors: yes
6-
delegate_to: localhost
78

8-
- name: Remove the public host key in the '{{ ssh_known_hosts_file }}'
9+
- with_items: '{{ keyscan.results }}'
10+
debug:
11+
msg: '{{ item.rc }}'
12+
13+
- name: remove the public host key from known_hosts file
14+
delegate_to: localhost
15+
loop: '{{ keyscan.results }}'
16+
loop_control:
17+
loop_var: result
18+
when: result.rc == 0
919
known_hosts:
10-
name: "{{ item.item }}"
20+
name: "{{ result.item }}"
1121
state: "absent"
12-
path: "{{ ssh_known_hosts_file }}"
13-
with_items: "{{ ssh_known_host_results.results }}"
14-
delegate_to: localhost
1522

16-
- name: Add/update the public host key in the '{{ ssh_known_hosts_file }}'
23+
- name: add/update the public host key in known_hosts file
24+
delegate_to: localhost
25+
loop: '{{ keyscan.results }}'
26+
loop_control:
27+
loop_var: result
28+
when: result.rc == 0
1729
known_hosts:
18-
name: "{{ item.item }}"
19-
key: "{{ item.stdout }}"
30+
name: "{{ result.item }}"
31+
key: "{{ result.stdout }}"
2032
state: "present"
21-
path: "{{ ssh_known_hosts_file }}"
22-
with_items: "{{ ssh_known_host_results.results }}"
23-
delegate_to: localhost

0 commit comments

Comments
 (0)