- name: Install PostgreSQL and PostGIS apt: pkg={{ packages }} vars: packages: - postgresql - postgresql-postgis - postgis # for ansible - python3-psycopg - name: Generate sv_SE.UTF-8 locales locale_gen: name=sv_SE.UTF-8 state=present # PostgreSQL needs to be restarted to see the new locale notify: Restart PostgreSQL - name: Configure PostgreSQL copy: src=etc/postgresql/postgresql.conf dest=/etc/postgresql/{{ postgresql.version }}/{{ postgresql.cluster }}/conf.d/local.conf owner=postgres group=postgres mode=0644 notify: Restart PostgreSQL - name: Start PostgreSQL service: name=postgresql@{{ postgresql.version }}-{{ postgresql.cluster }}.service state=started - meta: flush_handlers # Usage: \sudo -u postgres psql