|
1 | 1 | --- |
2 | | - |
3 | | -- name: install pip |
4 | | - package: |
| 2 | +- name: Install pip |
| 3 | + ansible.builtin.package: |
5 | 4 | name: |
6 | 5 | - python3-pip |
7 | 6 | - python3-setuptools |
8 | 7 | state: present |
9 | 8 |
|
10 | | -- name: install pam-tester |
| 9 | +- name: Install pam-tester |
11 | 10 | ansible.builtin.pip: |
12 | 11 | name: pam-tester |
13 | 12 | state: present |
|
17 | 16 | set_fact: |
18 | 17 | test_pw: "myTest!pw" |
19 | 18 |
|
20 | | -- name: set locale for test |
21 | | - set_fact: |
22 | | - locale: "en_US.UTF-8" |
| 19 | +- name: Set locale for test |
| 20 | + ansible.builtin.set_fact: |
| 21 | + locale: en_US.UTF-8 |
23 | 22 | when: |
24 | 23 | - ansible_facts.os_family == 'RedHat' |
25 | 24 | - ansible_facts.distribution_major_version < '8' |
26 | 25 |
|
27 | | -- name: create testuser |
28 | | - user: |
| 26 | +- name: Create testuser |
| 27 | + ansible.builtin.user: |
29 | 28 | name: testuser |
30 | 29 | password: "{{ test_pw | password_hash('sha512') }}" |
31 | 30 |
|
32 | | -- name: check successful login with correct password |
33 | | - shell: |
34 | | - cmd: "/usr/local/bin/pam-tester --user testuser --password {{ test_pw }}" |
| 31 | +- name: Check successful login with correct password |
| 32 | + ansible.builtin.shell: |
| 33 | + cmd: /usr/local/bin/pam-tester --user testuser --password {{ test_pw }} |
35 | 34 | environment: |
36 | 35 | TMPDIR: /var/tmp |
37 | 36 | LC_ALL: "{{ locale | default('C.UTF-8') }}" |
38 | 37 | LANG: "{{ locale | default('C.UTF-8') }}" |
39 | 38 |
|
40 | | -- name: check unsuccessful login with incorrect password |
41 | | - shell: |
42 | | - cmd: "/usr/local/bin/pam-tester --user testuser --password {{ test_pw }}fail --expectfail" |
| 39 | +- name: Check unsuccessful login with incorrect password |
| 40 | + ansible.builtin.shell: |
| 41 | + cmd: /usr/local/bin/pam-tester --user testuser --password {{ test_pw }}fail --expectfail |
43 | 42 | environment: |
44 | 43 | TMPDIR: /var/tmp |
45 | 44 | LC_ALL: "{{ locale | default('C.UTF-8') }}" |
46 | 45 | LANG: "{{ locale | default('C.UTF-8') }}" |
47 | 46 | with_sequence: count=6 |
48 | 47 |
|
49 | | -- name: check unsuccessful login, with correct password (lockout) |
50 | | - shell: |
51 | | - cmd: "/usr/local/bin/pam-tester --user testuser --password {{ test_pw }} --expectfail" |
| 48 | +- name: Check unsuccessful login, with correct password (lockout) |
| 49 | + ansible.builtin.shell: |
| 50 | + cmd: /usr/local/bin/pam-tester --user testuser --password {{ test_pw }} --expectfail |
52 | 51 | environment: |
53 | 52 | TMPDIR: /var/tmp |
54 | 53 | LC_ALL: "{{ locale | default('C.UTF-8') }}" |
55 | 54 | LANG: "{{ locale | default('C.UTF-8') }}" |
56 | 55 |
|
57 | | -- name: wait for account to unlock |
58 | | - pause: |
| 56 | +- name: Wait for account to unlock |
| 57 | + ansible.builtin.pause: |
59 | 58 | seconds: 20 |
60 | 59 |
|
61 | | -- name: check successful login |
62 | | - shell: |
63 | | - cmd: "/usr/local/bin/pam-tester --user testuser --password {{ test_pw }}" |
| 60 | +- name: Check successful login |
| 61 | + ansible.builtin.shell: |
| 62 | + cmd: /usr/local/bin/pam-tester --user testuser --password {{ test_pw }} |
64 | 63 | environment: |
65 | 64 | TMPDIR: /var/tmp |
66 | 65 | LC_ALL: "{{ locale | default('C.UTF-8') }}" |
|
0 commit comments