|
4 | 4 | redhat_subscription:
|
5 | 5 | state: absent
|
6 | 6 | when: ansible_distribution == 'RedHat'
|
7 |
| - |
| 7 | + |
8 | 8 | # Tasks for configuring SSH for public key authentication.
|
9 | 9 | - name: "Configuring SSH for Public Key Authentication."
|
10 | 10 | block:
|
|
16 | 16 | path: /etc/ssh/sshd_config
|
17 | 17 | regexp: '^PubkeyAuthentication'
|
18 | 18 | line: 'PubkeyAuthentication yes'
|
| 19 | + when: enable_cloudinit == 'false' |
| 20 | + block: |
| 21 | + - lineinfile: |
| 22 | + path: /etc/ssh/sshd_config |
| 23 | + regexp: '^PermitRootLogin' |
| 24 | + line: 'PermitRootLogin no' |
| 25 | + - lineinfile: |
| 26 | + path: /etc/ssh/sshd_config |
| 27 | + regexp: '^PubkeyAuthentication' |
| 28 | + line: 'PubkeyAuthentication yes' |
| 29 | + - lineinfile: |
| 30 | + path: /etc/ssh/sshd_config |
| 31 | + regexp: '^PasswordAuthentication' |
| 32 | + line: 'PasswordAuthentication yes' |
| 33 | + when: enable_cloudinit == 'true' |
| 34 | + |
| 35 | +# Tasks for disabling cloud-init ssh module. |
| 36 | +- name: "Disable cloud-init ssh module" |
| 37 | + lineinfile: |
| 38 | + path: /etc/cloud/cloud.cfg |
| 39 | + regexp: '^ssh_pwauth: false' |
| 40 | + line: 'ssh_pwauth: true' |
| 41 | + when: enable_cloudinit == 'true' |
19 | 42 |
|
20 | 43 | # Tasks for setting the hostname.
|
21 | 44 | - name: "Setting the hostname."
|
|
34 | 57 | name: sshd
|
35 | 58 | state: restarted
|
36 | 59 | daemon_reload: true
|
| 60 | + |
| 61 | +# Tasks for configuring cloud-init. |
| 62 | +- name: "Configuring cloud-init." |
| 63 | + block: |
| 64 | + - name: "Message: Configuring cloud-init" |
| 65 | + debug: |
| 66 | + msg: "Configuring cloud-init" |
| 67 | + - blockinfile: |
| 68 | + path: /etc/cloud/cloud.cfg |
| 69 | + block: | |
| 70 | + disable_vmware_customization: false |
| 71 | + - copy: |
| 72 | + content: "datasource_list: [ VMware, OVF, None ]" |
| 73 | + dest: /etc/cloud/cloud.cfg.d/90_dpkg.cfg |
| 74 | + when: enable_cloudinit == 'true' |
0 commit comments