feat: improve ansible playbooks and config

This commit is contained in:
AJ Schroeder
2024-06-11 22:34:57 -05:00
parent f50e97c88f
commit b2dcc40838
6 changed files with 46 additions and 56 deletions

View File

@@ -1,4 +1,5 @@
[defaults]
stdout_callback = default
display_skipped_hosts = false
ansible_python_interpreter = /usr/bin/python3

View File

@@ -1,8 +1,8 @@
---
- become: "yes"
- become: true
become_method: sudo
debugger: never
gather_facts: "yes"
gather_facts: true
hosts: all
roles:
- base

View File

@@ -1,17 +1,13 @@
---
- name: "Updating the guest operating system."
apt:
- block:
- name: "Updating the guest operating system."
ansible.builtin.apt:
force_apt_get: true
name: "*"
state: latest # noqa package-latest
update_cache: "yes"
- name: "Installing additional packages."
apt:
name:
- bash-completion
- curl
- wget
- unzip
- ca-certificates
- name: "Installing additional packages."
ansible.builtin.apt:
name: "{{ additional_packages[ansible_os_family] }}"
state: latest # noqa package-latest

View File

@@ -4,38 +4,16 @@
ansible.builtin.shell: "subscription-manager refresh"
when: "ansible_facts['distribution'] == 'RedHat'"
- name: "Updating the guest operating system."
- block:
- name: "Updating the guest operating system."
ansible.builtin.dnf:
name: "*"
state: latest # noqa package-latest
update_cache: "yes"
when: "ansible_facts['distribution_major_version'] >= \"8\""
- name: "Installing additional packages."
- name: "Installing additional packages."
ansible.builtin.dnf:
name:
- curl
- wget
- unzip
- ca-certificates
name: "{{ additional_packages[ansible_os_family] }}"
state: latest # noqa package-latest
when: "ansible_facts['distribution_major_version'] >= \"8\""
when: ansible_distribution_major_version | int > 8
- name: "Updating the guest operating system."
when: "ansible_facts['distribution_major_version'] <= \"7\""
ansible.builtin.yum:
name: "*"
state: latest # noqa package-latest
update_cache: "yes"
- name: "Installing additional packages."
when: "ansible_facts['distribution_major_version'] <= \"7\""
ansible.builtin.yum:
name:
- curl
- wget
- unzip
- ca-certificates
state: latest # noqa package-latest
...

View File

@@ -8,10 +8,5 @@
- name: "Installing additional packages."
apt:
name:
- bash-completion
- curl
- wget
- unzip
- ca-certificates
name: "{{ additional_packages[ansible_os_family] }}"
state: latest # noqa package-latest

View File

@@ -0,0 +1,20 @@
---
task_name: "Update the operating system and install additional packages."
additional_packages:
Debian:
- bash-completion
- ca-certificates
- curl
- unzip
- wget
RedHat:
- ca-certificates
- curl
- unzip
- wget
Ubuntu:
- bash-completion
- ca-certificates
- curl
- unzip
- wget