common: ssh tasks use the ssh unit that Ubuntu also has, cloud-init no longer rewrites /etc/hosts at boot
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
# With manage_etc_hosts in the user-data (Proxmox sets it) cloud-init rewrites /etc/hosts from its
|
||||
# template on every boot and drops the blocks other roles add; user-data outranks cloud.cfg.d, so
|
||||
# the module is taken out of the boot stage instead.
|
||||
- name: Read the cloud-init configuration
|
||||
slurp:
|
||||
path: /etc/cloud/cloud.cfg
|
||||
register: cloud_cfg
|
||||
failed_when: false
|
||||
|
||||
- name: Keep cloud-init from rewriting /etc/hosts
|
||||
when: cloud_cfg.content is defined
|
||||
copy:
|
||||
dest: /etc/cloud/cloud.cfg.d/99-ansible-etc-hosts.cfg
|
||||
content: |
|
||||
cloud_init_modules: {{ (cloud_cfg.content | b64decode | from_yaml).cloud_init_modules | reject('equalto', 'update_etc_hosts') | list | to_json }}
|
||||
@@ -8,6 +8,8 @@
|
||||
|
||||
- import_tasks: ./timesync.yml
|
||||
|
||||
- import_tasks: ./cloud_init.yml
|
||||
|
||||
- import_tasks: ./aliases.yml
|
||||
|
||||
- import_tasks: ./networking.yml
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
- name: Check if SSH daemon is active
|
||||
systemd:
|
||||
name: sshd
|
||||
name: ssh
|
||||
state: started
|
||||
register: sshd_status
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
- name: Restart SSH daemon
|
||||
service:
|
||||
name: sshd
|
||||
name: ssh
|
||||
state: restarted
|
||||
when: sshd_config.changed
|
||||
when: sshd_status.status.ActiveState == 'active'
|
||||
|
||||
Reference in New Issue
Block a user