Debian Codegraph @

test/integration/targets/cli/setup.yml

raw
1 - hosts: localhost
2 gather_facts: yes
3 roles:
4 - setup_pexpect
5
6 tasks:
7 - name: Test ansible-playbook and ansible with -K
8 block:
9 - name: Create user to connect as
10 user:
11 name: cliuser1
12 shell: /bin/bash
13 groups: wheel
14 append: yes
15 password: "{{ 'secretpassword' | password_hash('sha512', 'mysecretsalt') }}"
16 - name: Create user to become
17 user:
18 name: cliuser2
19 shell: /bin/bash
20 password: "{{ 'secretpassword' | password_hash('sha512', 'mysecretsalt') }}"
21 # Sometimes this file doesn't get removed, and we need it gone to ssh
22 - name: Remove /run/nologin
23 file:
24 path: /run/nologin
25 state: absent
26 # Make Ansible run Python to run Ansible
27 - name: Run the test
28 shell: python test_k_and_K.py {{ ansible_python_interpreter }}
29 always:
30 - name: Remove users
31 user:
32 name: "{{ item }}"
33 state: absent
34 with_items:
35 - cliuser1
36 - cliuser2
37 # For now, we don't test this everywhere, because `user` works differently
38 # on some platforms, as does sudo/sudoers. On Fedora, we can just add
39 # the user to 'wheel' and things magically work.
40 # TODO: In theory, we should test this with all the different 'become'
41 # plugins in base.
42 when: ansible_distribution == 'Fedora'