2022-10-28 10:28:41 +00:00
|
|
|
- hosts: demo
|
|
|
|
gather_facts: no
|
|
|
|
tasks:
|
2023-10-09 06:35:21 +00:00
|
|
|
- name: Verify account connectivity(Do not switch)
|
2023-02-22 07:13:51 +00:00
|
|
|
ansible.builtin.ping:
|
2022-10-28 10:28:41 +00:00
|
|
|
vars:
|
2023-02-22 07:13:51 +00:00
|
|
|
ansible_become: no
|
2022-10-28 10:28:41 +00:00
|
|
|
ansible_user: "{{ account.username }}"
|
|
|
|
ansible_password: "{{ account.secret }}"
|
|
|
|
ansible_ssh_private_key_file: "{{ account.private_key_path }}"
|
2023-10-09 06:35:21 +00:00
|
|
|
when: not account.become.ansible_become
|
|
|
|
|
|
|
|
- name: Verify account connectivity(Switch)
|
|
|
|
ansible.builtin.ping:
|
|
|
|
vars:
|
|
|
|
ansible_become: yes
|
|
|
|
ansible_user: "{{ account.become.ansible_user }}"
|
|
|
|
ansible_password: "{{ account.become.ansible_password }}"
|
|
|
|
ansible_ssh_private_key_file: "{{ account.become.ansible_ssh_private_key_file }}"
|
|
|
|
ansible_become_method: "{{ account.become.ansible_become_method }}"
|
|
|
|
ansible_become_user: "{{ account.become.ansible_become_user }}"
|
|
|
|
ansible_become_password: "{{ account.become.ansible_become_password }}"
|
|
|
|
when: account.become.ansible_become
|