change variable

This commit is contained in:
2022-12-19 23:46:55 +01:00
parent 1996945eb4
commit 1e3e08b555
3 changed files with 31 additions and 29 deletions

View File

@@ -3,42 +3,43 @@
- name: "git archive {{ item }}"
local_action:
module: git
repo: "https://{{ git_username | urlencode }}:{{ git_password | urlencode }}@git.valczeryba.ovh/v4l3n71n/{{ item }}.git"
repo: "https://{{ git_username | urlencode }}:{{ git_password | urlencode }}@git.valczeryba.ovh/v4l3n71n/{{ item.name }}.git"
dest: "/home/valentin/src/"
archive: "/tmp/{{ item }}.tar.gz"
archive: "/tmp/{{ item.name }}.tar.gz"
force: yes
update: yes
when: "item.name is defined"
with_items:
- "{{ project_name }}"
when: "project_name is defined"
- "{{ project }}"
- name: "Create directory {{ item }}"
- name: "Create directory "
file:
path: "/var/www/{{ item }}"
path: "/var/www/{{ item.name }}"
state: directory
owner: www-data
group: www-data
mode: '500'
when: "item.name is defined"
with_items:
- "{{ project_name }}"
when: "project_name is defined"
- "{{ project }}"
vars:
ansible_become: yes
ansible_become_method: sudo
ansible_become_password: "{{ sudo_password }}"
- name: "Extract repo {{ item }}"
- name: "Extract repo "
unarchive:
src: "/tmp/{{ item }}.tar.gz"
dest: "/var/www/{{ item }}"
src: "/tmp/{{ item.name }}.tar.gz"
dest: "/var/www/{{ item.name }}"
owner: www-data
group: www-data
mode: '500'
when: "item.name is defined"
with_items:
- "{{ project_name }}"
when: "project_name is defined"
- "{{ project }}"
vars:
ansible_become: yes
ansible_become_method: sudo

View File

@@ -1,10 +1,10 @@
- name: "Remove all directories"
file:
path: "/var/www/{{ item }}"
path: "/var/www/{{ item.name }}"
state: absent
when: "item.name is defined and project_name is not defined"
with_items:
- "{{ project_name }}"
when: "project_name is defined and project is not defined"
- "{{ project }}"
vars:
ansible_become: yes
ansible_become_method: sudo
@@ -12,9 +12,9 @@
- name: "Remove single directory"
file:
path: "/var/www/{{ project }}"
path: "/var/www/{{ project_name }}"
state: absent
when: "project is defined"
when: "project_name is defined"
vars:
ansible_become: yes
ansible_become_method: sudo