2022-11-12 15:30:59 +01:00
|
|
|
# tasks file for deploy-web
|
|
|
|
|
2022-11-12 20:45:00 +01:00
|
|
|
- name: "git archive {{ item }}"
|
2022-11-12 15:30:59 +01:00
|
|
|
local_action:
|
|
|
|
module: git
|
2022-12-19 23:50:57 +01:00
|
|
|
repo: "https://{{ git_username | urlencode }}:{{ git_password | urlencode }}@git.valczeryba.ovh/v4l3n71n/{{ item.git_name }}.git"
|
2022-11-12 15:30:59 +01:00
|
|
|
dest: "/home/valentin/src/"
|
2022-12-20 00:04:33 +01:00
|
|
|
archive: "/tmp/{{ item.git_name }}.tar.gz"
|
2022-11-12 15:30:59 +01:00
|
|
|
force: yes
|
|
|
|
update: yes
|
2022-12-19 23:50:57 +01:00
|
|
|
when: "item.git_name is defined"
|
2022-11-12 20:45:00 +01:00
|
|
|
with_items:
|
2022-12-19 23:46:55 +01:00
|
|
|
- "{{ project }}"
|
|
|
|
|
2022-11-12 15:30:59 +01:00
|
|
|
|
2022-12-19 23:46:55 +01:00
|
|
|
- name: "Create directory "
|
2022-11-12 15:30:59 +01:00
|
|
|
file:
|
2022-12-19 23:50:57 +01:00
|
|
|
path: "/var/www/{{ item.git_name }}"
|
2022-11-12 15:30:59 +01:00
|
|
|
state: directory
|
|
|
|
owner: www-data
|
|
|
|
group: www-data
|
|
|
|
mode: '500'
|
2022-12-19 23:50:57 +01:00
|
|
|
when: "item.git_name is defined"
|
2022-11-12 20:45:00 +01:00
|
|
|
with_items:
|
2022-12-19 23:46:55 +01:00
|
|
|
- "{{ project }}"
|
2022-11-12 15:30:59 +01:00
|
|
|
vars:
|
|
|
|
ansible_become: yes
|
|
|
|
ansible_become_method: sudo
|
|
|
|
ansible_become_password: "{{ sudo_password }}"
|
|
|
|
|
|
|
|
|
2022-12-19 23:46:55 +01:00
|
|
|
- name: "Extract repo "
|
2022-11-12 15:30:59 +01:00
|
|
|
unarchive:
|
2022-12-19 23:50:57 +01:00
|
|
|
src: "/tmp/{{ item.git_name }}.tar.gz"
|
|
|
|
dest: "/var/www/{{ item.git_name }}"
|
2022-11-12 15:30:59 +01:00
|
|
|
owner: www-data
|
|
|
|
group: www-data
|
|
|
|
mode: '500'
|
2022-12-19 23:50:57 +01:00
|
|
|
when: "item.git_name is defined"
|
2022-11-12 20:45:00 +01:00
|
|
|
with_items:
|
2022-12-19 23:46:55 +01:00
|
|
|
- "{{ project }}"
|
2022-11-12 15:30:59 +01:00
|
|
|
vars:
|
|
|
|
ansible_become: yes
|
|
|
|
ansible_become_method: sudo
|
|
|
|
ansible_become_password: "{{ sudo_password }}"
|
2022-12-20 00:04:33 +01:00
|
|
|
|
|
|
|
- name: "Copy configure nginx"
|
|
|
|
copy:
|
|
|
|
src: "{{ item.conf_name }}"
|
|
|
|
dest: "/etc/nginx/sites-available"
|
|
|
|
when: "item.conf_name is defined"
|
|
|
|
with_items:
|
|
|
|
- "{{ project }}"
|
|
|
|
vars:
|
|
|
|
ansible_become: yes
|
|
|
|
ansible_become_method: sudo
|
|
|
|
ansible_become_password: "{{ sudo_password }}"
|
|
|
|
|
|
|
|
|
|
|
|
- name: "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"
|
|
|
|
with_items:
|
|
|
|
- "{{ project }}"
|
|
|
|
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 }}"
|