Debian Codegraph @

ansible_collections/community/general/tests/integration/targets/locale_gen/tasks/basic.yml

raw
1 ---
2 # Copyright (c) Ansible Project
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: Is the locale we're going to test against installed? {{ locale_basic.localegen }}
7 command: locale -a
8 register: initial_state
9 ignore_errors: true
10
11 - name: Make sure the locale is not installed {{ locale_basic.localegen }}
12 locale_gen:
13 name: "{{ locale_basic.localegen }}"
14 state: absent
15
16 - name: Is the locale present? {{ locale_basic.localegen }}
17 command: locale -a
18 register: cleaned
19 ignore_errors: true
20
21 - name: Make sure the locale is not present {{ locale_basic.localegen }}
22 assert:
23 that:
24 - locale_basic.skip_removal or locale_basic.locales | intersect(cleaned.stdout_lines) == []
25
26 - name: Install the locale {{ locale_basic.localegen }}
27 locale_gen:
28 name: "{{ locale_basic.localegen }}"
29 state: present
30 register: output_present
31
32 - name: Is the locale present? {{ locale_basic.localegen }}
33 command: locale -a
34 register: post_check_output_present
35 ignore_errors: true
36
37 - name: Make sure the locale is present and we say we installed it {{ locale_basic.localegen }}
38 assert:
39 that:
40 - locale_basic.locales | intersect(post_check_output_present.stdout_lines) != []
41 - locale_basic.skip_removal or output_present is changed
42
43 - name: Install the locale a second time {{ locale_basic.localegen }}
44 locale_gen:
45 name: "{{ locale_basic.localegen }}"
46 state: present
47 register: output_present_idempotent
48
49 - name: Is the locale present? {{ locale_basic.localegen }}
50 command: locale -a
51 register: post_check_output_present_idempotent
52 ignore_errors: true
53
54 - name: Make sure the locale is present and we reported no change {{ locale_basic.localegen }}
55 assert:
56 that:
57 - locale_basic.locales | intersect(post_check_output_present_idempotent.stdout_lines) != []
58 - output_present_idempotent is not changed
59
60 - name: Removals
61 when: locale_basic.skip_removal is false
62 block:
63 - name: Remove the locale {{ locale_basic.localegen }}
64 locale_gen:
65 name: "{{ locale_basic.localegen }}"
66 state: absent
67 register: output_absent
68
69 - name: Is the locale present? {{ locale_basic.localegen }}
70 command: locale -a
71 register: post_check_output_absent
72 ignore_errors: true
73
74 - name: Make sure the locale is absent and we reported a change {{ locale_basic.localegen }}
75 assert:
76 that:
77 - locale_basic.locales | intersect(post_check_output_absent.stdout_lines) == []
78 - output_absent is changed
79
80 - name: Remove the locale a second time {{ locale_basic.localegen }}
81 locale_gen:
82 name: "{{ locale_basic.localegen }}"
83 state: absent
84 register: output_absent_idempotent
85
86 - name: Is the locale present? {{ locale_basic.localegen }}
87 command: locale -a
88 register: post_check_output_absent_idempotent
89 ignore_errors: true
90
91 - name: Make sure the locale is absent and we reported no change {{ locale_basic.localegen }}
92 assert:
93 that:
94 - locale_basic.locales | intersect(post_check_output_absent_idempotent.stdout_lines) == []
95 - output_absent_idempotent is not changed
96
97 # Cleanup
98 - name: Reinstall the locale we tested against if it was initially installed {{ locale_basic.localegen }}
99 locale_gen:
100 name: "{{ locale_basic.localegen }}"
101 state: present
102 when: locale_basic.locales | intersect(initial_state.stdout_lines) != []