fp/ansible/roles/our/tasks/deploy.yml
CJ_Clippy 807792fcc0
Some checks failed
fp/our CI/CD / build (push) Successful in 2m3s
ci / test (push) Failing after 3m40s
separate db into own compose
2025-10-05 02:33:25 -08:00

75 lines
1.8 KiB
YAML

---
- 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 the db compose file
ansible.builtin.copy:
remote_src: true
src: /tmp/checkout/services/our/compose.db.yaml
dest: /etc/futureporn/our/compose.db.yaml
mode: "0744"
- name: Copy the compose file
ansible.builtin.copy:
remote_src: true
src: /tmp/checkout/services/our/compose.production.yaml
dest: /etc/futureporn/our/compose.production.yaml
mode: "0744"
- 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
- services:
server:
ports:
- target: 5000 # container port
published: 8084 # Swarm ingress port
protocol: tcp
mode: ingress
- name: Deploy stack to blue
community.docker.docker_stack:
state: present
name: our-blue
compose:
- /etc/futureporn/our/compose.production.yaml
- services:
server:
ports:
- target: 5000 # container port
published: 8085 # Swarm ingress port
protocol: tcp
mode: ingress
# - name: Remove stack
# community.docker.docker_stack:
# name: mystack
# state: absent