ansible_mitogen: Templated become method

pull/1192/head
Alex Willmer 2 weeks ago
parent 61c8267605
commit e120cd2cae

@ -478,7 +478,7 @@ class PlayContextSpec(Spec):
return self._become_option('become_flags') return self._become_option('become_flags')
def become_method(self): def become_method(self):
return self._play_context.become_method return self._connection.become.name
def become_user(self): def become_user(self):
return self._become_option('become_user') return self._become_option('become_user')

@ -21,6 +21,8 @@ To avail of fixes in an unreleased version, please download a ZIP file
In progress (unreleased) In progress (unreleased)
------------------------ ------------------------
* :gh:issue:`1083` :mod:`ansible_mitogen`: Templated become method
(e.g. ``ansible_become_method``).
v0.3.17 (2024-11-07) v0.3.17 (2024-11-07)

@ -32,6 +32,7 @@ ansible_user="{{ lookup('pipe', 'whoami') }}"
[tt_become_by_inv] [tt_become_by_inv]
tt-become-exe ansible_become=true ansible_become_exe="{{ 'sudo' | trim }}" ansible_become_user=root tt-become-exe ansible_become=true ansible_become_exe="{{ 'sudo' | trim }}" ansible_become_user=root
tt-become-flags ansible_become=true ansible_become_flags="{{ '--set-home --stdin --non-interactive' | trim }}" ansible_become_user=root tt-become-flags ansible_become=true ansible_become_flags="{{ '--set-home --stdin --non-interactive' | trim }}" ansible_become_user=root
tt-become-method ansible_become=true ansible_become_method="{{ 'sudo' | trim }}" ansible_become_user=root
tt-become-pass ansible_become=true ansible_become_pass="{{ 'pw_required_password' | trim }}" ansible_become_user=mitogen__pw_required tt-become-pass ansible_become=true ansible_become_pass="{{ 'pw_required_password' | trim }}" ansible_become_user=mitogen__pw_required
tt-become-user ansible_become=true ansible_become_user="{{ 'root' | trim }}" tt-become-user ansible_become=true ansible_become_user="{{ 'root' | trim }}"

@ -14,6 +14,7 @@
expected_become_users: expected_become_users:
tt-become-exe: root tt-become-exe: root
tt-become-flags: root tt-become-flags: root
tt-become-method: root
tt-become-pass: mitogen__pw_required tt-become-pass: mitogen__pw_required
tt-become-user: root tt-become-user: root
command: command:

@ -4,6 +4,7 @@
become: true become: true
become_exe: "{{ 'sudo' | trim }}" become_exe: "{{ 'sudo' | trim }}"
become_flags: "{{ '--set-home --stdin --non-interactive' | trim }}" become_flags: "{{ '--set-home --stdin --non-interactive' | trim }}"
become_method: "{{ 'sudo' | trim }}"
become_user: "{{ 'root' | trim }}" become_user: "{{ 'root' | trim }}"
tasks: tasks:
- meta: reset_connection - meta: reset_connection
@ -24,6 +25,7 @@
become: true become: true
become_exe: "{{ 'sudo' | trim }}" become_exe: "{{ 'sudo' | trim }}"
become_flags: "{{ '--set-home --stdin --non-interactive' | trim }}" become_flags: "{{ '--set-home --stdin --non-interactive' | trim }}"
become_method: "{{ 'sudo' | trim }}"
become_user: "{{ 'mitogen__pw_required' | trim }}" become_user: "{{ 'mitogen__pw_required' | trim }}"
vars: vars:
ansible_become_pass: "{{ 'pw_required_password' | trim }}" ansible_become_pass: "{{ 'pw_required_password' | trim }}"

@ -5,6 +5,7 @@
ansible_become: true ansible_become: true
ansible_become_exe: "{{ 'sudo' | trim }}" ansible_become_exe: "{{ 'sudo' | trim }}"
ansible_become_flags: "{{ '--set-home --stdin --non-interactive' | trim }}" ansible_become_flags: "{{ '--set-home --stdin --non-interactive' | trim }}"
ansible_become_method: "{{ 'sudo' | trim }}"
ansible_become_user: "{{ 'root' | trim }}" ansible_become_user: "{{ 'root' | trim }}"
tasks: tasks:
- name: Templated become by play vars, no password - name: Templated become by play vars, no password
@ -24,6 +25,7 @@
ansible_become: true ansible_become: true
ansible_become_exe: "{{ 'sudo' | trim }}" ansible_become_exe: "{{ 'sudo' | trim }}"
ansible_become_flags: "{{ '--set-home --stdin --non-interactive' | trim }}" ansible_become_flags: "{{ '--set-home --stdin --non-interactive' | trim }}"
ansible_become_method: "{{ 'sudo' | trim }}"
ansible_become_pass: "{{ 'pw_required_password' | trim }}" ansible_become_pass: "{{ 'pw_required_password' | trim }}"
ansible_become_user: "{{ 'mitogen__pw_required' | trim }}" ansible_become_user: "{{ 'mitogen__pw_required' | trim }}"
tasks: tasks:

