- msg: "Creating and regenerating locales..."
- changed_when: true # Force notification
- notify: Configure locales
+ msg: "Locales have already been configured"
+ when: has_locales.stdout != "0"
+
+- block:
+ - name: Configure locales
+ become: true
+ lineinfile:
+ path: /etc/locale.gen
+ regexp: "^{{ item }}"
+ line: "{{ item }}"
+ loop: [
+ 'en_US ISO-8859-1',
+ 'ru_RU.KOI8-R KOI8-R',
+ 'ru_RU.UTF-8 UTF-8',
+ ]
+ - name: Regenerate locales
+ become: true
+ command: /usr/sbin/locale-gen