2022-08-05 14:03:38 +02:00
|
|
|
---
|
|
|
|
# Copyright (c) Ansible Project
|
|
|
|
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
2020-03-09 10:11:07 +01:00
|
|
|
- name: Is the locale we're going to test against installed?
|
|
|
|
shell: locale -a | grep pt_BR
|
|
|
|
register: initial_state
|
2023-03-06 23:02:24 +01:00
|
|
|
ignore_errors: true
|
2020-03-09 10:11:07 +01:00
|
|
|
|
|
|
|
- name: Make sure the locale is not installed
|
|
|
|
locale_gen:
|
|
|
|
name: pt_BR
|
|
|
|
state: absent
|
|
|
|
|
|
|
|
- name: Is the locale present?
|
|
|
|
shell: locale -a | grep pt_BR
|
|
|
|
register: cleaned
|
2023-03-06 23:02:24 +01:00
|
|
|
ignore_errors: true
|
2020-03-09 10:11:07 +01:00
|
|
|
|
|
|
|
- name: Make sure the locale is not present
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- "cleaned.rc == 1"
|
|
|
|
|
|
|
|
- name: Install the locale
|
|
|
|
locale_gen:
|
|
|
|
name: pt_BR
|
|
|
|
state: present
|
|
|
|
register: output
|
|
|
|
|
|
|
|
- name: Is the locale present?
|
|
|
|
shell: locale -a | grep pt_BR
|
|
|
|
register: post_check_output
|
2023-03-06 23:02:24 +01:00
|
|
|
ignore_errors: true
|
2020-03-09 10:11:07 +01:00
|
|
|
|
|
|
|
- name: Make sure the locale is present and we say we installed it
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- "post_check_output.rc == 0"
|
|
|
|
- "output.changed"
|
|
|
|
|
|
|
|
- name: Install the locale a second time
|
|
|
|
locale_gen:
|
|
|
|
name: pt_BR
|
|
|
|
state: present
|
|
|
|
register: output
|
|
|
|
|
|
|
|
- name: Is the locale present?
|
|
|
|
shell: locale -a | grep pt_BR
|
|
|
|
register: post_check_output
|
2023-03-06 23:02:24 +01:00
|
|
|
ignore_errors: true
|
2020-03-09 10:11:07 +01:00
|
|
|
|
|
|
|
- name: Make sure the locale is present and we reported no change
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- "post_check_output.rc == 0"
|
|
|
|
- "not output.changed"
|
|
|
|
|
|
|
|
- name: Remove the locale
|
|
|
|
locale_gen:
|
|
|
|
name: pt_BR
|
|
|
|
state: absent
|
|
|
|
register: output
|
|
|
|
|
|
|
|
- name: Is the locale present?
|
|
|
|
shell: locale -a | grep pt_BR
|
|
|
|
register: post_check_output
|
2023-03-06 23:02:24 +01:00
|
|
|
ignore_errors: true
|
2020-03-09 10:11:07 +01:00
|
|
|
|
|
|
|
- name: Make sure the locale is absent and we reported a change
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- "post_check_output.rc == 1"
|
|
|
|
- "output.changed"
|
|
|
|
|
|
|
|
- name: Remove the locale a second time
|
|
|
|
locale_gen:
|
|
|
|
name: pt_BR
|
|
|
|
state: absent
|
|
|
|
register: output
|
|
|
|
|
|
|
|
- name: Is the locale present?
|
|
|
|
shell: locale -a | grep pt_BR
|
|
|
|
register: post_check_output
|
2023-03-06 23:02:24 +01:00
|
|
|
ignore_errors: true
|
2020-03-09 10:11:07 +01:00
|
|
|
|
|
|
|
- name: Make sure the locale is absent and we reported no change
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- "post_check_output.rc == 1"
|
|
|
|
- "not output.changed"
|
|
|
|
|
|
|
|
# Cleanup
|
|
|
|
- name: Reinstall the locale we tested against if it was initially installed
|
|
|
|
locale_gen:
|
|
|
|
name: pt_BR
|
|
|
|
state: present
|
|
|
|
when: initial_state.rc == 0
|