---
- hosts: test-kitchen

  pre_tasks:
  - name: Install locales
    apt:
      name: locales
      state: present
    changed_when: false

  - name: Setting default locales
    lineinfile:
      dest: /etc/locale.gen
      line: "{{ item }}"
      create: yes
      state: present
    changed_when: false
    with_items:
      - "en_US.UTF-8 UTF-8"
      - "fr_FR ISO-8859-1"
      - "fr_FR.UTF-8 UTF-8"
    register: test_locales

  - name: Reconfigure locales
    command: /usr/sbin/locale-gen
    changed_when: false
    when: test_locales.changed

  roles:
    - role: postgresql
