2024-10-22 22:48:53 +00:00
|
|
|
- name: cbax dev deploy
|
2024-10-23 20:11:00 +00:00
|
|
|
hosts:
|
2024-10-24 04:10:35 +00:00
|
|
|
'{{ lookup("env", "ANSIBLE_HOST") }}':
|
2024-10-23 20:11:00 +00:00
|
|
|
ansible_user: '{{ lookup("env", "ANSIBLE_USER") }}'
|
|
|
|
ansible_password: '{{ lookup("env", "ANSIBLE_PASSWORD") }}'
|
2024-10-22 22:48:53 +00:00
|
|
|
tasks:
|
|
|
|
- name: Copy files
|
|
|
|
ansible.posix.synchronize:
|
|
|
|
src: "{{playbook_dir}}/"
|
|
|
|
dest: "/root/cbax_dev"
|
|
|
|
|
2024-10-24 16:57:11 +00:00
|
|
|
- name: Copy static files to application folder in /srv/http
|
2024-10-22 22:48:53 +00:00
|
|
|
ansible.builtin.copy:
|
2024-10-24 16:57:11 +00:00
|
|
|
backup: true
|
2024-10-22 22:48:53 +00:00
|
|
|
remote_src: true
|
2024-10-24 16:57:11 +00:00
|
|
|
src: /root/cbax_dev/static
|
|
|
|
dest: /srv/http/cbax_dev/static
|
|
|
|
|
|
|
|
- name: Copy posts to application folder in /srv/http
|
|
|
|
ansible.builtin.copy:
|
|
|
|
backup: true
|
|
|
|
remote_src: true
|
|
|
|
src: /root/cbax_dev/posts
|
|
|
|
dest: /srv/http/cbax_dev/posts
|
2024-10-22 22:48:53 +00:00
|
|
|
|
|
|
|
- name: Tear down existing service
|
|
|
|
ansible.builtin.command: "docker compose down --rmi all"
|
|
|
|
args:
|
|
|
|
chdir: "$HOME/cbax_dev"
|
|
|
|
|
|
|
|
- name: Create the new container
|
|
|
|
ansible.builtin.command: "docker compose up -d"
|
|
|
|
args:
|
|
|
|
chdir: "$HOME/cbax_dev"
|