Skip to content

Commit

Permalink
locales: check that the /etc/locale.conf exists
Browse files Browse the repository at this point in the history
  • Loading branch information
vitabaks committed Jun 16, 2021
1 parent 5837ae4 commit 2575ed1
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion roles/locales/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@
label: "{{ item.line }}"
when: ansible_os_family == "Debian"

- name: Check that the /etc/locale.conf exists
stat:
path: /etc/locale.conf
register: locale_conf
when: ansible_os_family == "RedHat"

- name: Set locale "{{ locale }}" into /etc/locale.conf
lineinfile:
dest: "/etc/locale.conf"
Expand All @@ -69,7 +75,7 @@
- {regexp: '^LC_ALL=', line: 'LC_ALL={{ locale }}'}
loop_control:
label: "{{ item.line }}"
when: ansible_os_family == "RedHat"
when: ansible_os_family == "RedHat" and locale_conf.stat.exists

- name: Set locale "{{ locale }}" into /etc/environment
lineinfile:
Expand Down

0 comments on commit 2575ed1

Please sign in to comment.