--- - 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: rm deprecated docker network # community.docker.docker_network: # name: our-shared-net # scope: local # state: absent - name: Add a docker network community.docker.docker_network: name: our-shared-net scope: swarm state: present - 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') }}" PATREON_API_ORIGIN: "{{ lookup('dotenv', 'PATREON_API_ORIGIN', file='../../../../.env.production') }}" PATREON_AUTHORIZE_PATH: "{{ lookup('dotenv', 'PATREON_AUTHORIZE_PATH', file='../../../../.env.production') }}" PATREON_TOKEN_PATH: "{{ lookup('dotenv', 'PATREON_TOKEN_PATH', file='../../../../.env.production') }}" PATREON_CLIENT_ID: "{{ lookup('dotenv', 'PATREON_CLIENT_ID', file='../../../../.env.production') }}" PATREON_CLIENT_SECRET: "{{ lookup('dotenv', 'PATREON_CLIENT_SECRET', file='../../../../.env.production') }}" COOKIE_SECRET: "{{ lookup('dotenv', 'COOKIE_SECRET', file='../../../../.env.production') }}" S3_REGION: "{{ lookup('dotenv', 'S3_REGION', file='../../../../.env.production') }}" S3_BUCKET: "{{ lookup('dotenv', 'S3_BUCKET', file='../../../../.env.production') }}" S3_APPLICATION_KEY: "{{ lookup('dotenv', 'S3_APPLICATION_KEY', file='../../../../.env.production') }}" S3_KEY_ID: "{{ lookup('dotenv', 'S3_KEY_ID', file='../../../../.env.production') }}" S3_ENDPOINT: "{{ lookup('dotenv', 'S3_ENDPOINT', file='../../../../.env.production') }}" CDN_ORIGIN: "{{ lookup('dotenv', 'CDN_ORIGIN', file='../../../../.env.production') }}" CDN_TOKEN_SECRET: "{{ lookup('dotenv', 'CDN_TOKEN_SECRET', file='../../../../.env.production') }}" WHISPER_DIR: "{{ lookup('dotenv', 'WHISPER_DIR', file='../../../../.env.production') }}" B2_APPLICATION_KEY_ID: "{{ lookup('dotenv', 'B2_APPLICATION_KEY_ID', file='../../../../.env.production') }}" B2_APPLICATION_KEY: "{{ lookup('dotenv', 'B2_APPLICATION_KEY', file='../../../../.env.production') }}" SEEDBOX_SFTP_URL: "{{ lookup('dotenv', 'SEEDBOX_SFTP_URL', file='../../../../.env.production') }}" SEEDBOX_SFTP_USERNAME: "{{ lookup('dotenv', 'SEEDBOX_SFTP_USERNAME', file='../../../../.env.production') }}" SEEDBOX_SFTP_PASSWORD: "{{ lookup('dotenv', 'SEEDBOX_SFTP_PASSWORD', 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