feat: Initial roles
This commit is contained in:
46
roles/build-project/tasks/main.yml
Normal file
46
roles/build-project/tasks/main.yml
Normal file
@@ -0,0 +1,46 @@
|
||||
---
|
||||
- name: Starting build project.
|
||||
ansible.builtin.debug:
|
||||
msg: "Build dir: {{ build_dir }}"
|
||||
|
||||
- name: Load project vars.
|
||||
ansible.builtin.include_vars:
|
||||
dir: "{{ project_vars_dir }}"
|
||||
ignore_unknown_extensions: true
|
||||
|
||||
- name: Ensure build directory exists.
|
||||
ansible.builtin.file:
|
||||
path: "{{ build_dir }}"
|
||||
state: directory
|
||||
|
||||
- name: Ensure template repo.
|
||||
ansible.builtin.git:
|
||||
repo: "{{ template_dir.repo.url }}"
|
||||
dest: "{{ template_dir.path }}"
|
||||
version: "{{ template_dir.repo.version | default('main') }}"
|
||||
when: template_dir.repo.url is defined
|
||||
|
||||
- name: Check for repo vars directory.
|
||||
ansible.builtin.stat:
|
||||
path: "{{ template_dir.path }}/{{ template_dir.vars }}"
|
||||
register: repo_vars
|
||||
|
||||
- name: Load repo vars if available.
|
||||
ansible.builtin.include_vars:
|
||||
dir: "{{ template_dir.path }}/{{ template_dir.vars }}"
|
||||
when: repo_vars.stat.isdir is defined
|
||||
|
||||
|
||||
- name: Copy build files.
|
||||
ansible.builtin.copy:
|
||||
src: "{{ item }}"
|
||||
dest: "{{ build_dir }}/{{ item | basename }}"
|
||||
mode: '0600'
|
||||
with_items: "{{ copy_on_build }}"
|
||||
|
||||
- name: Template build files.
|
||||
ansible.builtin.template:
|
||||
src: "{{ item }}"
|
||||
dest: "{{ build_dir }}/{{ item | basename }}"
|
||||
mode: '0600'
|
||||
with_items: "{{ template_on_build }}"
|
||||
Reference in New Issue
Block a user