From 4ad7f047e53e31078cb8f36b9ecf1e5988e186e9 Mon Sep 17 00:00:00 2001 From: iknowright Date: Tue, 28 Feb 2023 15:21:11 +0800 Subject: [PATCH] use synchronize instead of copy --- .github/workflows/cd.yml | 2 +- deploy.yml | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 518c046c2..de0bf5585 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -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 diff --git a/deploy.yml b/deploy.yml index 1ff2ffac4..1401fa704 100644 --- a/deploy.yml +++ b/deploy.yml @@ -20,9 +20,10 @@ 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: @@ -30,8 +31,7 @@ - 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