Skip to content

Commit

Permalink
refine structure
Browse files Browse the repository at this point in the history
  • Loading branch information
fridim committed Jun 21, 2021
1 parent 2141220 commit b876a6c
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 16 deletions.
File renamed without changes.
18 changes: 18 additions & 0 deletions ansible/hooks/post_destroy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
- name: Post Destroy Dynamic Roles
hosts: localhost
gather_facts: false
tags:
- dynamic_roles
tasks:
- name: Process roles
loop: "{{ agnosticd_post_destroy_roles | default([]) }}"
loop_control:
loop_var: _role
label: "{{ _role.name }}"
include_role:
name: "{{ _role.name }}"
defaults_from: "{{ _role.defaults_from | default('main') }}"
handlers_from: "{{ _role.defaults_from | default('main') }}"
tasks_from: "{{ _role.tasks_from | default('main') }}"
vars_from: "{{ _role.vars_from | default('main') }}"
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
- dynamic_roles
tasks:
- name: Process roles
loop: "{{ agnosticd_pre_infra_roles | default([]) }}"
loop: "{{ agnosticd_post_infra_roles | default([]) }}"
loop_control:
loop_var: _role
label: "{{ _role.name }}"
Expand All @@ -17,6 +17,6 @@
tasks_from: "{{ _role.tasks_from | default('main') }}"
vars_from: "{{ _role.vars_from | default('main') }}"
when: >-
_role.group | default('') in group_names )
_role.group | default('') in group_names
or
_role.groups | default([]) | intersect(group_names) | list | length > 0
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
tasks_from: "{{ _role.tasks_from | default('main') }}"
vars_from: "{{ _role.vars_from | default('main') }}"
when: >-
_role.group | default('') in group_names )
_role.group | default('') in group_names
or
_role.groups | default([]) | intersect(group_names) | list | length > 0
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
tasks_from: "{{ _role.tasks_from | default('main') }}"
vars_from: "{{ _role.vars_from | default('main') }}"
when: >-
_role.group | default('') in group_names )
_role.group | default('') in group_names
or
_role.groups | default([]) | intersect(group_names) | list | length > 0
2 changes: 1 addition & 1 deletion ansible/software_common.yml → ansible/hooks/software.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
tasks_from: "{{ _role.tasks_from | default('main') }}"
vars_from: "{{ _role.vars_from | default('main') }}"
when: >-
_role.group | default('') in group_names )
_role.group | default('') in group_names
or
_role.groups | default([]) | intersect(group_names) | list | length > 0
29 changes: 18 additions & 11 deletions ansible/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@
- step000
- pre_infra_tasks

- name: Common Pre Infra
import_playbook: pre_infra_common.yml
- name: Pre Infra Dynamic Roles
import_playbook: hooks/pre_infra.yml
tags:
- step000
- dynamic_roles
- pre_infra_tasks

#################################################################################
Expand All @@ -48,10 +49,11 @@
- step001
- deploy_infrastructure

- name: Common Infra
import_playbook: infra_common.yml
- name: Infra Dynamic Roles
import_playbook: hooks/infra.yml
tags:
- step001
- dynamic_roles
- deploy_infrastructure

################################################################################
Expand All @@ -66,10 +68,11 @@
- post_infra
- post_infra_tasks

- name: Common Post Infra
import_playbook: post_infra_common.yml
- name: Post Infra Dynamic Roles
import_playbook: hooks/post_infra.yml
tags:
- step002
- dynamic_roles
- post_infra
- post_infra_tasks

Expand All @@ -86,10 +89,11 @@
- pre_software
- pre_software_tasks

- name: Common Pre Software
import_playbook: pre_software_common.yml
- name: Pre Software Dynamic Roles
import_playbook: hooks/pre_software.yml
tags:
- step003
- dynamic_roles
- pre_software
- pre_software_tasks

Expand All @@ -111,10 +115,11 @@
- step004
- deploy_software

- name: Common Software
import_playbook: software_common.yml
- name: Software Dynamic Roles
import_playbook: hooks/software.yml
tags:
- step004
- dynamic_roles
- deploy_software

################################################################################
Expand All @@ -129,9 +134,11 @@
- post_software
- post_software_tasks

- import_playbook: post_software_common.yml
- name: Post Software Dynamic Roles
import_playbook: hooks/post_software.yml
tags:
- step005
- dynamic_roles
- post_software
- post_software_tasks

Expand Down

0 comments on commit b876a6c

Please sign in to comment.