feat: Adds setup project to the justfile
This commit is contained in:
17
justfile
17
justfile
@@ -6,12 +6,13 @@ default:
|
||||
[group('plays')]
|
||||
run *ARGS:
|
||||
@ansible-playbook ./main.yml \
|
||||
--inventory ./inventory.ini \
|
||||
{{ARGS}}
|
||||
|
||||
# Run the repo-template option in the `dir` with the passed in arguements.
|
||||
[group('plays')]
|
||||
create-repo-template dir *ARGS:
|
||||
@just run-playbook \
|
||||
@just run \
|
||||
--tags repo-template \
|
||||
--extra-vars output_dir={{dir}} \
|
||||
{{ARGS}}
|
||||
@@ -19,11 +20,17 @@ create-repo-template dir *ARGS:
|
||||
# Run the build-project option in the `dir` with the passed in arguements.
|
||||
[group('plays')]
|
||||
build-project dir *ARGS:
|
||||
@just run-playbook \
|
||||
@just run \
|
||||
--tags build-project \
|
||||
--extra-vars project_dir={{dir}} \
|
||||
{{ARGS}}
|
||||
|
||||
[group('test')]
|
||||
test *ARGS:
|
||||
@ansible-playbook ./test/test.yml {{ARGS}}
|
||||
# Setup a new consult project from a template repo.
|
||||
[group('plays')]
|
||||
setup-project repo-url version project-dir *ARGS:
|
||||
@ansible-playbook ./main.yml \
|
||||
--inventory ./inventory.ini \
|
||||
--tags setup-project \
|
||||
--extra-vars "{'template': {'repo': {'url': '{{repo-url}}', 'version': '{{version}}' }}}" \
|
||||
--extra-vars "project_dir={{project-dir}}" \
|
||||
{{ARGS}}
|
||||
|
||||
1
main.yml
1
main.yml
@@ -12,5 +12,4 @@
|
||||
- never # makes it so a tag must be supplied to run.
|
||||
- role: setup-project
|
||||
tags:
|
||||
- setup-project
|
||||
- never # makes it so a tag must be supplied to run.
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
- name: Starting setup project.
|
||||
ansible.builtin.debug:
|
||||
msg: "Project dir: {{ project_dir }}"
|
||||
tags:
|
||||
- always
|
||||
|
||||
- name: Debug template vars pre parse.
|
||||
ansible.builtin.debug:
|
||||
@@ -20,6 +22,10 @@
|
||||
- name: Parse template facts.
|
||||
ansible.builtin.include_role:
|
||||
name: "prepare-template-facts"
|
||||
tags:
|
||||
- setup-project
|
||||
- never
|
||||
|
||||
|
||||
- name: Debug template path post parse.
|
||||
ansible.builtin.debug:
|
||||
@@ -32,10 +38,16 @@
|
||||
ansible.builtin.file:
|
||||
path: "{{ project_dir }}"
|
||||
state: directory
|
||||
tags:
|
||||
- setup-project
|
||||
- never
|
||||
|
||||
- name: Load template vars.
|
||||
ansible.builtin.include_role:
|
||||
name: "load-template-vars"
|
||||
tags:
|
||||
- setup-project
|
||||
- never
|
||||
|
||||
- name: Debug on_setup.
|
||||
ansible.builtin.debug:
|
||||
@@ -55,6 +67,9 @@
|
||||
ansible.builtin.stat:
|
||||
path: "{{ project_dir }}/.setup"
|
||||
register: setup_file
|
||||
tags:
|
||||
- setup-project
|
||||
- never
|
||||
|
||||
- name: Debug setup file stat.
|
||||
ansible.builtin.debug:
|
||||
@@ -70,6 +85,9 @@
|
||||
with_items: "{{ copy_directory_on_setup }}"
|
||||
when: setup_file.stat.exists is false
|
||||
register: copy_directory_stat
|
||||
tags:
|
||||
- setup-project
|
||||
- never
|
||||
|
||||
- name: Debug copy directory stat.
|
||||
ansible.builtin.debug:
|
||||
@@ -86,6 +104,9 @@
|
||||
destination: "{{ project_dir }}/{{ item.dest | default(item) }}"
|
||||
mode: "{{ item.mode | default('0600') }}"
|
||||
loop: "{{ copy_on_setup }}"
|
||||
tags:
|
||||
- setup-project
|
||||
- never
|
||||
|
||||
- name: Create setup file.
|
||||
ansible.builtin.template:
|
||||
@@ -93,3 +114,6 @@
|
||||
dest: "{{ project_dir }}/.setup"
|
||||
mode: '0600'
|
||||
when: not setup_file.stat.exists
|
||||
tags:
|
||||
- setup-project
|
||||
- never
|
||||
|
||||
2
test/justfile
Normal file
2
test/justfile
Normal file
@@ -0,0 +1,2 @@
|
||||
test *ARGS:
|
||||
@ansible-playbook ./test.yml {{ARGS}}
|
||||
Reference in New Issue
Block a user