From a647946652f3167462e93739f578d005d5e97d26 Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Sat, 12 Nov 2022 15:30:59 +0100 Subject: [PATCH] add stages --- roles/deploy-web/tasks/deploy.yml | 43 +++++++++++++++++++++++++++++ roles/deploy-web/tasks/main.yml | 46 ++----------------------------- 2 files changed, 46 insertions(+), 43 deletions(-) create mode 100644 roles/deploy-web/tasks/deploy.yml diff --git a/roles/deploy-web/tasks/deploy.yml b/roles/deploy-web/tasks/deploy.yml new file mode 100644 index 0000000..36922af --- /dev/null +++ b/roles/deploy-web/tasks/deploy.yml @@ -0,0 +1,43 @@ +--- +# tasks file for deploy-web + +- name: git archive {{ item }} + local_action: + module: git + repo: "https://{{ git_username | urlencode }}:{{ git_password | urlencode }}@git.valczeryba.ovh/v4l3n71n/{{ item }}.git" + dest: "/home/valentin/src/" + archive: "/tmp/{{ item }}.tar.gz" + force: yes + update: yes + with_items: "{{ project_name }}" + when: "project_name is defined" + + +- name: Create directory {{ item }} + file: + path: "/var/www/{{ item }}" + state: directory + owner: www-data + group: www-data + mode: '500' + with_items: "{{ project_name }}" + when: "project_name is defined" + vars: + ansible_become: yes + ansible_become_method: sudo + ansible_become_password: "{{ sudo_password }}" + + +- name: Extract repo {{ item }} + unarchive: + src: "/tmp/{{ item }}.tar.gz" + dest: "/var/www/{{ item }}" + owner: www-data + group: www-data + mode: '500' + with_items: "{{ project_name }}" + when: "project_name is defined" + vars: + ansible_become: yes + ansible_become_method: sudo + ansible_become_password: "{{ sudo_password }}" diff --git a/roles/deploy-web/tasks/main.yml b/roles/deploy-web/tasks/main.yml index 36922af..d90f8d8 100644 --- a/roles/deploy-web/tasks/main.yml +++ b/roles/deploy-web/tasks/main.yml @@ -1,43 +1,3 @@ ---- -# tasks file for deploy-web - -- name: git archive {{ item }} - local_action: - module: git - repo: "https://{{ git_username | urlencode }}:{{ git_password | urlencode }}@git.valczeryba.ovh/v4l3n71n/{{ item }}.git" - dest: "/home/valentin/src/" - archive: "/tmp/{{ item }}.tar.gz" - force: yes - update: yes - with_items: "{{ project_name }}" - when: "project_name is defined" - - -- name: Create directory {{ item }} - file: - path: "/var/www/{{ item }}" - state: directory - owner: www-data - group: www-data - mode: '500' - with_items: "{{ project_name }}" - when: "project_name is defined" - vars: - ansible_become: yes - ansible_become_method: sudo - ansible_become_password: "{{ sudo_password }}" - - -- name: Extract repo {{ item }} - unarchive: - src: "/tmp/{{ item }}.tar.gz" - dest: "/var/www/{{ item }}" - owner: www-data - group: www-data - mode: '500' - with_items: "{{ project_name }}" - when: "project_name is defined" - vars: - ansible_become: yes - ansible_become_method: sudo - ansible_become_password: "{{ sudo_password }}" +- name: Deploy project_name + import_tasks: deploy.yml + tags: ["deploy"] \ No newline at end of file