Remove the obsolete rebuild-inventory role

Also the following adjustments after removing the role:

* replace all remaining rebuild-inventory calls with
  tripleo-inventory calls
* improve the description of the inventory role calls, specifying
  what nodes are added at each call
* make tag use similar to others in quickstart.yml
* remove unnecessary inventory call in tripleo-roles.yml
* remove extra comments, use play naming to descript what we do
* remove extra provision tagging from dlrn-gate.yml
* remove the the inventory: undercloud vars, because it's the default
* remove obsolete README.md from the provision role

Change-Id: I1a94eda50621b84351cf146c3a7dd518476ba5ed
This commit is contained in:
Attila Darazs 2016-07-29 16:44:17 +02:00
parent 519742b1c5
commit 2f5aa34837
11 changed files with 25 additions and 127 deletions

View File

@ -4,10 +4,11 @@
roles:
- provision/local
- name: Rebuild inventory
- name: Add the virthost node to the generated inventory
hosts: localhost
gather_facts: yes
roles:
- rebuild-inventory
- tripleo-inventory
- name: Setup the virthost to build images then build them
hosts: virthost

View File

@ -22,8 +22,6 @@
- include: teardown.yml
- include: provision.yml
tags:
- provision
- name: Clone the gated DLRN repos and trigger rpm injection
hosts: virthost

View File

@ -5,8 +5,8 @@
roles:
- libvirt/setup
- name: Rebuild inventory
- name: Add nodes to the generated inventory
hosts: localhost
gather_facts: no
gather_facts: yes
roles:
- rebuild-inventory
- tripleo-inventory

View File

@ -16,12 +16,11 @@
tags:
- provision
# Regenerate the inventory file for use in subsequent
# `ansible-playbook` runs.
- name: Rebuild inventory
- name: Add the virthost node to the generated inventory
hosts: localhost
gather_facts: yes
roles:
- rebuild-inventory
- tripleo-inventory
tags:
- provision

View File

@ -1,7 +1,7 @@
# This is the playbook used by the `quickstart.sh` script.
# Add the virthost to the in-memory inventory. The inventory is not
# wirtten out to disk unless you call the `rebuild-inventory` role.
# Add the virthost to the in-memory inventory. The inventory is not
# written out to disk unless you call the `tripleo-inventory` role.
- name: Add the virthost to the inventory
hosts: localhost
tasks:
@ -12,7 +12,6 @@
ansible_user: "root"
ansible_host: "{{ virthost }}"
- include: teardown.yml
# The [provision.yml](provision.yml.html) playbook is responsible for
@ -39,15 +38,13 @@
- libvirt/setup
# Add the undercloud node to the generated
# inventory.
- name: Inventory the undercloud
- name: Add the undercloud node to the generated inventory
hosts: localhost
gather_facts: yes
vars:
inventory: undercloud
tags:
- undercloud-scripts
roles:
- { role: tripleo-inventory, tags: ['undercloud-scripts'] }
- tripleo-inventory
# Deploy the undercloud
- name: Install undercloud and deploy overcloud
@ -63,14 +60,15 @@
roles:
- tripleo/overcloud
# Add the overcloud nodes to the generated inventory.
- name: Inventory the overcloud
- name: Add the overcloud nodes to the generated inventory
hosts: undercloud
gather_facts: yes
tags:
- overcloud-deploy
vars:
inventory: all
roles:
- { role: tripleo-inventory, tags: ['overcloud-deploy'] }
- tripleo-inventory
# Check the results of the deployment, note after inventory has executed
- name: Check the result of the deployment

View File

@ -12,16 +12,6 @@
tags:
- provision
# Add the virthost node to the generated
# inventory.
- name: Inventory the virthost
hosts: localhost
gather_facts: yes
roles:
- tripleo-inventory
tags:
- provision
- include: teardown.yml
# The [provision.yml](provision.yml.html) playbook is responsible for
@ -46,35 +36,31 @@
roles:
- libvirt/setup
# Add the undercloud node to the generated
# inventory.
- name: Inventory the undercloud
- name: Add the undercloud node to the generated inventory
hosts: localhost
gather_facts: yes
vars:
inventory: undercloud
roles:
- tripleo-inventory
- name: Install the undercloud
- name: Install the undercloud
hosts: undercloud
gather_facts: no
roles:
- tripleo/undercloud
- name: Post undercloud install steps
- name: Post undercloud install steps
hosts: undercloud
gather_facts: no
roles:
- tripleo-undercloud-post
- name: Deploy the overcloud
- name: Deploy the overcloud
hosts: undercloud
gather_facts: no
roles:
- tripleo-overcloud
- name: Inventory the overcloud
- name: Add the overcloud nodes to the generated inventory
hosts: undercloud
gather_facts: yes
vars:

View File

@ -1,32 +0,0 @@
## Provisioning
In your playbook:
- hosts: localhost
roles:
- provision/local
- hosts: virthost
roles:
- provision/remote
- hosts: localhost
roles:
- rebuild-inventory
On the command line:
ansible-playbook playbook.yml -e virthost=my.target.host
## Cleaning up
In your playbook:
- hosts: virthost
roles:
- provision/cleanup
On the command line:
ansible-playbook playbook.yml -i ~/.quickstart/hosts \
-e ansible_user=root

View File

@ -17,7 +17,7 @@
state: touch
# Add the virthost to the in-memory inventory. The inventory is not
# wirtten out to disk unless you call the `rebuild-inventory` role.
# written out to disk unless you call the `tripleo-inventory` role.
- name: Add the virthost to the inventory
add_host:
name: "{{virthost}}"

View File

@ -1,4 +0,0 @@
# Include the `common` role as a dependency. This makes sure the
# variables defined in that role are available here.
dependencies:
- common

View File

@ -1,14 +0,0 @@
- name: Ensure local working dir exists
delegate_to: localhost
file:
path: "{{ local_working_dir }}"
state: directory
# Generate an ansible inventory file from our in-memory inventory.
# This permits someone to run ad-hoc ansible commands or playbooks
# against the hosts we create with `add_hosts` elsewhere in this
# project.
- name: rebuild-inventory
template:
dest: "{{ local_working_dir }}/hosts"
src: inventory.j2

View File

@ -1,34 +0,0 @@
{% for host in groups['all'] %}
{% if hostvars[host].get('ansible_connection', '') == 'local' %}
{{ host }} ansible_connection=local
{% else %}
{{ host }}{% if 'ansible_host' in hostvars[host]
%} ansible_host={{ hostvars[host]['ansible_host'] }} {% endif %}
{% if 'ansible_user' in hostvars[host]
%} ansible_user={{ hostvars[host]['ansible_user'] }} {% endif %}
{% if 'ansible_private_key_file' in hostvars[host]
%} ansible_private_key_file={{ hostvars[host]['ansible_private_key_file'] }}
{% endif %}
{% endif %}
{% endfor %}
{% for group in groups %}
{% if group not in ['ungrouped', 'all'] %}
[{{ group }}]
{% for host in groups[group] %}
{{ host }}
{% endfor %}
{% endif %}
{% endfor %}
{% if 'undercloud' in groups %}
[undercloud:vars]
ansible_ssh_extra_args='-F {{local_working_dir}}/ssh.config.ansible'
{% endif %}
{% if 'overcloud' in groups %}
[overcloud:vars]
ansible_ssh_extra_args='-F {{local_working_dir}}/ssh.config.ansible'
{% endif %}