@ -6,6 +6,7 @@
become: true become: true
become_exe: "{{ 'sudo' | trim }}" become_exe: "{{ 'sudo' | trim }}"
become_flags: "{{ '--set-home --stdin --non-interactive' | trim }}" become_flags: "{{ '--set-home --stdin --non-interactive' | trim }}"
become_method: "{{ 'sudo' | trim }}"
become_user: "{{ 'root' | trim }}" become_user: "{{ 'root' | trim }}"
tasks: tasks:
- name: Reset connection to target that will be delegate_to - name: Reset connection to target that will be delegate_to
@ -19,6 +20,7 @@
become: true become: true
become_exe: "{{ 'sudo' | trim }}" become_exe: "{{ 'sudo' | trim }}"
become_flags: "{{ '--set-home --stdin --non-interactive' | trim }}" become_flags: "{{ '--set-home --stdin --non-interactive' | trim }}"
become_method: "{{ 'sudo' | trim }}"
become_user: "{{ 'root' | trim }}" become_user: "{{ 'root' | trim }}"
delegate_to: "{{ groups.tt_become_bare[0] }}" delegate_to: "{{ groups.tt_become_bare[0] }}"
command: command:
@ -39,6 +41,7 @@
become: true become: true
become_exe: "{{ 'sudo' | trim }}" become_exe: "{{ 'sudo' | trim }}"
become_flags: "{{ '--set-home --stdin --non-interactive' | trim }}" become_flags: "{{ '--set-home --stdin --non-interactive' | trim }}"
become_method: "{{ 'sudo' | trim }}"
become_user: "{{ 'mitogen__pw_required' | trim }}" become_user: "{{ 'mitogen__pw_required' | trim }}"
vars: vars:
ansible_become_pass: "{{ 'pw_required_password' | trim }}" ansible_become_pass: "{{ 'pw_required_password' | trim }}"
@ -60,6 +63,7 @@
become: true become: true
become_exe: "{{ 'sudo' | trim }}" become_exe: "{{ 'sudo' | trim }}"
become_flags: "{{ '--set-home --stdin --non-interactive' | trim }}" become_flags: "{{ '--set-home --stdin --non-interactive' | trim }}"
become_method: "{{ 'sudo' | trim }}"
become_user: "{{ 'mitogen__pw_required' | trim }}" become_user: "{{ 'mitogen__pw_required' | trim }}"
delegate_to: "{{ groups.tt_become_bare[0] }}" delegate_to: "{{ groups.tt_become_bare[0] }}"
vars: vars:

@ -59,6 +59,7 @@ ansible_user=mitogen__has_sudo_nopw
[tt_become_by_inv] [tt_become_by_inv]
tt-become-exe ansible_become=true ansible_become_exe="{{ '{{' }} 'sudo' | trim {{ '}}' }}" ansible_become_user=root tt-become-exe ansible_become=true ansible_become_exe="{{ '{{' }} 'sudo' | trim {{ '}}' }}" ansible_become_user=root
tt-become-flags ansible_become=true ansible_become_flags="{{ '{{' }} '--set-home --stdin --non-interactive' | trim {{ '}}' }}" ansible_become_user=root tt-become-flags ansible_become=true ansible_become_flags="{{ '{{' }} '--set-home --stdin --non-interactive' | trim {{ '}}' }}" ansible_become_user=root
tt-become-method ansible_become=true ansible_become_method="{{ '{{' }} 'sudo' | trim {{ '}}' }}" ansible_become_user=root
tt-become-pass ansible_become=true ansible_become_pass="{{ '{{' }} 'pw_required_password' | trim {{ '}}' }}" ansible_become_user=mitogen__pw_required tt-become-pass ansible_become=true ansible_become_pass="{{ '{{' }} 'pw_required_password' | trim {{ '}}' }}" ansible_become_user=mitogen__pw_required
tt-become-user ansible_become=true ansible_become_user="{{ '{{' }} 'root' | trim {{ '}}' }}" tt-become-user ansible_become=true ansible_become_user="{{ '{{' }} 'root' | trim {{ '}}' }}"

Loading…
Cancel
Save