Files
ansible-hpa-playbook/roles/setup-project/tasks/main.yml

43 lines
1.1 KiB
YAML

---
- name: Starting setup project.
ansible.builtin.debug:
msg: "Output dir: {{ output_dir }}"
- name: Ensure output directory exists.
ansible.builtin.file:
path: "{{ output_dir }}"
state: directory
- name: Ensure repo.
ansible.builtin.git:
repo: "{{ template.repo.url }}"
dest: "{{ template.path }}"
version: "{{ template.repo.version | default('main') }}"
when: template.repo.url is defined
- name: Check for repo vars directory.
ansible.builtin.stat:
path: "{{ template.path }}/{{ template_dir.vars }}"
register: repo_vars
- name: Load repo vars if available.
ansible.builtin.include_vars:
dir: "{{ template.path }}/{{ template_dir.vars }}"
when: repo_vars.stat.isdir is defined
- name: Debug on_setup.
ansible.builtin.debug:
msg: "On setup vars: {{ copy_on_setup }}"
tags:
- debug
- never
- name: Copy project files.
ansible.builtin.include_tasks:
file: "copy_if_not_exists.yml"
vars:
source: "{{ template.path }}/{{ item.src | default(item) }}"
destination: "{{ output_dir }}/{{ item.dest | default(item) }}"
mode: "{{ item.mode | default('0600') }}"
loop: "{{ copy_on_setup }}"