diff --git a/defaults/main.yml b/defaults/main.yml index c644d95..1f8e25e 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -10,3 +10,4 @@ backendfolder: backend exec_user: root exec_group: root repo: gitea@pi2:vincent/chainetv_web.git +force_site_update: false diff --git a/tasks/main.yml b/tasks/main.yml index 055016d..fd12518 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -10,17 +10,17 @@ dest: "/tmp/{{name}}" # required. The path of where the repository should be checked out. This parameter is required, unless C(clone) is set to C(no). repo: "{{repo}}" # required. git, SSH, or HTTP(S) protocol address of the git repository. clone: yes # not required. If C(no), do not clone the repository if it does not exist locally - when: location_stat.stat.exists == false + when: location_stat.stat.exists == false or force_site_update == true - name: compile client source shell: "/tmp/{{name}}/deploy_client.sh" - when: location_stat.stat.exists == false + when: location_stat.stat.exists == false or force_site_update == true - name: copy source synchronize: dest: "{{source_location}}" # required. Remote absolute path where the file should be copied to. If I(src) is a directory, this must be a directory too. If I(dest) is a nonexistent path and if either I(dest) ends with "/" or I(src) is a directory, I(dest) is created. If I(src) and I(dest) are files, the parent directory of I(dest) isn't created: the task fails if it doesn't already exist. src: "/tmp/{{name}}/{{backendfolder}}/" # not required. Local path to a file to copy to the remote server; can be absolute or relative. If path is a directory, it is copied recursively. In this case, if path ends with "/", only inside contents of that directory are copied to destination. Otherwise, if it does not end with "/", the directory itself with all contents is copied. This behavior is similar to Rsync. - when: location_stat.stat.exists == false + when: location_stat.stat.exists == false or force_site_update == true delegate_to: "{{ inventory_hostname }}" become: yes @@ -28,7 +28,7 @@ file: path: "/tmp/{{name}}" state: absent - when: location_stat.stat.exists == false + when: location_stat.stat.exists == false or force_site_update == true - name: ensure venv folder exist file: @@ -73,3 +73,4 @@ become: yes notify: - Reload systemd + - restart service \ No newline at end of file