forked from redhat-openstack/ansible-nfv
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge "TripleO inventory add the ability to provide password instead …
…of manually copy it" into devel
- Loading branch information
Showing
12 changed files
with
261 additions
and
109 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
environments/*_env | ||
inventory | ||
ansible.ssh.config | ||
id_rsa* | ||
ansible.ssh.config* | ||
ssh/ansible.ssh.config* | ||
ssh/id_rsa* | ||
*.retry |
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,9 @@ | ||
## Inventory files, SSH config and SSH key files | ||
|
||
This directory will hold the following types of files. | ||
For each environment, a dedicated folder will be created. | ||
|
||
- Inventory files generated by the TripleO Inventory play. | ||
- Ansible.ssh.config file that allow to establish direct connection from the locahost to the overcloud node (controller/compute/etc). | ||
- Overcloud SSH public key. | ||
- In case 'ssh_pass' parameter is used, a new ssh key will be generated for the Undercloud host. |
File renamed without changes.
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 |
---|---|---|
@@ -1,47 +1,7 @@ | ||
--- | ||
|
||
- name: Set an Undercloud host | ||
- name: TripleO inventory creation | ||
hosts: localhost | ||
gather_facts: no | ||
vars: | ||
undercloud_host: "{{ host }}" | ||
undercloud_user: "{{ user | default('stack') }}" | ||
undercloud_private_key_file: "{{ ssh_file | default(omit) }}" | ||
tasks: | ||
# Flash in-memory inventory in order to recreate | ||
# the inventory file with the new parameters | ||
- meta: refresh_inventory | ||
|
||
- name: Add undercloud to host list | ||
add_host: | ||
name: "{{ undercloud_host }}" | ||
groups: "undercloud,tester" | ||
ansible_ssh_host: "{{ undercloud_host }}" | ||
ansible_ssh_user: "{{ undercloud_user }}" | ||
ansible_ssh_private_key_file: "{{ undercloud_private_key_file | default(omit) }}" | ||
|
||
- name: Generate Inventory file | ||
template: | ||
src: '../../../roles/post_install/tripleo_inventory/templates/inventory.j2' | ||
dest: "{{ lookup('env', 'PWD') }}/inventory" | ||
|
||
- name: Create TripleO inventory | ||
hosts: undercloud | ||
roles: | ||
- post_install/tripleo_inventory | ||
vars: | ||
overcloud_private_key: "{{ inventory_dir }}/id_rsa_overcloud" | ||
overcloud_user: heat-admin | ||
|
||
- name: Update inventory and ansible.ssh.config files | ||
hosts: localhost | ||
tasks: | ||
- name: Update ansible.ssh.config for SSH tunneling | ||
template: | ||
src: '../../../roles/post_install/tripleo_inventory/templates/ansible.ssh.config.j2' | ||
dest: "{{ inventory_dir }}/ansible.ssh.config" | ||
|
||
- name: Generate Inventory file | ||
template: | ||
src: '../../../roles/post_install/tripleo_inventory/templates/inventory.j2' | ||
dest: "{{ inventory_dir }}/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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
|
||
# Undercloud host name/ip | ||
# host: | ||
|
||
# Undercloud user. Default - stack | ||
# user: | ||
|
||
# Define one of the following. | ||
# In case ssh_pass is used, dynamic ssh key will be generated ans used. | ||
# ssh_key: | ||
# ssh_pass: | ||
|
||
overcloud_user: heat-admin |
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
67 changes: 67 additions & 0 deletions
67
roles/post_install/tripleo_inventory/tasks/overcloud_nodes.yml
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,67 @@ | ||
--- | ||
|
||
- name: Gather Undercloud facts | ||
setup: | ||
delegate_to: "{{ groups['undercloud'][0] }}" | ||
delegate_facts: True | ||
|
||
- name: Install python-virtualenv, gcc, python-devel for the pip tasks | ||
yum: | ||
name: "{{ item }}" | ||
state: present | ||
with_items: | ||
- 'python-virtualenv' | ||
- 'python-devel' | ||
- 'git' | ||
- 'wget' | ||
- 'gcc' | ||
- 'libffi-devel' | ||
- 'libxml2-devel' | ||
- 'libxslt-devel' | ||
- 'openssl-devel' | ||
become: true | ||
|
||
- name: Install required pip packages | ||
pip: | ||
name: "{{ item }}" | ||
virtualenv: "/tmp/ansible_venv" | ||
extra_args: '--upgrade' | ||
with_items: | ||
- 'pip' | ||
- 'setuptools' | ||
- 'pytz' | ||
- 'shade' | ||
- 'requests' | ||
|
||
- name: Fetch private key from the undercloud host | ||
fetch: | ||
src: "/home/stack/.ssh/id_rsa" | ||
dest: "{{ overcloud_private_key }}" | ||
flat: yes | ||
|
||
- name: Set SSH key permissions | ||
file: | ||
path: "{{ overcloud_private_key }}" | ||
mode: 0600 | ||
delegate_to: localhost | ||
|
||
- name: Grab auth data from stackrc file and publish it as YAML | ||
### ToDo(MaximB): Convert the task to more generic execution. | ||
### Implement reuse. | ||
shell: | | ||
source "{{ rc_file_path | default('/home/stack/stackrc') }}" | ||
echo " | ||
auth_url: $OS_AUTH_URL | ||
username: $OS_USERNAME | ||
password: $OS_PASSWORD | ||
project_name: $OS_TENANT_NAME | ||
" | ||
register: creds | ||
|
||
- name: Gather Overcloud nodes data | ||
vars: | ||
ansible_python_interpreter: "/tmp/ansible_venv/bin/python" | ||
os_server_facts: | ||
auth: "{{ creds.stdout | from_yaml }}" | ||
# Required for SSL | ||
validate_certs: no |
Oops, something went wrong.