fp/ansible/roles/our/tasks/deploy.yml
CJ_Clippy 91b26b4120
Some checks failed
ci / test (push) Failing after 7m55s
fp/our CI/CD / build (push) Successful in 1m46s
create blue/green compose files
2025-10-05 08:19:50 -08:00

61 lines
1.4 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 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
- 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