Skip to content

Commit 38438c2

Browse files
author
Bharat Kunwar
authored
Merge branch 'master' into group-resources-wip
2 parents ff7e24d + 8f3d065 commit 38438c2

File tree

5 files changed

+17
-7
lines changed

5 files changed

+17
-7
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,11 @@ that is generated. This parameter is a list of dicts of the form:
9292
to be defined for that group. The group variables for each group are defined as
9393
a dictionary mapping variable names to their values.
9494

95+
`cluster_environment_group`: An optional Ansible group name to which all
96+
cluster hosts and localhost will be added. This can be useful if there is a
97+
single group that represents an environment such as
98+
development/staging/production.
99+
95100
Dependencies
96101
------------
97102

defaults/main.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@ cluster_template: "{{ role_path }}/files/resources/cluster-infra.yaml"
1414
cluster_params: {}
1515
cluster_roles: []
1616
cluster_group_vars: {}
17-
cluster_inventory: "{{ playbook_dir }}/inventory_{{ cluster_name }}"
17+
cluster_inventory: "{{ playbook_dir }}/inventory-{{ cluster_name }}"
1818
cluster_ssh_timeout: 600
19+
cluster_environment_group:

meta/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
galaxy_info:
3+
#role_name: cluster_infra
34
author: Stig Telfer
45
description: >
56
This role generates software-defined OpenStack infrastructure that can

tasks/main.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@
1111

1212
# Case 1: we are modifying the cluster.
1313
- block:
14-
- debug:
15-
var: cluster_params
16-
1714
- name: Orchestrate OpenStack infrastructure
1815
register: cluster_stack
1916
os_stack:

templates/cluster_inventory.j2

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,29 @@
22
[openstack]
33
localhost ansible_connection=local ansible_python_interpreter=python
44

5+
{% if cluster_environment_group is not none %}
6+
[{{ cluster_environment_group }}:children]
7+
openstack
8+
cluster
9+
{% endif %}
10+
511
[cluster:children]
612
{% for group_data in cluster_group.output_value %}
713
{{ cluster_name }}_{{ group_data.group }}
814
{% endfor %}
915

1016
{% for group_data in cluster_group.output_value %}
11-
[{{ cluster_name}}_{{ group_data.group }}]
17+
[{{ cluster_name }}_{{ group_data.group }}]
1218
{% for node_data in group_data.nodes %}
13-
{{node_data.name}} ansible_host={{ node_data.ip }} ansible_user={{ cluster_groups | selectattr("name", "equalto", group_data.group) | map(attribute='user') | join }}
19+
{{ node_data.name }} ansible_host={{ node_data.ip }} ansible_user={{ cluster_params.cluster_groups | selectattr("name", "equalto", group_data.group) | map(attribute='user') | join }}
1420
{% endfor %}
1521

1622
{% endfor %}
1723
# Specific roles for cluster deployment assignments
1824
{% for role in cluster_roles %}
1925
[cluster_{{ role.name }}:children]
2026
{% for group in role.groups %}
21-
{{ cluster_name}}_{{ group.name }}
27+
{{ cluster_name }}_{{ group.name }}
2228
{% endfor %}
2329

2430
{% endfor %}

0 commit comments

Comments
 (0)