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