-
Notifications
You must be signed in to change notification settings - Fork 498
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add role host_workloads for minimal config
- Loading branch information
Showing
14 changed files
with
293 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- | ||
- name: Step 001.1 Destroy Infrastructure | ||
hosts: localhost | ||
connection: local | ||
gather_facts: false | ||
become: false | ||
tags: | ||
- step001 | ||
- step001.1 | ||
- deploy_infrastructure | ||
|
||
tasks: | ||
|
||
- name: Destroy multi cloud_provider debug task | ||
ansible.builtin.debug: | ||
msg: Destroy multi cloud_provider debug task |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,27 @@ | ||
--- | ||
|
||
- name: Import destroy workloads | ||
ansible.builtin.import_playbook: workloads.yml | ||
ansible.builtin.import_playbook: >- | ||
{{ 'workloads.yml' if destroy_workloads is mapping else 'noop.yml' }} | ||
when: destroy_workloads is defined | ||
vars: | ||
_workload_title_: "Pre Infra" | ||
_workloads_: "{{ destroy_workloads | default([]) }}" | ||
_workloads_: "{{ destroy_workloads }}" | ||
|
||
- name: Run host_workloads for destroy | ||
hosts: all:localhost | ||
gather_facts: false | ||
tasks: | ||
- name: Include host_workloads for destroy | ||
when: | ||
- destroy_workloads is iterable | ||
- destroy_workloads is not mapping | ||
- destroy_workloads is not string | ||
vars: | ||
agnosticd_stage: destroy | ||
host_workloads: "{{ destroy_workloads }}" | ||
include_role: | ||
name: host_workloads | ||
|
||
- name: Import default cloud_provider destroy playbook | ||
ansible.builtin.import_playbook: ../../cloud_providers/{{ cloud_provider }}_destroy_env.yml | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
# Stand-in to implement no-op for workloads import_playbook compatibility | ||
- name: Workloads not configured as mapping for {{ _workload_title_ }} | ||
hosts: localhost |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--- | ||
- name: Check workloads set hosts and names | ||
loop: "{{ host_workloads }}" | ||
loop_control: | ||
loop_var: __workload | ||
label: "{{ __workload.name }}" | ||
assert: | ||
that: | ||
- __workload is defined | ||
- __workload is mapping | ||
- __workload.name is defined | ||
- __workload.name is string | ||
- __workload.hosts is defined | ||
- __workload.hosts is string | ||
|
||
- name: Run workloads | ||
loop: "{{ host_workloads }}" | ||
loop_control: | ||
loop_var: __workload | ||
label: "{{ __workload.name }}" | ||
vars: | ||
# Default hosts to localhost in infra and all during software | ||
__default_hosts: >- | ||
{{ | ||
'localhost' if agnosticd_stage.endswith('infra') else 'all' | ||
}} | ||
when: | ||
- inventory_hostname in lookup('inventory_hostnames', __workload.hosts | default(__default_hosts)) | ||
ansible.builtin.include_tasks: | ||
file: run_workload.yml | ||
... |
Oops, something went wrong.