feat: reworked most of the ansible playbooks and roles
This commit is contained in:
@@ -1,35 +1,52 @@
|
||||
---
|
||||
|
||||
# Tasks for setting custom facts.
|
||||
- name: "Setting custom facts."
|
||||
set_fact:
|
||||
enable_cloudinit: "{{ enable_cloudinit | default('false') }}"
|
||||
|
||||
# Tasks for unregistering from SUSE Customer Center.
|
||||
- name: "Unregistering from SUSE Customer Center."
|
||||
command:
|
||||
ansible.builtin.command:
|
||||
cmd: "{{ item }}"
|
||||
loop:
|
||||
- SUSEConnect -d
|
||||
- SUSEConnect --cleanup
|
||||
when: "ansible_facts['distribution'] != 'openSUSE Leap'"
|
||||
|
||||
# Tasks for configuring SSH for public key authentication.
|
||||
- name: "Configuring SSH for Public Key Authentication."
|
||||
block:
|
||||
- lineinfile:
|
||||
- ansible.builtin.lineinfile:
|
||||
path: /etc/ssh/sshd_config
|
||||
regexp: '^PermitRootLogin'
|
||||
line: 'PermitRootLogin no'
|
||||
- lineinfile:
|
||||
- ansible.builtin.lineinfile:
|
||||
path: /etc/ssh/sshd_config
|
||||
regexp: '^PubkeyAuthentication'
|
||||
line: 'PubkeyAuthentication yes'
|
||||
|
||||
# Tasks for setting the hostname.
|
||||
- name: "Setting the hostname."
|
||||
hostname:
|
||||
ansible.builtin.hostname:
|
||||
name: "localhost"
|
||||
|
||||
# Tasks for restarting the SSH daemon.
|
||||
- name: "Restarting the SSH daemon."
|
||||
systemd:
|
||||
ansible.builtin.systemd:
|
||||
name: sshd
|
||||
state: restarted
|
||||
daemon_reload: true
|
||||
|
||||
# Tasks for configuring cloud-init.
|
||||
- name: "Configuring cloud-init."
|
||||
block:
|
||||
- name: "Message: Configuring cloud-init"
|
||||
ansible.builtin.debug:
|
||||
msg: "Configuring cloud-init"
|
||||
- ansible.builtin.copy:
|
||||
content: 'datasource_list: [ ConfigDrive, NoCloud ]'
|
||||
dest: /etc/cloud/cloud.cfg.d/90_dpkg.cfg
|
||||
when: enable_cloudinit == 'true'
|
||||
|
||||
...
|
||||
Reference in New Issue
Block a user