151 lines
3.9 KiB
YAML
151 lines
3.9 KiB
YAML
# tasks file for deploy-web
|
|
|
|
- name: "all git archive"
|
|
local_action:
|
|
module: git
|
|
repo: "https://{{ git_username | urlencode }}:{{ git_password | urlencode }}@git.valczeryba.ovh/v4l3n71n/{{ item.git_name }}.git"
|
|
dest: "/home/valentin/src/"
|
|
archive: "/tmp/{{ item.git_name }}.tar.gz"
|
|
force: yes
|
|
update: yes
|
|
when: "item.git_name is defined and project_name is not defined and conf_name is not defined"
|
|
with_items:
|
|
- "{{ project }}"
|
|
|
|
|
|
- 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 and project_name is not defined and conf_name is not defined"
|
|
with_items:
|
|
- "{{ project }}"
|
|
vars:
|
|
ansible_become: yes
|
|
ansible_become_method: sudo
|
|
ansible_become_password: "{{ sudo_password }}"
|
|
|
|
|
|
- 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 and project_name is not defined and conf_name is not defined"
|
|
with_items:
|
|
- "{{ project }}"
|
|
vars:
|
|
ansible_become: yes
|
|
ansible_become_method: sudo
|
|
ansible_become_password: "{{ sudo_password }}"
|
|
|
|
|
|
- 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: "copy nginx.conf"
|
|
copy:
|
|
src: "nginx.conf"
|
|
dest: "/etc/nginx/"
|
|
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 and project_name is not defined and conf_name is not defined"
|
|
with_items:
|
|
- "{{ project }}"
|
|
vars:
|
|
ansible_become: yes
|
|
ansible_become_method: sudo
|
|
ansible_become_password: "{{ sudo_password }}"
|
|
|
|
|
|
- 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 and project_name is not defined and conf_name is not defined"
|
|
with_items:
|
|
- "{{ project }}"
|
|
vars:
|
|
ansible_become: yes
|
|
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
|
|
state: restarted
|
|
vars:
|
|
ansible_become: yes
|
|
ansible_become_method: sudo
|
|
ansible_become_password: "{{ sudo_password }}" |