fix(bootstrap): move SSH switchover to main.yml between roles, guard become with default
This commit is contained in:
22
main.yml
22
main.yml
@@ -129,6 +129,28 @@
|
||||
ansible.builtin.include_role:
|
||||
name: environment
|
||||
|
||||
- name: Switch to SSH connection for VMware
|
||||
when:
|
||||
- hypervisor_type == "vmware"
|
||||
- hypervisor_cfg.ssh | default(false) | bool
|
||||
- system_cfg.network.ip | default('') | string | length > 0
|
||||
block:
|
||||
- name: Set SSH connection variables
|
||||
ansible.builtin.set_fact:
|
||||
ansible_connection: ssh
|
||||
ansible_user: root
|
||||
ansible_password: ""
|
||||
ansible_host: "{{ system_cfg.network.ip }}"
|
||||
ansible_ssh_extra_args: "-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
|
||||
|
||||
- name: Reset VMware Tools connection
|
||||
ansible.builtin.meta: reset_connection
|
||||
|
||||
- name: Verify SSH connectivity
|
||||
ansible.builtin.wait_for_connection:
|
||||
timeout: 30
|
||||
delay: 2
|
||||
|
||||
- name: Partition disks
|
||||
ansible.builtin.include_role:
|
||||
name: partitioning
|
||||
|
||||
@@ -83,19 +83,3 @@
|
||||
ansible.builtin.service:
|
||||
name: sshd
|
||||
state: reloaded
|
||||
|
||||
- name: Switch to SSH connection
|
||||
ansible.builtin.set_fact:
|
||||
ansible_connection: ssh
|
||||
ansible_user: root
|
||||
ansible_password: ""
|
||||
ansible_host: "{{ system_cfg.network.ip }}"
|
||||
ansible_ssh_extra_args: "-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
|
||||
|
||||
- name: Reset connection to apply SSH switch
|
||||
ansible.builtin.meta: reset_connection
|
||||
|
||||
- name: Wait for SSH connection
|
||||
ansible.builtin.wait_for_connection:
|
||||
timeout: 30
|
||||
delay: 2
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
- name: Configure work environment
|
||||
become: "{{ hypervisor_type != 'vmware' }}"
|
||||
become: "{{ (hypervisor_type | default('none')) != 'vmware' }}"
|
||||
block:
|
||||
- name: Detect and validate live environment
|
||||
ansible.builtin.include_tasks: _detect_live.yml
|
||||
|
||||
Reference in New Issue
Block a user