-
Notifications
You must be signed in to change notification settings - Fork 311
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactors with: - fully qualified module names - properly formed blocks - named blocks - corrected indenttion - moved the when directive to top of blocks - idempotent commands - prefixed task_names var with role name - added some changed when's to silence linter where needed - suse hard coded values moved to var/main.yml Signed-off-by: Ryan Johnson <[email protected]>
- Loading branch information
1 parent
ca58cf1
commit 9b474ff
Showing
30 changed files
with
514 additions
and
441 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
--- | ||
- name: "{{ task_name }}" | ||
include_tasks: "{{ ansible_os_family | lower }}.yml" | ||
- name: "{{ base_task_name }}" | ||
ansible.builtin.include_tasks: "{{ ansible_os_family | lower }}.yml" | ||
when: ansible_os_family in ['Debian', 'RedHat', 'Suse'] | ||
|
||
- name: "{{ task_name }}" | ||
include_tasks: "{{ ansible_lsb.codename | lower }}.yml" | ||
- name: "{{ base_task_name }}" | ||
ansible.builtin.include_tasks: "{{ ansible_lsb.codename | lower }}.yml" | ||
when: ansible_distribution == 'VMware Photon OS' | ||
|
||
- name: "{{ task_name }}" | ||
include_tasks: windows.yml | ||
- name: "{{ base_task_name }}" | ||
ansible.builtin.include_tasks: windows.yml | ||
when: ansible_os_family == "Windows" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,114 @@ | ||
--- | ||
# Red Hat Enterprise Linux or derivative specific tasks. | ||
|
||
# Tasks for disconnecting from Red Hat Subscription Manager. | ||
- name: "Getting guest operating system information." | ||
debug: | ||
- name: Getting guest operating system information. | ||
ansible.builtin.debug: | ||
msg: "OS: {{ ansible_distribution }} {{ ansible_distribution_version }}" | ||
|
||
- name: "Checking the Red Hat Subscription Manager status." | ||
command: | ||
- name: Checking the Red Hat Subscription Manager status. | ||
when: ansible_distribution == 'RedHat' | ||
ansible.builtin.command: | ||
cmd: subscription-manager status | ||
register: result | ||
failed_when: "'ERROR' in result.stderr" | ||
when: ansible_distribution == 'RedHat' | ||
changed_when: false | ||
|
||
# Tasks for upgrading the almalinux-release package. | ||
- name: "Upgrade almalinux-release package." | ||
dnf: | ||
name: almalinux-release | ||
state: latest | ||
become: true | ||
- name: Tasks for AlmaLinux | ||
when: ansible_distribution == 'AlmaLinux' | ||
become: true | ||
block: | ||
- name: Upgrade almalinux-release package. | ||
ansible.builtin.dnf: | ||
name: almalinux-release | ||
state: latest # noqa package-latest | ||
|
||
- name: Installing cloud-init. | ||
when: enable_cloudinit == 'true' and ansible_distribution_version | int >= 8 | ||
ansible.builtin.dnf: | ||
name: cloud-init | ||
state: latest # noqa package-latest | ||
|
||
# Tasks for updating the operating system and installing additional packages. | ||
- block: | ||
- name: "Updating the operating system." | ||
dnf: | ||
name: "*" | ||
state: latest # noqa package-latest | ||
update_cache: true | ||
|
||
- name: "Installing additional packages." | ||
dnf: | ||
name: "{{ additional_packages[ansible_os_family] }}" | ||
state: latest # noqa package-latest | ||
|
||
- name: "Installing cloud-init." | ||
become: true | ||
dnf: | ||
name: cloud-init | ||
state: latest | ||
when: enable_cloudinit == 'true' and ansible_distribution_version | int >= 8 | ||
- name: Updating the operating system and installing additional packages. | ||
when: | ||
- ansible_distribution == 'Fedora' | ||
- ansible_os_family == 'RedHat' and ansible_distribution_major_version | int >= 8 | ||
block: | ||
- name: Updating the operating system. | ||
ansible.builtin.dnf: | ||
name: "*" | ||
state: latest # noqa package-latest | ||
update_cache: true | ||
|
||
- name: Installing additional packages. | ||
ansible.builtin.dnf: | ||
name: "{{ base_additional_packages[ansible_os_family] }}" | ||
state: latest # noqa package-latest | ||
|
||
- name: Installing cloud-init. | ||
when: enable_cloudinit == 'true' and ansible_distribution_version | int >= 8 | ||
become: true | ||
ansible.builtin.dnf: | ||
name: cloud-init | ||
state: latest # noqa package-latest | ||
|
||
# Tasks for Rocky Cloud Install. | ||
- name: Tasks for Rocky Linux Cloud-init | ||
when: ansible_distribution == 'Rocky' | ||
become: true | ||
block: | ||
- name: Installing cloud-init. | ||
when: enable_cloudinit == 'true' and ansible_distribution_version | int >= 8 | ||
ansible.builtin.dnf: | ||
name: cloud-init | ||
state: latest # noqa package-latest | ||
|
||
# Tasks for Oracle Cloud Install. | ||
- name: Tasks for Oracle Linux Cloud-init | ||
when: ansible_distribution == 'OracleLinux' | ||
become: true | ||
block: | ||
- name: Installing cloud-init. | ||
when: enable_cloudinit == 'true' and ansible_distribution_version | int >= 8 | ||
ansible.builtin.dnf: | ||
name: cloud-init | ||
state: latest # noqa package-latest | ||
|
||
# Tasks for CentOS Cloud Install. | ||
- name: Tasks for Centos Linux Cloud-init | ||
when: ansible_distribution == 'CentOS' | ||
become: true | ||
block: | ||
- name: Installing cloud-init. | ||
when: enable_cloudinit == 'true' and ansible_distribution_version | int >= 8 | ||
ansible.builtin.dnf: | ||
name: cloud-init | ||
state: latest # noqa package-latest | ||
|
||
# Tasks for updating the operating system and installing additional packages. | ||
- block: | ||
- name: "Updating the operating system." | ||
yum: | ||
name: "*" | ||
state: latest # noqa package-latest | ||
update_cache: true | ||
|
||
- name: "Installing additional packages." | ||
yum: | ||
name: "{{ additional_packages[ansible_os_family] }}" | ||
state: latest # noqa package-latest | ||
- name: Updating the operating system and installing additional packages. | ||
when: ansible_os_family == 'RedHat' and ansible_distribution_major_version | int < 8 | ||
block: | ||
- name: Updating the operating system. | ||
ansible.builtin.yum: # noqa fqcn[action-core] | ||
name: "*" | ||
state: latest # noqa package-latest | ||
update_cache: true | ||
|
||
- name: Installing additional packages. | ||
ansible.builtin.yum: # noqa fqcn[action-core] | ||
name: "{{ base_additional_packages[ansible_os_family] }}" | ||
state: latest # noqa package-latest | ||
|
||
# Tasks for CentOS Cloud Install. | ||
- name: Tasks for Centos Linux Cloud-init | ||
when: ansible_distribution == 'CentOS' | ||
become: true | ||
block: | ||
- name: Installing cloud-init. | ||
when: enable_cloudinit == 'true' and ansible_distribution_version | int < 8 | ||
ansible.builtin.yum: | ||
name: cloud-init | ||
state: latest # noqa package-latest | ||
``` |
Oops, something went wrong.