add deploy single project
This commit is contained in:
parent
19ecb0bca1
commit
ae0655da7c
@ -1,6 +1,6 @@
|
||||
# tasks file for deploy-web
|
||||
|
||||
- name: "git archive {{ item }}"
|
||||
- name: "all git archive"
|
||||
local_action:
|
||||
module: git
|
||||
repo: "https://{{ git_username | urlencode }}:{{ git_password | urlencode }}@git.valczeryba.ovh/v4l3n71n/{{ item.git_name }}.git"
|
||||
@ -8,19 +8,19 @@
|
||||
archive: "/tmp/{{ item.git_name }}.tar.gz"
|
||||
force: yes
|
||||
update: yes
|
||||
when: "item.git_name is defined"
|
||||
when: "item.git_name is defined and project_name is not defined and conf_name is not defined"
|
||||
with_items:
|
||||
- "{{ project }}"
|
||||
|
||||
|
||||
- name: "Create directory "
|
||||
- name: "all create directory "
|
||||
file:
|
||||
path: "/var/www/{{ item.git_name }}"
|
||||
state: directory
|
||||
owner: www-data
|
||||
group: www-data
|
||||
mode: '500'
|
||||
when: "item.git_name is defined"
|
||||
when: "item.git_name is defined and project_name is not defined and conf_name is not defined"
|
||||
with_items:
|
||||
- "{{ project }}"
|
||||
vars:
|
||||
@ -29,14 +29,14 @@
|
||||
ansible_become_password: "{{ sudo_password }}"
|
||||
|
||||
|
||||
- name: "Extract repo "
|
||||
- name: "all extract repo "
|
||||
unarchive:
|
||||
src: "/tmp/{{ item.git_name }}.tar.gz"
|
||||
dest: "/var/www/{{ item.git_name }}"
|
||||
owner: www-data
|
||||
group: www-data
|
||||
mode: '500'
|
||||
when: "item.git_name is defined"
|
||||
when: "item.git_name is defined and project_name is not defined and conf_name is not defined"
|
||||
with_items:
|
||||
- "{{ project }}"
|
||||
vars:
|
||||
@ -44,11 +44,50 @@
|
||||
ansible_become_method: sudo
|
||||
ansible_become_password: "{{ sudo_password }}"
|
||||
|
||||
- name: "Copy configure nginx"
|
||||
|
||||
- name: "single git archive"
|
||||
local_action:
|
||||
module: git
|
||||
repo: "https://{{ git_username | urlencode }}:{{ git_password | urlencode }}@git.valczeryba.ovh/v4l3n71n/{{ project_name }}.git"
|
||||
dest: "/home/valentin/src/"
|
||||
archive: "/tmp/{{ project_name }}.tar.gz"
|
||||
force: yes
|
||||
update: yes
|
||||
when: "project_name is defined"
|
||||
|
||||
|
||||
- name: "single create directory "
|
||||
file:
|
||||
path: "/var/www/{{ project_name }}"
|
||||
state: directory
|
||||
owner: www-data
|
||||
group: www-data
|
||||
mode: '500'
|
||||
when: "project_name is defined"
|
||||
vars:
|
||||
ansible_become: yes
|
||||
ansible_become_method: sudo
|
||||
ansible_become_password: "{{ sudo_password }}"
|
||||
|
||||
|
||||
- name: "single extract repo "
|
||||
unarchive:
|
||||
src: "/tmp/{{ project_name }}.tar.gz"
|
||||
dest: "/var/www/{{ project_name }}"
|
||||
owner: www-data
|
||||
group: www-data
|
||||
mode: '500'
|
||||
when: "project_name is defined"
|
||||
vars:
|
||||
ansible_become: yes
|
||||
ansible_become_method: sudo
|
||||
ansible_become_password: "{{ sudo_password }}"
|
||||
|
||||
- name: "all copy configure nginx"
|
||||
copy:
|
||||
src: "{{ item.conf_name }}"
|
||||
dest: "/etc/nginx/sites-available"
|
||||
when: "item.conf_name is defined"
|
||||
when: "item.conf_name is defined and project_name is not defined and conf_name is not defined"
|
||||
with_items:
|
||||
- "{{ project }}"
|
||||
vars:
|
||||
@ -57,12 +96,12 @@
|
||||
ansible_become_password: "{{ sudo_password }}"
|
||||
|
||||
|
||||
- name: "Create symlink"
|
||||
- name: "all create symlink"
|
||||
file:
|
||||
src: "/etc/nginx/sites-available/{{ item.conf_name }}"
|
||||
dest: "/etc/nginx/sites-enabled/{{ item.conf_name }}"
|
||||
state: link
|
||||
when: "item.conf_name is defined"
|
||||
when: "item.conf_name is defined and project_name is not defined and conf_name is not defined"
|
||||
with_items:
|
||||
- "{{ project }}"
|
||||
vars:
|
||||
@ -70,6 +109,29 @@
|
||||
ansible_become_method: sudo
|
||||
ansible_become_password: "{{ sudo_password }}"
|
||||
|
||||
|
||||
- name: "single copy configure nginx"
|
||||
copy:
|
||||
src: "{{ conf_name }}"
|
||||
dest: "/etc/nginx/sites-available"
|
||||
when: "conf_name is defined"
|
||||
vars:
|
||||
ansible_become: yes
|
||||
ansible_become_method: sudo
|
||||
ansible_become_password: "{{ sudo_password }}"
|
||||
|
||||
|
||||
- name: "single create symlink"
|
||||
file:
|
||||
src: "/etc/nginx/sites-available/{{ conf_name }}"
|
||||
dest: "/etc/nginx/sites-enabled/{{ conf_name }}"
|
||||
state: link
|
||||
when: "conf_name is defined"
|
||||
vars:
|
||||
ansible_become: yes
|
||||
ansible_become_method: sudo
|
||||
ansible_become_password: "{{ sudo_password }}"
|
||||
|
||||
- name: restart nginx
|
||||
service:
|
||||
name: nginx
|
||||
|
@ -2,7 +2,7 @@
|
||||
file:
|
||||
path: "/var/www/{{ item.git_name }}"
|
||||
state: absent
|
||||
when: "item.git_name is defined and project_name is not defined"
|
||||
when: "item.git_name is defined and project_name is not defined and conf_name is not defined"
|
||||
with_items:
|
||||
- "{{ project }}"
|
||||
vars:
|
||||
@ -20,11 +20,11 @@
|
||||
ansible_become_method: sudo
|
||||
ansible_become_password: "{{ sudo_password }}"
|
||||
|
||||
- name: "Delete symlink"
|
||||
- name: "Delete all symlink"
|
||||
file:
|
||||
path: "/etc/nginx/sites-enabled/{{ item.conf_name }}"
|
||||
state: absent
|
||||
when: "item.conf_name is defined"
|
||||
when: "item.conf_name is defined and project_name is not defined and conf_name is not defined"
|
||||
with_items:
|
||||
- "{{ project }}"
|
||||
vars:
|
||||
@ -32,11 +32,11 @@
|
||||
ansible_become_method: sudo
|
||||
ansible_become_password: "{{ sudo_password }}"
|
||||
|
||||
- name: "remove configure nginx"
|
||||
- name: "remove all configure nginx"
|
||||
file:
|
||||
path: "/etc/nginx/sites-available/{{ item.conf_name }}"
|
||||
state: absent
|
||||
when: "item.conf_name is defined"
|
||||
when: "item.conf_name is defined and project_name is not defined and conf_name is not defined"
|
||||
with_items:
|
||||
- "{{ project }}"
|
||||
vars:
|
||||
@ -46,6 +46,26 @@
|
||||
|
||||
|
||||
|
||||
- name: "Delete single symlink"
|
||||
file:
|
||||
path: "/etc/nginx/sites-enabled/{{ conf_name }}"
|
||||
state: absent
|
||||
when: "conf_name is defined"
|
||||
vars:
|
||||
ansible_become: yes
|
||||
ansible_become_method: sudo
|
||||
ansible_become_password: "{{ sudo_password }}"
|
||||
|
||||
- name: "remove single configure nginx"
|
||||
file:
|
||||
path: "/etc/nginx/sites-available/{{ conf_name }}"
|
||||
state: absent
|
||||
when: "conf_name is defined"
|
||||
vars:
|
||||
ansible_become: yes
|
||||
ansible_become_method: sudo
|
||||
ansible_become_password: "{{ sudo_password }}"
|
||||
|
||||
|
||||
- name: restart nginx
|
||||
service:
|
||||
|
Loading…
x
Reference in New Issue
Block a user