Debian Codegraph @

ansible_collections/community/general/tests/integration/targets/pam_limits/tasks/main.yml

raw
1 # Test code for the pam_limits module
2 # Copyright (c) 2021, Abhijeet Kasurde <[email protected]>
3 # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
4 # SPDX-License-Identifier: GPL-3.0-or-later
5
6 - name: Set value for temp limit configuration
7 set_fact:
8 test_limit_file: "/tmp/limits.conf"
9
10 - name: Copy temporary limits.conf
11 copy:
12 src: test_pam_limits.conf
13 dest: "{{ test_limit_file }}"
14
15 - name: Test check mode support in pam_limits
16 community.general.pam_limits:
17 domain: smith
18 limit_type: soft
19 limit_item: nofile
20 value: '64000'
21 dest: "{{ test_limit_file }}"
22 check_mode: true
23 register: check_mode_test
24
25 - name: Test that check mode is working
26 assert:
27 that:
28 - check_mode_test is changed
29
30 - name: Add soft limit for smith user
31 community.general.pam_limits:
32 domain: smith
33 limit_type: soft
34 limit_item: nofile
35 value: '64000'
36 dest: "{{ test_limit_file }}"
37 register: soft_limit_test
38
39 - name: Check if changes are made
40 assert:
41 that:
42 - soft_limit_test is changed
43
44 - name: Aagin change soft limit for smith user for idempotency
45 community.general.pam_limits:
46 domain: smith
47 limit_type: soft
48 limit_item: nofile
49 value: '64000'
50 dest: "{{ test_limit_file }}"
51 register: soft_limit_test
52
53 - name: Check if changes are not made idempotency
54 assert:
55 that:
56 - not soft_limit_test.changed
57
58 - name: Change hard limit for Joe user for diff
59 community.general.pam_limits:
60 domain: joe
61 limit_type: hard
62 limit_item: nofile
63 value: '100000'
64 dest: "{{ test_limit_file }}"
65 register: hard_limit_test
66 diff: true
67
68 - name: Debugging output for hard limit test
69 debug:
70 msg: "{{ hard_limit_test }}"
71
72 - name: Check if changes made
73 assert:
74 that:
75 - hard_limit_test is changed
76 - hard_limit_test.diff.after is defined
77 - hard_limit_test.diff.before is defined
78
79 - name: Add comment with change
80 community.general.pam_limits:
81 domain: doom
82 limit_type: hard
83 limit_item: nofile
84 value: '100000'
85 dest: "{{ test_limit_file }}"
86 comment: "This is a nice comment"
87 register: comment_test
88
89 - name: Check if changes made
90 assert:
91 that:
92 - comment_test is changed