Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement it by starting up two libvirt nodes as nodepool ones and before start zuul repro connecting nodepool-launcher to them. Zuul executor has some issues with the repro role that's why we are generating a playbook to run the role inside the nodes. Only Centos7 is tested. Change-Id: I127306e2bed51df08301ae76d28f34828d1bfcba
- Loading branch information
Showing
16 changed files
with
324 additions
and
65 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
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
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 @@ | ||
#!/bin/bash -ex | ||
|
||
{% if 'git.openstack.org/openstack/tripleo-quickstart' in zuul.projects %} | ||
|
||
tq={{ ansible_user_dir }}/{{ zuul.projects['git.openstack.org/openstack/tripleo-quickstart'].src_dir }} | ||
export ANSIBLE_LIBRARY="${tq}/library" | ||
export ANSIBLE_ROLES_PATH="${tq}/roles" | ||
|
||
{% endif %} | ||
|
||
export ANSIBLE_STDOUT_CALLBACK=debug | ||
|
||
# To be able to use stuff installed with pip --user | ||
# At zuul images we don't have any .bash_profile or .profile | ||
export PATH=$PATH:$HOME/.local/bin | ||
|
||
ansible-playbook -vv ~/start.yaml |
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,62 @@ | ||
--- | ||
- name: Install libvirt packages | ||
include_role: | ||
name: parts/libvirt | ||
|
||
- name: Add user to libvirt group | ||
become: true | ||
user: | ||
name: "{{ ansible_user }}" | ||
groups: | ||
- libvirt | ||
- wheel | ||
append: true | ||
- name: reset ssh connection to allow user changes to affect | ||
meta: reset_connection | ||
- name: Restore a libvirt snapshot | ||
when: restore_snapshot | ||
vars: | ||
ansible_become: true | ||
snapshot_restore: true | ||
include_role: | ||
name: snapshot-libvirt | ||
|
||
- name: Setup libvirt nodes | ||
when: not restore_snapshot | ||
vars: | ||
libvirt_nodepool: true | ||
local_working_dir: "{{ install_path }}" | ||
working_dir: "{{ install_path }}" | ||
non_root_user: "{{ ansible_user }}" | ||
non_root_group: "{{ ansible_user }}" | ||
|
||
block: | ||
- name: Start nodes | ||
block: | ||
- name: Tear down nodes | ||
include_role: | ||
name: libvirt/teardown/nodes | ||
|
||
- name: Set up nodes | ||
include_role: | ||
name: libvirt/setup/overcloud | ||
|
||
- name: Set up tripleo inventory | ||
include_role: | ||
name: tripleo-inventory | ||
|
||
- name: prepare nodes | ||
# We call playbook to parallelize | ||
shell: | | ||
set -e | ||
PATH=$PATH:$HOME/.local/bin | ||
ANSIBLE_STDOUT_CALLBACK=debug | ||
ansible-playbook -i {{ install_path }}/hosts -vv \ | ||
{{ role_path }}/tasks/libvirt/prepare.yaml | ||
- name: Create libvirt snapshot | ||
when: create_snapshot | ||
vars: | ||
ansible_become: true | ||
snapshot_create: true | ||
include_role: | ||
name: snapshot-libvirt |
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,82 @@ | ||
--- | ||
- hosts: subnodes | ||
vars: | ||
update_subnodes: true | ||
packages_list: | ||
- git | ||
- unbound | ||
- tmux | ||
- screen | ||
- vim | ||
- wget | ||
- "{% if ansible_python.version.major == 3 -%}python3-virtualenv{%- | ||
else -%}python-virtualenv{%- endif -%}" | ||
tasks: | ||
- name: Create /etc/nodepool directory | ||
file: | ||
path: /etc/nodepool | ||
state: directory | ||
owner: "{{ ansible_user }}" | ||
group: "{{ ansible_user }}" | ||
mode: 0755 | ||
become: true | ||
|
||
- name: Install repos (will be removed by toci_gate_test) | ||
package: | ||
name: "{{ item }}" | ||
with_items: | ||
- centos-release-openstack-queens | ||
- epel-release | ||
become: true | ||
|
||
- name: Install packages | ||
package: | ||
name: "{{ packages_list }}" | ||
state: latest | ||
become: true | ||
tags: | ||
# We really want to install latest | ||
- skip_ansible_lint | ||
|
||
- name: Scan SSH keys from subnodes | ||
shell: | | ||
for key in {{ hostvars[item].subnode_public_ip }} \ | ||
{{ hostvars[item].subnode_private_ip }}; do | ||
if ! grep -q $key /etc/ssh/ssh_known_hosts ; then | ||
ssh-keyscan $key >> /etc/ssh/ssh_known_hosts | ||
fi | ||
done | ||
changed_when: true | ||
with_inventory_hostnames: | ||
- subnodes | ||
become: true | ||
|
||
- when: update_subnodes|bool | ||
block: | ||
|
||
- name: Update packages | ||
package: | ||
name: '*' | ||
state: latest | ||
become: true | ||
tags: | ||
# We really want to update | ||
- skip_ansible_lint | ||
|
||
- name: Reboot hosts | ||
shell: sleep 2 && shutdown -r now | ||
async: 1 | ||
poll: 0 | ||
ignore_errors: true | ||
become: true | ||
|
||
- name: Wait for provisioned hosts to become reachable | ||
delegate_to: localhost | ||
wait_for: | ||
host: "{{ subnode_public_ip }}" | ||
port: 22 | ||
delay: 35 | ||
sleep: 10 | ||
state: started | ||
connect_timeout: 10 | ||
timeout: 180 |
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,38 @@ | ||
--- | ||
- name: Open needed ports at default security group | ||
os_security_group_rule: | ||
cloud: "{{ os_cloud_name }}" | ||
security_group: default | ||
protocol: tcp | ||
port_range_min: "{{ item }}" | ||
port_range_max: "{{ item }}" | ||
remote_ip_prefix: 0.0.0.0/0 | ||
with_items: | ||
- 19885 | ||
- 22 | ||
|
||
- name: Get installed images names | ||
os_image_facts: | ||
cloud: "{{ os_cloud_name }}" | ||
|
||
- name: Check image are uploaded | ||
fail: | ||
msg: | | ||
Cannot find {{ item }} at the openstack cloud, you can upload one from | ||
https://nb02.openstack.org/images/ and add your ssh pub key with | ||
virt-edit and upload it to your openstack cloud. | ||
when: | | ||
openstack_image|selectattr( 'name', 'equalto', item )|list|length == 0 | ||
with_items: | ||
- "{{ os_centos7_image }}" | ||
- "{{ os_fedora28_image }}" | ||
|
||
- name: Gather facts about a previously created network by name | ||
os_networks_facts: | ||
cloud: "{{ os_cloud_name }}" | ||
|
||
- name: Check if networks present in the tenant | ||
fail: | ||
msg: 'Network "{{ item }} is not found!' | ||
when: "item not in openstack_networks|map(attribute='name')|list" | ||
with_items: "{{ cloud_networks }}" |
Oops, something went wrong.