fix(connection): set ansible_port explicitly at every connection transition
This commit is contained in:
3
main.yml
3
main.yml
@@ -122,6 +122,9 @@
|
|||||||
vars:
|
vars:
|
||||||
_primary: "{{ (system_cfg.users | dict2items | selectattr('value.password', 'defined') | first) }}"
|
_primary: "{{ (system_cfg.users | dict2items | selectattr('value.password', 'defined') | first) }}"
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
|
ansible_connection: ssh
|
||||||
|
ansible_host: "{{ system_cfg.network.ip }}"
|
||||||
|
ansible_port: 22
|
||||||
ansible_user: "{{ _primary.key }}"
|
ansible_user: "{{ _primary.key }}"
|
||||||
ansible_password: "{{ _primary.value.password }}"
|
ansible_password: "{{ _primary.value.password }}"
|
||||||
ansible_become_password: "{{ _primary.value.password }}"
|
ansible_become_password: "{{ _primary.value.password }}"
|
||||||
|
|||||||
@@ -87,9 +87,10 @@
|
|||||||
- name: Switch to SSH connection
|
- name: Switch to SSH connection
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
ansible_connection: ssh
|
ansible_connection: ssh
|
||||||
|
ansible_host: "{{ system_cfg.network.ip }}"
|
||||||
|
ansible_port: 22
|
||||||
ansible_user: root
|
ansible_user: root
|
||||||
ansible_password: ""
|
ansible_password: ""
|
||||||
ansible_host: "{{ system_cfg.network.ip }}"
|
|
||||||
ansible_ssh_extra_args: "-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
|
ansible_ssh_extra_args: "-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
|
||||||
|
|
||||||
- name: Reset connection for SSH switchover
|
- name: Reset connection for SSH switchover
|
||||||
|
|||||||
@@ -84,6 +84,8 @@
|
|||||||
vars:
|
vars:
|
||||||
_primary: "{{ (system_cfg.users | dict2items | selectattr('value.password', 'defined') | first) }}"
|
_primary: "{{ (system_cfg.users | dict2items | selectattr('value.password', 'defined') | first) }}"
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
|
ansible_host: "{{ system_cfg.network.ip }}"
|
||||||
|
ansible_port: 22
|
||||||
ansible_user: "{{ _primary.key }}"
|
ansible_user: "{{ _primary.key }}"
|
||||||
ansible_password: "{{ _primary.value.password }}"
|
ansible_password: "{{ _primary.value.password }}"
|
||||||
ansible_become_password: "{{ _primary.value.password }}"
|
ansible_become_password: "{{ _primary.value.password }}"
|
||||||
|
|||||||
Reference in New Issue
Block a user