1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Type options of become plugins (#8623)

Type options of become plugins.
This commit is contained in:
Felix Fontein 2024-07-21 21:02:49 +02:00 committed by GitHub
parent 3a24aa5b6d
commit a24ee93f23
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 77 additions and 37 deletions

View file

@ -0,0 +1,2 @@
minor_changes:
- "doas, dzdo, ksu, machinectl, pbrun, pfexec, pmrun, sesu, sudosu become plugins - make sure that all options are typed (https://github.com/ansible-collections/community.general/pull/8623)."

View file

@ -13,7 +13,8 @@ DOCUMENTATION = '''
author: Ansible Core Team author: Ansible Core Team
options: options:
become_user: become_user:
description: User you 'become' to execute the task description: User you 'become' to execute the task.
type: string
ini: ini:
- section: privilege_escalation - section: privilege_escalation
key: become_user key: become_user
@ -26,7 +27,8 @@ DOCUMENTATION = '''
- name: ANSIBLE_BECOME_USER - name: ANSIBLE_BECOME_USER
- name: ANSIBLE_DOAS_USER - name: ANSIBLE_DOAS_USER
become_exe: become_exe:
description: Doas executable description: Doas executable.
type: string
default: doas default: doas
ini: ini:
- section: privilege_escalation - section: privilege_escalation
@ -40,7 +42,8 @@ DOCUMENTATION = '''
- name: ANSIBLE_BECOME_EXE - name: ANSIBLE_BECOME_EXE
- name: ANSIBLE_DOAS_EXE - name: ANSIBLE_DOAS_EXE
become_flags: become_flags:
description: Options to pass to doas description: Options to pass to doas.
type: string
default: '' default: ''
ini: ini:
- section: privilege_escalation - section: privilege_escalation
@ -54,7 +57,8 @@ DOCUMENTATION = '''
- name: ANSIBLE_BECOME_FLAGS - name: ANSIBLE_BECOME_FLAGS
- name: ANSIBLE_DOAS_FLAGS - name: ANSIBLE_DOAS_FLAGS
become_pass: become_pass:
description: password for doas prompt description: Password for doas prompt.
type: string
required: false required: false
vars: vars:
- name: ansible_become_password - name: ansible_become_password
@ -68,8 +72,10 @@ DOCUMENTATION = '''
key: password key: password
prompt_l10n: prompt_l10n:
description: description:
- List of localized strings to match for prompt detection - List of localized strings to match for prompt detection.
- If empty we'll use the built in one - If empty we will use the built in one.
type: list
elements: string
default: [] default: []
ini: ini:
- section: doas_become_plugin - section: doas_become_plugin

View file

@ -13,7 +13,8 @@ DOCUMENTATION = '''
author: Ansible Core Team author: Ansible Core Team
options: options:
become_user: become_user:
description: User you 'become' to execute the task description: User you 'become' to execute the task.
type: string
ini: ini:
- section: privilege_escalation - section: privilege_escalation
key: become_user key: become_user
@ -26,7 +27,8 @@ DOCUMENTATION = '''
- name: ANSIBLE_BECOME_USER - name: ANSIBLE_BECOME_USER
- name: ANSIBLE_DZDO_USER - name: ANSIBLE_DZDO_USER
become_exe: become_exe:
description: Dzdo executable description: Dzdo executable.
type: string
default: dzdo default: dzdo
ini: ini:
- section: privilege_escalation - section: privilege_escalation
@ -40,7 +42,8 @@ DOCUMENTATION = '''
- name: ANSIBLE_BECOME_EXE - name: ANSIBLE_BECOME_EXE
- name: ANSIBLE_DZDO_EXE - name: ANSIBLE_DZDO_EXE
become_flags: become_flags:
description: Options to pass to dzdo description: Options to pass to dzdo.
type: string
default: -H -S -n default: -H -S -n
ini: ini:
- section: privilege_escalation - section: privilege_escalation
@ -54,7 +57,8 @@ DOCUMENTATION = '''
- name: ANSIBLE_BECOME_FLAGS - name: ANSIBLE_BECOME_FLAGS
- name: ANSIBLE_DZDO_FLAGS - name: ANSIBLE_DZDO_FLAGS
become_pass: become_pass:
description: Options to pass to dzdo description: Options to pass to dzdo.
type: string
required: false required: false
vars: vars:
- name: ansible_become_password - name: ansible_become_password

View file

@ -13,7 +13,8 @@ DOCUMENTATION = '''
author: Ansible Core Team author: Ansible Core Team
options: options:
become_user: become_user:
description: User you 'become' to execute the task description: User you 'become' to execute the task.
type: string
ini: ini:
- section: privilege_escalation - section: privilege_escalation
key: become_user key: become_user
@ -27,7 +28,8 @@ DOCUMENTATION = '''
- name: ANSIBLE_KSU_USER - name: ANSIBLE_KSU_USER
required: true required: true
become_exe: become_exe:
description: Su executable description: Su executable.
type: string
default: ksu default: ksu
ini: ini:
- section: privilege_escalation - section: privilege_escalation
@ -41,7 +43,8 @@ DOCUMENTATION = '''
- name: ANSIBLE_BECOME_EXE - name: ANSIBLE_BECOME_EXE
- name: ANSIBLE_KSU_EXE - name: ANSIBLE_KSU_EXE
become_flags: become_flags:
description: Options to pass to ksu description: Options to pass to ksu.
type: string
default: '' default: ''
ini: ini:
- section: privilege_escalation - section: privilege_escalation
@ -55,7 +58,8 @@ DOCUMENTATION = '''
- name: ANSIBLE_BECOME_FLAGS - name: ANSIBLE_BECOME_FLAGS
- name: ANSIBLE_KSU_FLAGS - name: ANSIBLE_KSU_FLAGS
become_pass: become_pass:
description: ksu password description: Ksu password.
type: string
required: false required: false
vars: vars:
- name: ansible_ksu_pass - name: ansible_ksu_pass
@ -69,8 +73,10 @@ DOCUMENTATION = '''
key: password key: password
prompt_l10n: prompt_l10n:
description: description:
- List of localized strings to match for prompt detection - List of localized strings to match for prompt detection.
- If empty we'll use the built in one - If empty we will use the built in one.
type: list
elements: string
default: [] default: []
ini: ini:
- section: ksu_become_plugin - section: ksu_become_plugin

View file

@ -13,7 +13,8 @@ DOCUMENTATION = '''
author: Ansible Core Team author: Ansible Core Team
options: options:
become_user: become_user:
description: User you 'become' to execute the task description: User you 'become' to execute the task.
type: string
default: '' default: ''
ini: ini:
- section: privilege_escalation - section: privilege_escalation
@ -27,7 +28,8 @@ DOCUMENTATION = '''
- name: ANSIBLE_BECOME_USER - name: ANSIBLE_BECOME_USER
- name: ANSIBLE_MACHINECTL_USER - name: ANSIBLE_MACHINECTL_USER
become_exe: become_exe:
description: Machinectl executable description: Machinectl executable.
type: string
default: machinectl default: machinectl
ini: ini:
- section: privilege_escalation - section: privilege_escalation
@ -41,7 +43,8 @@ DOCUMENTATION = '''
- name: ANSIBLE_BECOME_EXE - name: ANSIBLE_BECOME_EXE
- name: ANSIBLE_MACHINECTL_EXE - name: ANSIBLE_MACHINECTL_EXE
become_flags: become_flags:
description: Options to pass to machinectl description: Options to pass to machinectl.
type: string
default: '' default: ''
ini: ini:
- section: privilege_escalation - section: privilege_escalation
@ -55,7 +58,8 @@ DOCUMENTATION = '''
- name: ANSIBLE_BECOME_FLAGS - name: ANSIBLE_BECOME_FLAGS
- name: ANSIBLE_MACHINECTL_FLAGS - name: ANSIBLE_MACHINECTL_FLAGS
become_pass: become_pass:
description: Password for machinectl description: Password for machinectl.
type: string
required: false required: false
vars: vars:
- name: ansible_become_password - name: ansible_become_password

View file

@ -13,7 +13,8 @@ DOCUMENTATION = '''
author: Ansible Core Team author: Ansible Core Team
options: options:
become_user: become_user:
description: User you 'become' to execute the task description: User you 'become' to execute the task.
type: string
default: '' default: ''
ini: ini:
- section: privilege_escalation - section: privilege_escalation
@ -27,7 +28,8 @@ DOCUMENTATION = '''
- name: ANSIBLE_BECOME_USER - name: ANSIBLE_BECOME_USER
- name: ANSIBLE_PBRUN_USER - name: ANSIBLE_PBRUN_USER
become_exe: become_exe:
description: Sudo executable description: Sudo executable.
type: string
default: pbrun default: pbrun
ini: ini:
- section: privilege_escalation - section: privilege_escalation
@ -41,7 +43,8 @@ DOCUMENTATION = '''
- name: ANSIBLE_BECOME_EXE - name: ANSIBLE_BECOME_EXE
- name: ANSIBLE_PBRUN_EXE - name: ANSIBLE_PBRUN_EXE
become_flags: become_flags:
description: Options to pass to pbrun description: Options to pass to pbrun.
type: string
default: '' default: ''
ini: ini:
- section: privilege_escalation - section: privilege_escalation
@ -55,7 +58,8 @@ DOCUMENTATION = '''
- name: ANSIBLE_BECOME_FLAGS - name: ANSIBLE_BECOME_FLAGS
- name: ANSIBLE_PBRUN_FLAGS - name: ANSIBLE_PBRUN_FLAGS
become_pass: become_pass:
description: Password for pbrun description: Password for pbrun.
type: string
required: false required: false
vars: vars:
- name: ansible_become_password - name: ansible_become_password
@ -68,7 +72,7 @@ DOCUMENTATION = '''
- section: pbrun_become_plugin - section: pbrun_become_plugin
key: password key: password
wrap_exe: wrap_exe:
description: Toggle to wrap the command pbrun calls in 'shell -c' or not description: Toggle to wrap the command pbrun calls in C(shell -c) or not.
default: false default: false
type: bool type: bool
ini: ini:

View file

@ -14,9 +14,10 @@ DOCUMENTATION = '''
options: options:
become_user: become_user:
description: description:
- User you 'become' to execute the task - User you 'become' to execute the task.
- This plugin ignores this setting as pfexec uses it's own C(exec_attr) to figure this out, - This plugin ignores this setting as pfexec uses it's own C(exec_attr) to figure this out,
but it is supplied here for Ansible to make decisions needed for the task execution, like file permissions. but it is supplied here for Ansible to make decisions needed for the task execution, like file permissions.
type: string
default: root default: root
ini: ini:
- section: privilege_escalation - section: privilege_escalation
@ -30,7 +31,8 @@ DOCUMENTATION = '''
- name: ANSIBLE_BECOME_USER - name: ANSIBLE_BECOME_USER
- name: ANSIBLE_PFEXEC_USER - name: ANSIBLE_PFEXEC_USER
become_exe: become_exe:
description: Sudo executable description: Sudo executable.
type: string
default: pfexec default: pfexec
ini: ini:
- section: privilege_escalation - section: privilege_escalation
@ -44,7 +46,8 @@ DOCUMENTATION = '''
- name: ANSIBLE_BECOME_EXE - name: ANSIBLE_BECOME_EXE
- name: ANSIBLE_PFEXEC_EXE - name: ANSIBLE_PFEXEC_EXE
become_flags: become_flags:
description: Options to pass to pfexec description: Options to pass to pfexec.
type: string
default: -H -S -n default: -H -S -n
ini: ini:
- section: privilege_escalation - section: privilege_escalation
@ -58,7 +61,8 @@ DOCUMENTATION = '''
- name: ANSIBLE_BECOME_FLAGS - name: ANSIBLE_BECOME_FLAGS
- name: ANSIBLE_PFEXEC_FLAGS - name: ANSIBLE_PFEXEC_FLAGS
become_pass: become_pass:
description: pfexec password description: pfexec password.
type: string
required: false required: false
vars: vars:
- name: ansible_become_password - name: ansible_become_password
@ -71,7 +75,7 @@ DOCUMENTATION = '''
- section: pfexec_become_plugin - section: pfexec_become_plugin
key: password key: password
wrap_exe: wrap_exe:
description: Toggle to wrap the command pfexec calls in 'shell -c' or not description: Toggle to wrap the command pfexec calls in C(shell -c) or not.
default: false default: false
type: bool type: bool
ini: ini:
@ -82,7 +86,7 @@ DOCUMENTATION = '''
env: env:
- name: ANSIBLE_PFEXEC_WRAP_EXECUTION - name: ANSIBLE_PFEXEC_WRAP_EXECUTION
notes: notes:
- This plugin ignores O(become_user) as pfexec uses it's own C(exec_attr) to figure this out. - This plugin ignores O(become_user) as pfexec uses its own C(exec_attr) to figure this out.
''' '''
from ansible.plugins.become import BecomeBase from ansible.plugins.become import BecomeBase

View file

@ -14,6 +14,7 @@ DOCUMENTATION = '''
options: options:
become_exe: become_exe:
description: Sudo executable description: Sudo executable
type: string
default: pmrun default: pmrun
ini: ini:
- section: privilege_escalation - section: privilege_escalation
@ -27,7 +28,8 @@ DOCUMENTATION = '''
- name: ANSIBLE_BECOME_EXE - name: ANSIBLE_BECOME_EXE
- name: ANSIBLE_PMRUN_EXE - name: ANSIBLE_PMRUN_EXE
become_flags: become_flags:
description: Options to pass to pmrun description: Options to pass to pmrun.
type: string
default: '' default: ''
ini: ini:
- section: privilege_escalation - section: privilege_escalation
@ -41,7 +43,8 @@ DOCUMENTATION = '''
- name: ANSIBLE_BECOME_FLAGS - name: ANSIBLE_BECOME_FLAGS
- name: ANSIBLE_PMRUN_FLAGS - name: ANSIBLE_PMRUN_FLAGS
become_pass: become_pass:
description: pmrun password description: pmrun password.
type: string
required: false required: false
vars: vars:
- name: ansible_become_password - name: ansible_become_password

View file

@ -13,7 +13,8 @@ DOCUMENTATION = '''
author: ansible (@nekonyuu) author: ansible (@nekonyuu)
options: options:
become_user: become_user:
description: User you 'become' to execute the task description: User you 'become' to execute the task.
type: string
default: '' default: ''
ini: ini:
- section: privilege_escalation - section: privilege_escalation
@ -27,7 +28,8 @@ DOCUMENTATION = '''
- name: ANSIBLE_BECOME_USER - name: ANSIBLE_BECOME_USER
- name: ANSIBLE_SESU_USER - name: ANSIBLE_SESU_USER
become_exe: become_exe:
description: sesu executable description: sesu executable.
type: string
default: sesu default: sesu
ini: ini:
- section: privilege_escalation - section: privilege_escalation
@ -41,7 +43,8 @@ DOCUMENTATION = '''
- name: ANSIBLE_BECOME_EXE - name: ANSIBLE_BECOME_EXE
- name: ANSIBLE_SESU_EXE - name: ANSIBLE_SESU_EXE
become_flags: become_flags:
description: Options to pass to sesu description: Options to pass to sesu.
type: string
default: -H -S -n default: -H -S -n
ini: ini:
- section: privilege_escalation - section: privilege_escalation
@ -55,7 +58,8 @@ DOCUMENTATION = '''
- name: ANSIBLE_BECOME_FLAGS - name: ANSIBLE_BECOME_FLAGS
- name: ANSIBLE_SESU_FLAGS - name: ANSIBLE_SESU_FLAGS
become_pass: become_pass:
description: Password to pass to sesu description: Password to pass to sesu.
type: string
required: false required: false
vars: vars:
- name: ansible_become_password - name: ansible_become_password

View file

@ -16,6 +16,7 @@ DOCUMENTATION = """
options: options:
become_user: become_user:
description: User you 'become' to execute the task. description: User you 'become' to execute the task.
type: string
default: root default: root
ini: ini:
- section: privilege_escalation - section: privilege_escalation
@ -30,6 +31,7 @@ DOCUMENTATION = """
- name: ANSIBLE_SUDO_USER - name: ANSIBLE_SUDO_USER
become_flags: become_flags:
description: Options to pass to C(sudo). description: Options to pass to C(sudo).
type: string
default: -H -S -n default: -H -S -n
ini: ini:
- section: privilege_escalation - section: privilege_escalation
@ -44,6 +46,7 @@ DOCUMENTATION = """
- name: ANSIBLE_SUDO_FLAGS - name: ANSIBLE_SUDO_FLAGS
become_pass: become_pass:
description: Password to pass to C(sudo). description: Password to pass to C(sudo).
type: string
required: false required: false
vars: vars:
- name: ansible_become_password - name: ansible_become_password