feat: ssh_ping及custom_command支持sudo及su切换用户 (#11180)

This commit is contained in:
jiangweidong
2023-08-03 14:09:13 +08:00
committed by GitHub
parent 8cfec07faa
commit ff2aace569
6 changed files with 119 additions and 30 deletions

View File

@@ -2,6 +2,7 @@
gather_facts: no
vars:
ansible_connection: local
ansible_become: false
tasks:
- name: Verify account (paramiko)
@@ -12,3 +13,8 @@
login_password: "{{ account.secret }}"
login_secret_type: "{{ account.secret_type }}"
login_private_key_path: "{{ account.private_key_path }}"
become: "{{ custom_become | default(False) }}"
become_method: "{{ custom_become_method | default('su') }}"
become_user: "{{ custom_become_user | default('') }}"
become_password: "{{ custom_become_password | default('') }}"
become_private_key_path: "{{ custom_become_private_key_path | default(None) }}"