cbax_dev/deploy.playbook.yml

34 lines
1 KiB
YAML

- name: cbax dev deploy
hosts:
'{{ lookup("env", "ANSIBLE_HOST") }}':
ansible_user: '{{ lookup("env", "ANSIBLE_USER") }}'
ansible_password: '{{ lookup("env", "ANSIBLE_PASSWORD") }}'
tasks:
- name: Copy files
ansible.posix.synchronize:
src: "{{playbook_dir}}/"
dest: "/root/cbax_dev"
- name: Copy static files to application folder in /srv/http
ansible.builtin.copy:
backup: true
remote_src: true
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
- 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"