--- - name: Create directory ansible.builtin.file: path: /etc/futureporn/our state: directory mode: "0755" # - name: Copy env file # ansible.builtin.copy: # src: ../../../../.env.production # dest: /etc/futureporn/our/.env # mode: "0600" - name: Clone the latest code ansible.builtin.git: repo: https://gitea.futureporn.net/futureporn/fp dest: /tmp/checkout single_branch: true version: main clone: true force: true - name: Copy compose files ansible.builtin.copy: remote_src: true src: "/tmp/checkout/services/our/{{ item }}" dest: "/etc/futureporn/our/{{ item }}" mode: "0744" loop: - compose.db.yaml - compose.production.yaml - compose.green.yaml - compose.blue.yaml - name: Deploy db stack community.docker.docker_stack: state: present name: our-postgres compose: - /etc/futureporn/our/compose.db.yaml - name: Deploy stack to green community.docker.docker_stack: state: present name: our-green compose: - /etc/futureporn/our/compose.production.yaml - /etc/futureporn/our/compose.green.yaml - services: worker: environment: DATABASE_URL: "{{ lookup('dotenv', 'DATABASE_URL', file='../../../../.env.production') }}" NODE_ENV: "{{ lookup('dotenv', 'NODE_ENV', file='../../../../.env.production') }}" ORIGIN: "{{ lookup('dotenv', 'ORIGIN', file='../../../../.env.production') }}" server: environment: DATABASE_URL: "{{ lookup('dotenv', 'DATABASE_URL', file='../../../../.env.production') }}" - name: Deploy stack to blue community.docker.docker_stack: state: present name: our-blue compose: - /etc/futureporn/our/compose.production.yaml - /etc/futureporn/our/compose.blue.yaml # - name: Remove stack # community.docker.docker_stack: # name: mystack # state: absent