Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Ansible CD using github action to deploy project on staging vm #1123

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
use synchronize instead of copy
  • Loading branch information
iknowright committed Mar 6, 2023
commit a0f03a1aaab0e63a21390f97a0fc8413e15bfacc
2 changes: 1 addition & 1 deletion .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ jobs:
ansible_host: staging.pycon.tw
ansible_user: changchaishi
ansible_ssh_private_key_file: private.pem
ansible_python_interpreter: /usr/bin/python3
ansible_python_interpreter: /home/dev/.pyenv/shims/python
10 changes: 5 additions & 5 deletions deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,18 @@
state: directory

- name: Copy entire project files to remote server
ansible.builtin.copy:
src: .
ansible.posix.synchronize:
src: ./
dest: "{{ project_dir }}"
delete: true

- name: Ensure docker network network-2023 exists
community.docker.docker_network:
name: network-2023

- name: Build and start service
community.docker.docker_compose:
project_src: web-projects/pycontw-2023-ansible
project_src: "{{ project_dir }}"
build: true
# try to build first, without up the service
state: present

state: absent