fix(environment): bring interface up before IP assignment, switch to SSH after network config

This commit is contained in:
2026-03-12 05:28:32 +01:00
committed by MORAWSKI Norbert
parent 31b06f1f56
commit 39043b45ee

View File

@@ -13,6 +13,14 @@
| default('')
}}
- name: Bring up network interface
when:
- hypervisor_type == "vmware"
- environment_interface_name | default('') | length > 0
ansible.builtin.command: "ip link set {{ environment_interface_name }} up"
register: environment_link_result
changed_when: environment_link_result.rc == 0
- name: Set IP-Address
when:
- hypervisor_type == "vmware"
@@ -53,7 +61,10 @@
changed_when: environment_ntp_result.rc == 0
- name: Configure SSH for root login
when: hypervisor_type == "vmware" and hypervisor_cfg.ssh | default(false) | bool
when:
- hypervisor_type == "vmware"
- hypervisor_cfg.ssh | default(false) | bool
- system_cfg.network.ip is defined and system_cfg.network.ip | string | length > 0
block:
- name: Allow login
ansible.builtin.replace:
@@ -73,7 +84,18 @@
name: sshd
state: reloaded
- name: Set SSH connection for VMware
- 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