refactor(vmware): move ansible_connection out of global_defaults into role params
This commit is contained in:
12
main.yml
12
main.yml
@@ -110,6 +110,10 @@
|
|||||||
ansible.builtin.import_role:
|
ansible.builtin.import_role:
|
||||||
name: system_check
|
name: system_check
|
||||||
|
|
||||||
|
- name: Determine target connection type
|
||||||
|
ansible.builtin.set_fact:
|
||||||
|
_target_connection: "{{ 'vmware_tools' if hypervisor_type == 'vmware' else 'ssh' }}"
|
||||||
|
|
||||||
roles:
|
roles:
|
||||||
- role: virtualization
|
- role: virtualization
|
||||||
when: system_cfg.type == "virtual"
|
when: system_cfg.type == "virtual"
|
||||||
@@ -117,24 +121,28 @@
|
|||||||
ansible_connection: local
|
ansible_connection: local
|
||||||
|
|
||||||
- role: environment
|
- role: environment
|
||||||
vars:
|
ansible_connection: "{{ _target_connection }}"
|
||||||
ansible_connection: "{{ 'vmware_tools' if hypervisor_type == 'vmware' else 'ssh' }}"
|
|
||||||
|
|
||||||
- role: partitioning
|
- role: partitioning
|
||||||
|
ansible_connection: "{{ _target_connection }}"
|
||||||
vars:
|
vars:
|
||||||
partitioning_boot_partition_suffix: 1
|
partitioning_boot_partition_suffix: 1
|
||||||
partitioning_main_partition_suffix: 2
|
partitioning_main_partition_suffix: 2
|
||||||
|
|
||||||
- role: bootstrap
|
- role: bootstrap
|
||||||
|
ansible_connection: "{{ _target_connection }}"
|
||||||
|
|
||||||
- role: configuration
|
- role: configuration
|
||||||
|
ansible_connection: "{{ _target_connection }}"
|
||||||
|
|
||||||
- role: cis
|
- role: cis
|
||||||
when: system_cfg.features.cis.enabled | bool
|
when: system_cfg.features.cis.enabled | bool
|
||||||
|
ansible_connection: "{{ _target_connection }}"
|
||||||
|
|
||||||
- role: cleanup
|
- role: cleanup
|
||||||
when: system_cfg.type in ["virtual", "physical"]
|
when: system_cfg.type in ["virtual", "physical"]
|
||||||
become: false
|
become: false
|
||||||
|
ansible_connection: "{{ _target_connection }}"
|
||||||
|
|
||||||
post_tasks:
|
post_tasks:
|
||||||
- name: Set post-reboot connection flags
|
- name: Set post-reboot connection flags
|
||||||
|
|||||||
@@ -88,10 +88,9 @@
|
|||||||
ansible_ssh_extra_args: "-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
|
ansible_ssh_extra_args: "-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
|
||||||
no_log: true
|
no_log: true
|
||||||
|
|
||||||
- name: Set connection for VMware
|
- name: Derive VMware Tools connection variables
|
||||||
when: hypervisor_type == "vmware"
|
when: hypervisor_type == "vmware"
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
ansible_connection: vmware_tools
|
|
||||||
ansible_vmware_host: "{{ hypervisor_cfg.url }}"
|
ansible_vmware_host: "{{ hypervisor_cfg.url }}"
|
||||||
ansible_vmware_port: 443
|
ansible_vmware_port: 443
|
||||||
ansible_vmware_user: "{{ hypervisor_cfg.username }}"
|
ansible_vmware_user: "{{ hypervisor_cfg.username }}"
|
||||||
|
|||||||
Reference in New Issue
Block a user