Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding feature : auto-generated inventory file
- Loading branch information
1 parent
0d6fc53
commit a7e74b4
Showing
5 changed files
with
55 additions
and
1 deletion.
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
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,15 @@ | ||
--- | ||
|
||
# ---------------------------------------------------------------------------------------------------------------------- | ||
# Generate the inventory file | ||
# ---------------------------------------------------------------------------------------------------------------------- | ||
|
||
- name: "Generate the inventory file" | ||
delegate_to: localhost | ||
template: | ||
src: os_inventory.ini.j2 | ||
dest: "{{ inventory_dir }}/{{ openstack_bootstrap_inventory.filename | default('os_inventory.ini') }}" | ||
force: "{{ openstack_bootstrap_inventory.force | default(yes) }}" | ||
backup: "{{ openstack_bootstrap_inventory.backup | default(no) }}" | ||
tags: | ||
- inventory |
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,17 @@ | ||
# Generated inventory file by openstack-bootstrap | ||
|
||
{% for os_group_name, os_hosts in groups.iteritems() %} | ||
{% if 'ungrouped' != os_group_name %} | ||
[{{ os_group_name }}] | ||
{% for os_host_name in os_hosts %} | ||
{% if 'localhost' != os_host_name %} | ||
{% if 'all' == os_group_name %} | ||
{{ os_host_name }} ansible_host={{ hostvars[os_host_name].ansible_host }} | ||
{% else %} | ||
{{ os_host_name }} | ||
{% endif %} | ||
{% endif %} | ||
{% endfor %} | ||
{% endif %} | ||
|
||
{% endfor %} |