refactor(environment): split main.yml into focused sub-task files
This commit is contained in:
27
roles/environment/tasks/_thirdparty.yml
Normal file
27
roles/environment/tasks/_thirdparty.yml
Normal file
@@ -0,0 +1,27 @@
|
||||
---
|
||||
- name: Check for third-party preparation tasks
|
||||
run_once: true
|
||||
become: false
|
||||
delegate_to: localhost
|
||||
vars:
|
||||
ansible_connection: local
|
||||
block:
|
||||
- name: Resolve third-party preparation task path
|
||||
ansible.builtin.set_fact:
|
||||
environment_thirdparty_tasks_path: >-
|
||||
{{
|
||||
thirdparty_tasks
|
||||
if thirdparty_tasks | regex_search('^/')
|
||||
else playbook_dir + '/' + thirdparty_tasks
|
||||
}}
|
||||
|
||||
- name: Stat third-party preparation tasks
|
||||
ansible.builtin.stat:
|
||||
path: "{{ environment_thirdparty_tasks_path }}"
|
||||
register: environment_thirdparty_tasks_stat
|
||||
|
||||
- name: Run third-party preparation tasks
|
||||
when:
|
||||
- thirdparty_tasks | length > 0
|
||||
- environment_thirdparty_tasks_stat.stat.exists
|
||||
ansible.builtin.include_tasks: "{{ environment_thirdparty_tasks_path }}"
|
||||
Reference in New Issue
Block a user