feat: reworked most of the ansible playbooks and roles

This commit is contained in:
AJ Schroeder
2024-06-29 10:26:52 -05:00
parent 0eadf8fba9
commit b885f907db
22 changed files with 524 additions and 365 deletions

View File

@@ -0,0 +1,2 @@
---
enable_cloudinit: false

View File

@@ -1,4 +1,5 @@
---
- block:
- name: "Updating the guest operating system."
ansible.builtin.apt:
@@ -11,3 +12,10 @@
ansible.builtin.apt:
name: "{{ additional_packages[ansible_os_family] }}"
state: latest # noqa package-latest
- name: "Installing cloud-init."
become: true
ansible.builtin.apt:
name: cloud-init
state: latest
when: enable_cloudinit == 'true' and ansible_distribution_version | int >= 11

View File

@@ -1,5 +1,9 @@
---
- name: "Getting guest operating system information."
ansible.builtin.debug:
msg: "OS: {{ ansible_distribution }} Version: {{ ansible_distribution_version }} Family: {{ ansible_os_family }}"
- name: Prepare the {{ ansible_facts['distribution'] }} guest operating system
include_tasks: "{{ ansible_facts['distribution'] | lower }}.yml"
when: "ansible_facts['distribution'] == 'Debian'"
@@ -13,7 +17,7 @@
when: "ansible_facts['distribution'] in ['RedHat', 'CentOS', 'Rocky', 'AlmaLinux', 'OracleLinux']"
- name: Prepare the {{ ansible_facts['distribution'] }} guest operating system
include_tasks: "{{ ansible_facts['distribution'] | lower }}.yml"
when: "ansible_facts['distribution'] == 'Suse'"
include_tasks: suse.yml
when: "ansible_facts['distribution'] in ['openSUSE Leap', 'Suse']"
...

View File

@@ -15,5 +15,12 @@
ansible.builtin.dnf:
name: "{{ additional_packages[ansible_os_family] }}"
state: latest # noqa package-latest
when: ansible_distribution_major_version | int > 8
- name: "Installing cloud-init."
become: true
ansible.builtin.dnf:
name: cloud-init
state: latest
when: enable_cloudinit == 'true' and ansible_distribution_version | int >= 8
when: ansible_os_family == 'RedHat' and ansible_distribution_major_version | int >= 8

View File

@@ -1,9 +1,29 @@
---
- name: Updating the operating system
ansible.builtin.zypper:
name: "*"
state: latest
update_cache: true
- block:
- name: Updating the operating system
ansible.builtin.zypper:
name: "*"
state: latest
update_cache: true
...
- name: Installing additional packages
ansible.builtin.zypper:
name: "{{ additional_packages[ansible_os_family] }}"
state: latest
- name: "Configure cloud-init."
block:
- name: "Add the SUSE OSS repo."
become: true
community.general.zypper_repository:
name: repo-oss
repo: "http://download.opensuse.org/distribution/leap/15.5/repo/oss/"
auto_import_keys: true
- name: "Installing cloud-init."
become: true
ansible.builtin.zypper:
name: cloud-init
state: latest
when: enable_cloudinit == 'true'

View File

@@ -12,6 +12,12 @@ additional_packages:
- curl
- unzip
- wget
Suse:
- bash-completion
- ca-certificates
- curl
- unzip
- wget
Ubuntu:
- bash-completion
- ca-certificates