X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=playbooks%2Fdebian%2Froles%2Finit-system%2Ftasks%2Flocales.yml;h=8351b6005fa04be46b8626bc50d75bd63a9823e1;hb=22bc79da34fa1c31800f522577d85141ca139140;hp=77adf741bae3f7072ee242a9aeec8f73ed402e48;hpb=6d84a106654ec6be99621cf6698d19973c328d79;p=ansible.git diff --git a/playbooks/debian/roles/init-system/tasks/locales.yml b/playbooks/debian/roles/init-system/tasks/locales.yml index 77adf74..8351b60 100644 --- a/playbooks/debian/roles/init-system/tasks/locales.yml +++ b/playbooks/debian/roles/init-system/tasks/locales.yml @@ -1,13 +1,25 @@ - name: Check locales shell: "grep -c '^ru_RU.KOI8-R' /etc/locale.gen || :" register: has_locales + changed_when: has_locales.stdout == "0" - debug: - msg: "Creating and regenerating locales..." - changed_when: true # Force notification - notify: Configure locales - when: has_locales.stdout == "0" - -- debug: - msg: "Locales has already been created" + 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 + when: has_locales.stdout == "0"