|
|
|
# Each case is followed by mitogen_via= case to test hostvars pass.
|
|
|
|
|
|
|
|
|
|
|
|
# No become-pass set, defaults to "root"
|
|
|
|
- name: integration/transport_config/become_pass.yml
|
|
|
|
hosts: tc-become-pass-unset
|
|
|
|
become: true
|
|
|
|
tasks:
|
|
|
|
- include_tasks: ../_mitogen_only.yml
|
|
|
|
- {mitogen_get_stack: {}, register: out}
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- out.result|length == 2
|
|
|
|
- out.result[0].method == "ssh"
|
|
|
|
- out.result[1].method == "sudo"
|
|
|
|
- out.result[1].kwargs.password == None
|
|
|
|
fail_msg: |
|
|
|
|
out={{ out }}
|
|
|
|
tags:
|
|
|
|
- mitogen_only
|
|
|
|
|
|
|
|
# Not set, unbecoming mitogen_via=
|
|
|
|
- hosts: tc-become-pass-unset
|
|
|
|
become: true
|
|
|
|
vars: {mitogen_via: tc-become-pass-password}
|
|
|
|
tasks:
|
|
|
|
- include_tasks: ../_mitogen_only.yml
|
|
|
|
- {mitogen_get_stack: {}, register: out}
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- out.result|length == 3
|
|
|
|
- out.result[0].method == "ssh"
|
|
|
|
- out.result[1].method == "ssh"
|
|
|
|
- out.result[2].method == "sudo"
|
|
|
|
- out.result[2].kwargs.password == None
|
|
|
|
fail_msg: |
|
|
|
|
out={{ out }}
|
|
|
|
tags:
|
|
|
|
- mitogen_only
|
|
|
|
|
|
|
|
# Not set, becoming mitogen_via=
|
|
|
|
- hosts: tc-become-pass-unset
|
|
|
|
become: true
|
|
|
|
vars: {mitogen_via: viapass@tc-become-pass-password}
|
|
|
|
tasks:
|
|
|
|
- include_tasks: ../_mitogen_only.yml
|
|
|
|
- {mitogen_get_stack: {}, register: out}
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- out.result|length == 4
|
|
|
|
- out.result[0].method == "ssh"
|
|
|
|
- out.result[1].method == "sudo"
|
|
|
|
- out.result[1].kwargs.password == "apassword"
|
|
|
|
- out.result[2].method == "ssh"
|
|
|
|
- out.result[3].method == "sudo"
|
|
|
|
- out.result[3].kwargs.password == None
|
|
|
|
fail_msg: |
|
|
|
|
out={{ out }}
|
|
|
|
tags:
|
|
|
|
- mitogen_only
|
|
|
|
|
|
|
|
|
|
|
|
# ansible_become_password= set.
|
|
|
|
- hosts: tc-become-pass-password
|
|
|
|
become: true
|
|
|
|
tasks:
|
|
|
|
- include_tasks: ../_mitogen_only.yml
|
|
|
|
- {mitogen_get_stack: {}, register: out}
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- out.result|length == 2
|
|
|
|
- out.result[0].method == "ssh"
|
|
|
|
- out.result[1].method == "sudo"
|
|
|
|
- out.result[1].kwargs.password == "apassword"
|
|
|
|
fail_msg: |
|
|
|
|
out={{ out }}
|
|
|
|
tags:
|
|
|
|
- mitogen_only
|
|
|
|
|
|
|
|
|
|
|
|
# ansible_become_password=, via=
|
|
|
|
- hosts: tc-become-pass-password
|
|
|
|
vars: {mitogen_via: root@tc-become-pass-pass}
|
|
|
|
become: true
|
|
|
|
tasks:
|
|
|
|
- include_tasks: ../_mitogen_only.yml
|
|
|
|
- {mitogen_get_stack: {}, register: out}
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- out.result|length == 4
|
|
|
|
- out.result[0].method == "ssh"
|
|
|
|
- out.result[1].method == "sudo"
|
|
|
|
- out.result[1].kwargs.password == "apass"
|
|
|
|
- out.result[2].method == "ssh"
|
|
|
|
- out.result[3].method == "sudo"
|
|
|
|
- out.result[3].kwargs.password == "apassword"
|
|
|
|
fail_msg: |
|
|
|
|
out={{ out }}
|
|
|
|
tags:
|
|
|
|
- mitogen_only
|
|
|
|
|
|
|
|
|
|
|
|
# ansible_become_pass=
|
|
|
|
- hosts: tc-become-pass-pass
|
|
|
|
become: true
|
|
|
|
tasks:
|
|
|
|
- include_tasks: ../_mitogen_only.yml
|
|
|
|
- {mitogen_get_stack: {}, register: out}
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- out.result|length == 2
|
|
|
|
- out.result[0].method == "ssh"
|
|
|
|
- out.result[1].method == "sudo"
|
|
|
|
- out.result[1].kwargs.password == "apass"
|
|
|
|
fail_msg: |
|
|
|
|
out={{ out }}
|
|
|
|
tags:
|
|
|
|
- mitogen_only
|
|
|
|
|
|
|
|
|
|
|
|
# ansible_become_pass=, via=
|
|
|
|
- hosts: tc-become-pass-pass
|
|
|
|
vars: {mitogen_via: root@tc-become-pass-password}
|
|
|
|
become: true
|
|
|
|
tasks:
|
|
|
|
- include_tasks: ../_mitogen_only.yml
|
|
|
|
- {mitogen_get_stack: {}, register: out}
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- out.result|length == 4
|
|
|
|
- out.result[0].method == "ssh"
|
|
|
|
- out.result[1].method == "sudo"
|
|
|
|
- out.result[1].kwargs.password == "apassword"
|
|
|
|
- out.result[2].method == "ssh"
|
|
|
|
- out.result[3].method == "sudo"
|
|
|
|
- out.result[3].kwargs.password == "apass"
|
|
|
|
fail_msg: |
|
|
|
|
out={{ out }}
|
|
|
|
tags:
|
|
|
|
- mitogen_only
|
|
|
|
|
|
|
|
|
|
|
|
- hosts: tc-become-pass-both
|
|
|
|
become: true
|
|
|
|
tasks:
|
|
|
|
- include_tasks: ../_mitogen_only.yml
|
|
|
|
- {mitogen_get_stack: {}, register: out}
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- out.result|length == 2
|
|
|
|
- out.result[0].method == "ssh"
|
|
|
|
- out.result[1].method == "sudo"
|
|
|
|
# Ansible <= 2.9.1 prioritises ansible_become_password.
|
|
|
|
# Ansible >= 2.9.2 prioritises ansible_become_pass.
|
|
|
|
# https://github.com/ansible/ansible/commit/480b106d6535978ae6ecab68b40942ca4fa914a0
|
|
|
|
- out.result[1].kwargs.password == "bpass"
|
|
|
|
fail_msg: |
|
|
|
|
out={{ out }}
|
|
|
|
tags:
|
|
|
|
- mitogen_only
|
|
|
|
|
|
|
|
|
|
|
|
# both, mitogen_via
|
|
|
|
- hosts: tc-become-pass-unset
|
|
|
|
vars: {mitogen_via: root@tc-become-pass-both}
|
|
|
|
tasks:
|
|
|
|
- include_tasks: ../_mitogen_only.yml
|
|
|
|
- {mitogen_get_stack: {}, register: out}
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- out.result|length == 3
|
|
|
|
- out.result[0].method == "ssh"
|
|
|
|
- out.result[1].method == "sudo"
|
|
|
|
- out.result[1].kwargs.password == "bpass"
|
|
|
|
- out.result[2].method == "ssh"
|
|
|
|
fail_msg: |
|
|
|
|
out={{ out }}
|
|
|
|
tags:
|
|
|
|
- mitogen_only
|