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