--- - hosts: teier.eu gather_facts: no tasks: - name: Install psycopg2 shell: pip install psycopg2-binary - name: Create database for Nummus community.postgresql.postgresql_db: login_host: 127.0.0.1 login_user: postgres login_password: "{{ lookup('env', 'POSTGRES_PASSWORD') }}" name: nummus state: present - name: Create database user for Nummus community.postgresql.postgresql_user: login_host: 127.0.0.1 login_user: postgres login_password: "{{ lookup('env', 'POSTGRES_PASSWORD') }}" name: "nummus" db: nummus password: "{{ lookup('env', 'NUMMUS_DB_PASSWORD') }}" priv: 'ALL' state: present - name: Check dc directory stat: path: /dc/nummus register: nummus_dc_dir_stat - name: Create nummus dc directory file: path: /dc/nummus state: directory mode: 0755 group: root owner: root when: nummus_dc_dir_stat.islnk is not defined - name: Copy compose file copy: src: docker-compose.yml dest: /dc/nummus - name: Start nummus shell: "cd /dc/nummus && docker-compose up -d" environment: NUMMUS_DB_PASSWORD: "{{ lookup('env', 'NUMMUS_DB_PASSWORD') }}"