Fix variable hierarchy
This commit is contained in:
parent
e5660b0ba7
commit
db1fd13623
@ -2,6 +2,7 @@ all:
|
|||||||
vars:
|
vars:
|
||||||
hypervisor: 'proxmox'
|
hypervisor: 'proxmox'
|
||||||
install_drive: '/dev/sda'
|
install_drive: '/dev/sda'
|
||||||
|
cis: true
|
||||||
children:
|
children:
|
||||||
promox-kvm:
|
promox-kvm:
|
||||||
hosts:
|
hosts:
|
||||||
|
7
main.yml
7
main.yml
@ -20,10 +20,6 @@
|
|||||||
What is your root password?
|
What is your root password?
|
||||||
confirm: true
|
confirm: true
|
||||||
vars_files: vars.yml
|
vars_files: vars.yml
|
||||||
vars:
|
|
||||||
hypervisor: "vmware"
|
|
||||||
cis: false
|
|
||||||
install_drive: "/dev/sda"
|
|
||||||
pre_tasks:
|
pre_tasks:
|
||||||
- name: Set ansible_python_interpreter
|
- name: Set ansible_python_interpreter
|
||||||
when: os | lower in ["almalinux", "rhel9", "rhel8", "rocky"]
|
when: os | lower in ["almalinux", "rhel9", "rhel8", "rocky"]
|
||||||
@ -43,6 +39,7 @@
|
|||||||
that:
|
that:
|
||||||
- hypervisor in ["libvirt", "proxmox", "vmware", "none"]
|
- hypervisor in ["libvirt", "proxmox", "vmware", "none"]
|
||||||
- filesystem in ["btrfs", "ext4", "xfs"]
|
- filesystem in ["btrfs", "ext4", "xfs"]
|
||||||
|
- install_drive is defined
|
||||||
- os in ["archlinux", "almalinux", "debian11", "debian12", "fedora", "rhel8", "rhel9", "rocky", "ubuntu", "ubuntu-lts"]
|
- os in ["archlinux", "almalinux", "debian11", "debian12", "fedora", "rhel8", "rhel9", "rocky", "ubuntu", "ubuntu-lts"]
|
||||||
- os not in ["rhel8", "rhel9"] or rhel_iso is defined
|
- os not in ["rhel8", "rhel9"] or rhel_iso is defined
|
||||||
- (filesystem == "btrfs" and (vm_size | int) >= 10) or (filesystem != "btrfs" and (vm_size | int) >= 20)
|
- (filesystem == "btrfs" and (vm_size | int) >= 10) or (filesystem != "btrfs" and (vm_size | int) >= 20)
|
||||||
@ -74,7 +71,7 @@
|
|||||||
- role: configuration
|
- role: configuration
|
||||||
|
|
||||||
- role: cis
|
- role: cis
|
||||||
when: cis == true
|
when: cis | bool
|
||||||
|
|
||||||
- role: cleanup
|
- role: cleanup
|
||||||
when: install_type == "virtual"
|
when: install_type == "virtual"
|
||||||
|
@ -24,9 +24,8 @@
|
|||||||
backrefs: true
|
backrefs: true
|
||||||
|
|
||||||
- name: Write image from RHEL ISO to the target machine
|
- name: Write image from RHEL ISO to the target machine
|
||||||
ansible.builtin.command: >
|
when: os in ["rhel8", "rhel9"] and hypervisor == 'vmware'
|
||||||
"dd if={{ '/dev/sr1' if hypervisor == 'vmware' else '/dev/sr2' }}
|
ansible.builtin.command: dd if=/dev/sr1 of=/mnt/usr/local/install/redhat/rhel.iso bs=4M
|
||||||
of=/mnt/usr/local/install/redhat/rhel.iso bs=4M status=progress"
|
|
||||||
changed_when: result.rc == 0
|
changed_when: result.rc == 0
|
||||||
register: result
|
register: result
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
block:
|
block:
|
||||||
- name: Wait for connection
|
- name: Wait for connection
|
||||||
ansible.builtin.wait_for_connection:
|
ansible.builtin.wait_for_connection:
|
||||||
timeout: 30
|
timeout: 60
|
||||||
delay: 5
|
delay: 5
|
||||||
|
|
||||||
- name: Gather facts
|
- name: Gather facts
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
pvs: "{{ install_drive }}{{ main_partition_suffix }}"
|
pvs: "{{ install_drive }}{{ main_partition_suffix }}"
|
||||||
|
|
||||||
- name: Create LVM logical volumes
|
- name: Create LVM logical volumes
|
||||||
when: cis or (not cis and item.lv != 'var_log' and item.lv != 'var_log_audit')
|
when: cis | bool or item.lv not in ['var_log', 'var_log_audit']
|
||||||
community.general.lvol:
|
community.general.lvol:
|
||||||
vg: sys
|
vg: sys
|
||||||
lv: "{{ item.lv }}"
|
lv: "{{ item.lv }}"
|
||||||
|
Loading…
Reference in New Issue
Block a user