--- # Defines tasks applicable for postgreSQL - name: Install Postgres apt: name: "{{ packages }}" state: present vars: packages: - postgresql-9.6 - python-psycopg2 tags: - dependencies when: ansible_distribution_version == '9' - name: Install Postgres apt: name: "{{ packages }}" state: present vars: packages: - postgresql - python-psycopg2 tags: - dependencies when: ansible_distribution_version == '10' - name: Set password for PostgreSQL admin user become: true become_user: postgres postgresql_user: name={{ db_admin_username }} password={{ db_admin_password }} encrypted=yes