# Each case is followed by mitogen_via= case to test hostvars user. # No become-user set, defaults to "root" - name: integration/transport_config/become_user.yml hosts: tc-become-user-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.username == "root" fail_msg: | out={{ out }} tags: - mitogen_only # Not set, unbecoming mitogen_via= - hosts: tc-become-user-unset become: true vars: {mitogen_via: tc-become-user-set} 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.username == "root" fail_msg: | out={{ out }} tags: - mitogen_only # Not set, becoming mitogen_via= - hosts: tc-become-user-unset become: true vars: {mitogen_via: viauser@tc-become-user-set} 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.username == "viauser" - out.result[2].method == "ssh" - out.result[3].method == "sudo" - out.result[3].kwargs.username == "root" fail_msg: | out={{ out }} tags: - mitogen_only # ansible_become_user= set. - hosts: tc-become-user-set 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.username == "ansi-become-user" fail_msg: | out={{ out }} tags: - mitogen_only # ansible_become_user=, unbecoming via= - hosts: tc-become-user-set vars: {mitogen_via: tc-become-user-unset} become: true tasks: - include_tasks: ../_mitogen_only.yml - {mitogen_get_stack: {}, register: out} - assert: that: - out.result|length == 3 - out.result[0].method == "ssh" - out.result[0].kwargs.hostname == "tc-become-user-unset" - out.result[1].method == "ssh" - out.result[1].kwargs.hostname == "tc-become-user-set" - out.result[2].method == "sudo" - out.result[2].kwargs.username == "ansi-become-user" fail_msg: | out={{ out }} tags: - mitogen_only # ansible_become_user=, becoming via= - hosts: tc-become-user-set vars: {mitogen_via: "doas:doasuser@tc-become-user-unset"} 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[0].kwargs.hostname == "tc-become-user-unset" - out.result[1].method == "doas" - out.result[1].kwargs.username == "doasuser" - out.result[2].method == "ssh" - out.result[2].kwargs.hostname == "tc-become-user-set" - out.result[3].method == "sudo" - out.result[3].kwargs.username == "ansi-become-user" fail_msg: | out={{ out }} tags: - mitogen_only