Skip to content

Commit 2575ed1

Browse files
committed
locales: check that the /etc/locale.conf exists
1 parent 5837ae4 commit 2575ed1

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

roles/locales/tasks/main.yml

+7-1
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,12 @@
5656
label: "{{ item.line }}"
5757
when: ansible_os_family == "Debian"
5858

59+
- name: Check that the /etc/locale.conf exists
60+
stat:
61+
path: /etc/locale.conf
62+
register: locale_conf
63+
when: ansible_os_family == "RedHat"
64+
5965
- name: Set locale "{{ locale }}" into /etc/locale.conf
6066
lineinfile:
6167
dest: "/etc/locale.conf"
@@ -69,7 +75,7 @@
6975
- {regexp: '^LC_ALL=', line: 'LC_ALL={{ locale }}'}
7076
loop_control:
7177
label: "{{ item.line }}"
72-
when: ansible_os_family == "RedHat"
78+
when: ansible_os_family == "RedHat" and locale_conf.stat.exists
7379

7480
- name: Set locale "{{ locale }}" into /etc/environment
7581
lineinfile:

0 commit comments

Comments
 (0)