normalize docs in become plugins (#9452)

* normalize docs in become plugins

Normalize doc blocks for plugins

* adjustments
pull/9431/head
Alexei Znamensky 2024-12-30 08:23:59 +13:00 committed by GitHub
parent 0bbc3eccd9
commit 29e3226718
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 706 additions and 706 deletions

View File

@ -5,11 +5,11 @@
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type
DOCUMENTATION = ''' DOCUMENTATION = r"""
name: doas name: doas
short_description: Do As user short_description: Do As user
description: description:
- This become plugins allows your remote/login user to execute commands as another user via the doas utility. - This become plugins allows your remote/login user to execute commands as another user using the C(doas) utility.
author: Ansible Core Team author: Ansible Core Team
options: options:
become_user: become_user:
@ -27,7 +27,7 @@ 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: C(doas) executable.
type: string type: string
default: doas default: doas
ini: ini:
@ -42,7 +42,7 @@ 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 C(doas).
type: string type: string
default: '' default: ''
ini: ini:
@ -57,7 +57,7 @@ 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 C(doas) prompt.
type: string type: string
required: false required: false
vars: vars:
@ -84,7 +84,7 @@ DOCUMENTATION = '''
- name: ansible_doas_prompt_l10n - name: ansible_doas_prompt_l10n
env: env:
- name: ANSIBLE_DOAS_PROMPT_L10N - name: ANSIBLE_DOAS_PROMPT_L10N
''' """
import re import re

View File

@ -5,11 +5,11 @@
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type
DOCUMENTATION = ''' DOCUMENTATION = r"""
name: dzdo name: dzdo
short_description: Centrify's Direct Authorize short_description: Centrify's Direct Authorize
description: description:
- This become plugins allows your remote/login user to execute commands as another user via the dzdo utility. - This become plugins allows your remote/login user to execute commands as another user using the C(dzdo) utility.
author: Ansible Core Team author: Ansible Core Team
options: options:
become_user: become_user:
@ -27,7 +27,7 @@ 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: C(dzdo) executable.
type: string type: string
default: dzdo default: dzdo
ini: ini:
@ -42,7 +42,7 @@ 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 C(dzdo).
type: string type: string
default: -H -S -n default: -H -S -n
ini: ini:
@ -57,7 +57,7 @@ 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 C(dzdo).
type: string type: string
required: false required: false
vars: vars:
@ -70,7 +70,7 @@ DOCUMENTATION = '''
ini: ini:
- section: dzdo_become_plugin - section: dzdo_become_plugin
key: password key: password
''' """
from ansible.plugins.become import BecomeBase from ansible.plugins.become import BecomeBase

View File

@ -5,11 +5,11 @@
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type
DOCUMENTATION = ''' DOCUMENTATION = r"""
name: ksu name: ksu
short_description: Kerberos substitute user short_description: Kerberos substitute user
description: description:
- This become plugins allows your remote/login user to execute commands as another user via the ksu utility. - This become plugins allows your remote/login user to execute commands as another user using the C(ksu) utility.
author: Ansible Core Team author: Ansible Core Team
options: options:
become_user: become_user:
@ -28,7 +28,7 @@ DOCUMENTATION = '''
- name: ANSIBLE_KSU_USER - name: ANSIBLE_KSU_USER
required: true required: true
become_exe: become_exe:
description: Su executable. description: C(ksu) executable.
type: string type: string
default: ksu default: ksu
ini: ini:
@ -43,7 +43,7 @@ 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 C(ksu).
type: string type: string
default: '' default: ''
ini: ini:
@ -58,7 +58,7 @@ 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: C(ksu) password.
type: string type: string
required: false required: false
vars: vars:
@ -85,7 +85,7 @@ DOCUMENTATION = '''
- name: ansible_ksu_prompt_l10n - name: ansible_ksu_prompt_l10n
env: env:
- name: ANSIBLE_KSU_PROMPT_L10N - name: ANSIBLE_KSU_PROMPT_L10N
''' """
import re import re

View File

@ -5,11 +5,11 @@
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type
DOCUMENTATION = ''' DOCUMENTATION = r"""
name: machinectl name: machinectl
short_description: Systemd's machinectl privilege escalation short_description: Systemd's machinectl privilege escalation
description: description:
- This become plugins allows your remote/login user to execute commands as another user via the machinectl utility. - This become plugins allows your remote/login user to execute commands as another user using the C(machinectl) utility.
author: Ansible Core Team author: Ansible Core Team
options: options:
become_user: become_user:
@ -28,7 +28,7 @@ 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: C(machinectl) executable.
type: string type: string
default: machinectl default: machinectl
ini: ini:
@ -43,7 +43,7 @@ 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 C(machinectl).
type: string type: string
default: '' default: ''
ini: ini:
@ -58,7 +58,7 @@ 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 C(machinectl).
type: string type: string
required: false required: false
vars: vars:
@ -72,24 +72,23 @@ DOCUMENTATION = '''
- section: machinectl_become_plugin - section: machinectl_become_plugin
key: password key: password
notes: notes:
- When not using this plugin with user V(root), it only works correctly with a polkit rule which will alter - When not using this plugin with user V(root), it only works correctly with a polkit rule which will alter the behaviour
the behaviour of machinectl. This rule must alter the prompt behaviour to ask directly for the user credentials, of machinectl. This rule must alter the prompt behaviour to ask directly for the user credentials, if the user is allowed
if the user is allowed to perform the action (take a look at the examples section). to perform the action (take a look at the examples section). If such a rule is not present the plugin only work if it
If such a rule is not present the plugin only work if it is used in context with the root user, is used in context with the root user, because then no further prompt will be shown by machinectl.
because then no further prompt will be shown by machinectl. """
'''
EXAMPLES = r''' EXAMPLES = r"""
# A polkit rule needed to use the module with a non-root user. # A polkit rule needed to use the module with a non-root user.
# See the Notes section for details. # See the Notes section for details.
/etc/polkit-1/rules.d/60-machinectl-fast-user-auth.rules: | /etc/polkit-1/rules.d/60-machinectl-fast-user-auth.rules: |-
polkit.addRule(function(action, subject) { polkit.addRule(function(action, subject) {
if(action.id == "org.freedesktop.machine1.host-shell" && if(action.id == "org.freedesktop.machine1.host-shell" &&
subject.isInGroup("wheel")) { subject.isInGroup("wheel")) {
return polkit.Result.AUTH_SELF_KEEP; return polkit.Result.AUTH_SELF_KEEP;
} }
}); });
''' """
from re import compile as re_compile from re import compile as re_compile

View File

@ -5,11 +5,11 @@
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type
DOCUMENTATION = ''' DOCUMENTATION = r"""
name: pbrun name: pbrun
short_description: PowerBroker run short_description: PowerBroker run
description: description:
- This become plugins allows your remote/login user to execute commands as another user via the pbrun utility. - This become plugins allows your remote/login user to execute commands as another user using the C(pbrun) utility.
author: Ansible Core Team author: Ansible Core Team
options: options:
become_user: become_user:
@ -28,7 +28,7 @@ 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: C(pbrun) executable.
type: string type: string
default: pbrun default: pbrun
ini: ini:
@ -43,7 +43,7 @@ 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 C(pbrun).
type: string type: string
default: '' default: ''
ini: ini:
@ -58,7 +58,7 @@ 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 C(pbrun).
type: string type: string
required: false required: false
vars: vars:
@ -72,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 C(shell -c) or not. description: Toggle to wrap the command C(pbrun) calls in C(shell -c) or not.
default: false default: false
type: bool type: bool
ini: ini:
@ -82,7 +82,7 @@ DOCUMENTATION = '''
- name: ansible_pbrun_wrap_execution - name: ansible_pbrun_wrap_execution
env: env:
- name: ANSIBLE_PBRUN_WRAP_EXECUTION - name: ANSIBLE_PBRUN_WRAP_EXECUTION
''' """
from ansible.plugins.become import BecomeBase from ansible.plugins.become import BecomeBase

View File

@ -5,18 +5,18 @@
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type
DOCUMENTATION = ''' DOCUMENTATION = r"""
name: pfexec name: pfexec
short_description: profile based execution short_description: profile based execution
description: description:
- This become plugins allows your remote/login user to execute commands as another user via the pfexec utility. - This become plugins allows your remote/login user to execute commands as another user using the C(pfexec) utility.
author: Ansible Core Team author: Ansible Core Team
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 its own C(exec_attr) to figure this out, - This plugin ignores this setting as pfexec uses its own C(exec_attr) to figure this out, but it is supplied here
but it is supplied here for Ansible to make decisions needed for the task execution, like file permissions. for Ansible to make decisions needed for the task execution, like file permissions.
type: string type: string
default: root default: root
ini: ini:
@ -31,7 +31,7 @@ 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: C(pfexec) executable.
type: string type: string
default: pfexec default: pfexec
ini: ini:
@ -46,7 +46,7 @@ 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 C(pfexec).
type: string type: string
default: -H -S -n default: -H -S -n
ini: ini:
@ -61,7 +61,7 @@ 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: C(pfexec) password.
type: string type: string
required: false required: false
vars: vars:
@ -75,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 C(shell -c) or not. description: Toggle to wrap the command C(pfexec) calls in C(shell -c) or not.
default: false default: false
type: bool type: bool
ini: ini:
@ -87,7 +87,7 @@ DOCUMENTATION = '''
- name: ANSIBLE_PFEXEC_WRAP_EXECUTION - name: ANSIBLE_PFEXEC_WRAP_EXECUTION
notes: notes:
- This plugin ignores O(become_user) as pfexec uses its 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

@ -5,15 +5,15 @@
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type
DOCUMENTATION = ''' DOCUMENTATION = r"""
name: pmrun name: pmrun
short_description: Privilege Manager run short_description: Privilege Manager run
description: description:
- This become plugins allows your remote/login user to execute commands as another user via the pmrun utility. - This become plugins allows your remote/login user to execute commands as another user using the C(pmrun) utility.
author: Ansible Core Team author: Ansible Core Team
options: options:
become_exe: become_exe:
description: Sudo executable description: C(pmrun) executable.
type: string type: string
default: pmrun default: pmrun
ini: ini:
@ -28,7 +28,7 @@ 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 C(pmrun).
type: string type: string
default: '' default: ''
ini: ini:
@ -43,7 +43,7 @@ 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: C(pmrun) password.
type: string type: string
required: false required: false
vars: vars:
@ -57,8 +57,8 @@ DOCUMENTATION = '''
- section: pmrun_become_plugin - section: pmrun_become_plugin
key: password key: password
notes: notes:
- This plugin ignores the become_user supplied and uses pmrun's own configuration to select the user. - This plugin ignores the C(become_user) supplied and uses C(pmrun)'s own configuration to select the user.
''' """
from ansible.plugins.become import BecomeBase from ansible.plugins.become import BecomeBase
from ansible.module_utils.six.moves import shlex_quote from ansible.module_utils.six.moves import shlex_quote

View File

@ -7,11 +7,11 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type __metaclass__ = type
DOCUMENTATION = """ DOCUMENTATION = r"""
name: run0 name: run0
short_description: Systemd's run0 short_description: Systemd's run0
description: description:
- This become plugins allows your remote/login user to execute commands as another user via the C(run0) utility. - This become plugins allows your remote/login user to execute commands as another user using the C(run0) utility.
author: author:
- Thomas Sjögren (@konstruktoid) - Thomas Sjögren (@konstruktoid)
version_added: '9.0.0' version_added: '9.0.0'
@ -32,7 +32,7 @@ DOCUMENTATION = """
- name: ANSIBLE_RUN0_USER - name: ANSIBLE_RUN0_USER
type: string type: string
become_exe: become_exe:
description: The C(run0) executable. description: C(run0) executable.
default: run0 default: run0
ini: ini:
- section: privilege_escalation - section: privilege_escalation
@ -47,7 +47,7 @@ DOCUMENTATION = """
- name: ANSIBLE_RUN0_EXE - name: ANSIBLE_RUN0_EXE
type: string type: string
become_flags: become_flags:
description: Options to pass to run0. description: Options to pass to C(run0).
default: '' default: ''
ini: ini:
- section: privilege_escalation - section: privilege_escalation
@ -62,13 +62,13 @@ DOCUMENTATION = """
- name: ANSIBLE_RUN0_FLAGS - name: ANSIBLE_RUN0_FLAGS
type: string type: string
notes: notes:
- This plugin will only work when a polkit rule is in place. - This plugin will only work when a C(polkit) rule is in place.
""" """
EXAMPLES = r""" EXAMPLES = r"""
# An example polkit rule that allows the user 'ansible' in the 'wheel' group # An example polkit rule that allows the user 'ansible' in the 'wheel' group
# to execute commands using run0 without authentication. # to execute commands using run0 without authentication.
/etc/polkit-1/rules.d/60-run0-fast-user-auth.rules: | /etc/polkit-1/rules.d/60-run0-fast-user-auth.rules: |-
polkit.addRule(function(action, subject) { polkit.addRule(function(action, subject) {
if(action.id == "org.freedesktop.systemd1.manage-units" && if(action.id == "org.freedesktop.systemd1.manage-units" &&
subject.isInGroup("wheel") && subject.isInGroup("wheel") &&

View File

@ -5,11 +5,11 @@
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type
DOCUMENTATION = ''' DOCUMENTATION = r"""
name: sesu name: sesu
short_description: CA Privileged Access Manager short_description: CA Privileged Access Manager
description: description:
- This become plugins allows your remote/login user to execute commands as another user via the sesu utility. - This become plugins allows your remote/login user to execute commands as another user using the C(sesu) utility.
author: ansible (@nekonyuu) author: ansible (@nekonyuu)
options: options:
become_user: become_user:
@ -28,7 +28,7 @@ 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: C(sesu) executable.
type: string type: string
default: sesu default: sesu
ini: ini:
@ -43,7 +43,7 @@ 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 C(sesu).
type: string type: string
default: -H -S -n default: -H -S -n
ini: ini:
@ -58,7 +58,7 @@ 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 C(sesu).
type: string type: string
required: false required: false
vars: vars:
@ -71,7 +71,7 @@ DOCUMENTATION = '''
ini: ini:
- section: sesu_become_plugin - section: sesu_become_plugin
key: password key: password
''' """
from ansible.plugins.become import BecomeBase from ansible.plugins.become import BecomeBase

View File

@ -5,11 +5,12 @@
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type
DOCUMENTATION = """ DOCUMENTATION = r"""
name: sudosu name: sudosu
short_description: Run tasks using sudo su - short_description: Run tasks using sudo su -
description: description:
- This become plugin allows your remote/login user to execute commands as another user via the C(sudo) and C(su) utilities combined. - This become plugin allows your remote/login user to execute commands as another user using the C(sudo) and C(su) utilities
combined.
author: author:
- Dag Wieers (@dagwieers) - Dag Wieers (@dagwieers)
version_added: 2.4.0 version_added: 2.4.0
@ -60,8 +61,8 @@ DOCUMENTATION = """
key: password key: password
alt_method: alt_method:
description: description:
- Whether to use an alternative method to call C(su). Instead of running C(su -l user /path/to/shell -c command), - Whether to use an alternative method to call C(su). Instead of running C(su -l user /path/to/shell -c command), it
it runs C(su -l user -c command). runs C(su -l user -c command).
- Use this when the default one is not working on your system. - Use this when the default one is not working on your system.
required: false required: false
type: boolean type: boolean