Skip to content
This repository has been archived by the owner on Feb 29, 2024. It is now read-only.

Commit

Permalink
Updates roles to run with Tripleo-quickstart
Browse files Browse the repository at this point in the history
 - Updates README
 - Updates setup.cfg
 - Moves disk size hint to templated bash

Change-Id: I17ea92bb565d9156c22fd14f33bc5b04f4b1044b
  • Loading branch information
rlandy committed Jun 10, 2016
1 parent e9b12a7 commit c8ab9f2
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 41 deletions.
6 changes: 6 additions & 0 deletions .gitreview
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[gerrit]
host=review.gerrithub.io
port=29418
project=redhat-openstack/ansible-role-tripleo-baremetal-overcloud.git
defaultbranch=master

23 changes: 14 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,43 @@
Role Name
=========

A brief description of the role goes here.
An Ansible role to setup the baremetal overcloud nodes for deployment.

Requirements
------------

Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
This playbook expects that the undercloud has been installed and setup using one of the roles relevant to baremetal overcloud deployments.

Role Variables
--------------

A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
**Note:** Make sure to include all environment file and options from your [initial Overcloud creation](https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux_OpenStack_Platform/7/html/Director_Installation_and_Usage/sect-Scaling_the_Overcloud.html).

- step_root_device_size: <false> -- boolean value that will apply disk size hints and rerun introspection if true
- working_dir: <'/home/stack'> -- working directory for the role. Assumes stackrc file is present at this location

Dependencies
------------

A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
This playbook does not deploy the overcloud. After this playbook runs, call https://github.com/redhat-openstack/ansible-role-tripleo-overcloud.

Example Playbook
----------------

Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
1. Sample playbook to call the role

- hosts: servers
- name: Prepare the baremetal overcloud for deployment
hosts: virthost
gather_facts: no
roles:
- { role: username.rolename, x: 42 }
- ansible-role-tripleo-baremetal-overcloud

License
-------

BSD
Apache

Author Information
------------------

An optional section for the role authors to include contact information, or a website (HTML is not allowed).
RDO-CI Team
19 changes: 10 additions & 9 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description-file =
README.md
author = RDO-CI Team
author-email = rlandy@redhat.com
home-page = https://github.com/rlandy/ansible-role-tripleo-baremetal-overcloud
home-page = https://github.com/redhat-openstack/ansible-role-tripleo-baremetal-overcloud
classifier =
License :: OSI Approved :: Apache Software License
Development Status :: 4 - Beta
Expand All @@ -20,14 +20,15 @@ setup-hooks =

[files]
data_files =
usr/local/share/ansible-role-tripleo-baremetal-overcloud/defaults = ../ansible-role-tripleo-baremetal-overcloud/defaults/*
usr/local/share/ansible-role-tripleo-baremetal-overcloud/handlers = ../ansible-role-tripleo-baremetal-overcloud/handlers/*
usr/local/share/ansible-role-tripleo-baremetal-overcloud/meta = ../ansible-role-tripleo-baremetal-overcloud/meta/*
usr/local/share/ansible-role-tripleo-baremetal-overcloud/tasks = ../ansible-role-tripleo-baremetal-overcloud/tasks/*
usr/local/share/ansible-role-tripleo-baremetal-overcloud/templates = ../ansible-role-tripleo-baremetal-overcloud/templates/*
usr/local/share/ansible-role-tripleo-baremetal-overcloud/files = ../ansible-role-tripleo-baremetal-overcloud/files/*
usr/local/share/ansible-role-tripleo-baremetal-overcloud/tests = ../ansible-role-tripleo-baremetal-overcloud/tests/*
usr/local/share/ansible-role-tripleo-baremetal-overcloud/vars = ../ansible-role-tripleo-baremetal-overcloud/vars/*
usr/local/share/ansible/roles/baremetal-overcloud/defaults = defaults/*
usr/local/share/ansible/roles/baremetal-overcloud/handlers = handlers/*
usr/local/share/ansible/roles/baremetal-overcloud/meta = meta/*
usr/local/share/ansible/roles/baremetal-overcloud/tasks = tasks/*
usr/local/share/ansible/roles/baremetal-overcloud/templates = templates/*
usr/local/share/ansible/roles/baremetal-overcloud/files = files/*
usr/local/share/ansible/roles/baremetal-overcloud/tests = tests/*
usr/local/share/ansible/roles/baremetal-overcloud/vars = vars/*
playbooks = playbooks/*

[wheel]
universal = 1
Expand Down
31 changes: 8 additions & 23 deletions tasks/add-disk-size-hint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,14 @@
- when: step_root_device_size
block:

- name: get nodes UUID
shell: |
. {{ working_dir }}/stackrc
ironic node-list | grep 'power' | awk '{print $2}'
register: ironic_node_list_uuid
- name: Copy over disk size hint script template
template:
src: add-disk-size-hint.sh.j2
dest: "{{ working_dir }}/add-disk-size-hint.sh"
mode: 0755

- name: find disk size from instackenv.json
shell: |
cat instackenv.json | grep '"disk": ' | awk '{print $2}' | sed s/\"//g | sed s/\,//
register: disk_size
- name: Rerun provision with disk size hints
shell: >
"{{ working_dir }}"/add-disk-size-hint.sh
- name: update nodes with disk size hint
shell: |
. {{ working_dir }}/stackrc
if [ {{ disk_root_device_size | int }} -ge {{ item.1 | int }} ]; then
ironic node-update {{ item.0 }} add properties/root_device='{"size": {{ disk_root_device_size | int }}}'
fi
with_together:
- "{{ ironic_node_list_uuid.stdout_lines }}"
- "{{ disk_size.stdout_lines }}"

- name: rerun introspection
shell: |
. {{ working_dir }}/stackrc
openstack baremetal introspection bulk start
28 changes: 28 additions & 0 deletions templates/add-disk-size-hint.sh.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash

# Script to rerun introspection after setting disk hints

set -eux

# get nodes UUID
source {{ working_dir }}/stackrc
export items="$( ironic node-list | grep 'power' | awk '{print $2}' )"

# find disk size from instackenv.json
export DISK_SIZE="$( cat instackenv.json | grep '"disk": ' | awk '{print $2}' | sed s/\"//g | sed s/\,// )"

# update nodes with disk size hint
count=0
ARRAY_DISK_SIZE=($(echo $DISK_SIZE))
ROOT_DEVICE_SIZE={{ disk_root_device_size }}
for item in $items; do
if [ $ROOT_DEVICE_SIZE -ge ${ARRAY_DISK_SIZE[$count]} ]; then
declare i ADS
ADS=${ARRAY_DISK_SIZE[$count]}
ironic node-update $item add properties/root_device='{"size": '$ADS'}'
fi
count=$((count+1))
done

# rerun introspection
openstack baremetal introspection bulk start

0 comments on commit c8ab9f2

Please sign in to comment.