File: become_same_user.yml

package info (click to toggle)
python-mitogen 0.3.36-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,708 kB
  • sloc: python: 24,457; sh: 198; makefile: 74; perl: 19; ansic: 18
file content (42 lines) | stat: -rw-r--r-- 987 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# issue #499: ensure C.BECOME_ALLOW_SAME_USER is respected.
---

- name: integration/connection/become_same_user.yml
  hosts: bsu-joe
  gather_facts: no
  tasks:
  - include_tasks: ../_mitogen_only.yml

  # bsu-joe's login user is joe, so become should be ignored.
  - mitogen_get_stack:
    become: true
    become_user: joe
    register: out

  - assert:
      that:
      - out.result[0].method == "ssh"
      - out.result[0].kwargs.username == "joe"
      - out.result|length == 1  # no sudo
      fail_msg: |
        out={{ out }}


  # Now try with a different account.
  - mitogen_get_stack:
    become: true
    become_user: james
    register: out

  - assert:
      that:
      - out.result[0].method == "ssh"
      - out.result[0].kwargs.username == "joe"
      - out.result[1].method == "sudo"
      - out.result[1].kwargs.username == "james"
      - out.result|length == 2  # no sudo
      fail_msg: |
        out={{ out }}
  tags:
    - become_same_user
    - mitogen_only