Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic roles #3054

Open
wants to merge 19 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ansible/hooks/infra.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
loop_control:
loop_var: _role
label: "{{ _role.name }}"
when: "{{ _role.when | default(true) }}"
include_role:
name: "{{ _role.name }}"
defaults_from: "{{ _role.defaults_from | default('main') }}"
Expand Down
1 change: 1 addition & 0 deletions ansible/hooks/post_destroy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
loop_control:
loop_var: _role
label: "{{ _role.name }}"
when: "{{ _role.when | default(true) }}"
include_role:
name: "{{ _role.name }}"
defaults_from: "{{ _role.defaults_from | default('main') }}"
Expand Down
10 changes: 7 additions & 3 deletions ansible/hooks/post_infra.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
tasks_from: "{{ _role.tasks_from | default('main') }}"
vars_from: "{{ _role.vars_from | default('main') }}"
when: >-
_role.group | default('') in group_names
or
_role.groups | default([]) | intersect(group_names) | list | length > 0
{{ _role.when | default(true) }}
fridim marked this conversation as resolved.
Show resolved Hide resolved
and
(
_role.group | default('') in group_names
or
_role.groups | default([]) | intersect(group_names) | list | length > 0
)
10 changes: 7 additions & 3 deletions ansible/hooks/post_software.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
tasks_from: "{{ _role.tasks_from | default('main') }}"
vars_from: "{{ _role.vars_from | default('main') }}"
when: >-
_role.group | default('') in group_names
or
_role.groups | default([]) | intersect(group_names) | list | length > 0
{{ _role.when | default(true) }}
and
(
_role.group | default('') in group_names
or
_role.groups | default([]) | intersect(group_names) | list | length > 0
)
1 change: 1 addition & 0 deletions ansible/hooks/pre_infra.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
loop_control:
loop_var: _role
label: "{{ _role.name }}"
when: "{{ _role.when | default(true) }}"
include_role:
name: "{{ _role.name }}"
defaults_from: "{{ _role.defaults_from | default('main') }}"
Expand Down
10 changes: 7 additions & 3 deletions ansible/hooks/pre_software.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
tasks_from: "{{ _role.tasks_from | default('main') }}"
vars_from: "{{ _role.vars_from | default('main') }}"
when: >-
_role.group | default('') in group_names
or
_role.groups | default([]) | intersect(group_names) | list | length > 0
{{ _role.when | default(true) }}
and
(
_role.group | default('') in group_names
or
_role.groups | default([]) | intersect(group_names) | list | length > 0
)
10 changes: 7 additions & 3 deletions ansible/hooks/software.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
tasks_from: "{{ _role.tasks_from | default('main') }}"
vars_from: "{{ _role.vars_from | default('main') }}"
when: >-
_role.group | default('') in group_names
or
_role.groups | default([]) | intersect(group_names) | list | length > 0
{{ _role.when | default(true) }}
and
(
_role.group | default('') in group_names
or
_role.groups | default([]) | intersect(group_names) | list | length > 0
)