Skip to content

Commit

Permalink
Allow --images-task to be set to none.
Browse files Browse the repository at this point in the history
This handles the pre-provisioned nodes use-case.

Signed-off-by: Luke Short <[email protected]>
  • Loading branch information
LukeShortCloud committed Nov 7, 2019
1 parent 2e9989f commit b1ff938
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 64 deletions.
130 changes: 66 additions & 64 deletions plugins/tripleo-undercloud/images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,75 +87,77 @@
dest: "{{ tmp_oc_repos_dir }}"
with_items: "{{ install.get('repos', {}).urls|default([]) }}"

- include_tasks: "tasks/images/{{ install.images.task }}.yml"
block:
when: install.images.task != 'none'
- include_tasks: "tasks/images/{{ install.images.task }}.yml"

- name: modify images - update to core build and install packages
include_tasks: tasks/images/repos.yml
# update is a func name (dict.update) so it must be used as str explicitly
when: install.images.packages|default('') or install.images['update'] or install.images.remove|default('')
- name: modify images - update to core build and install packages
include_tasks: tasks/images/repos.yml
# update is a func name (dict.update) so it must be used as str explicitly
when: install.images.packages|default('') or install.images['update'] or install.images.remove|default('')

# Trigger only when update kernel flag is specified and new packages installed inside overcloud image
- name: update default overcloud kernel form modified overcloud image
include_tasks: tasks/images/update-kernel.yml
when:
- install['overcloud']['update']['kernel']
- install.images.packages
# Trigger only when update kernel flag is specified and new packages installed inside overcloud image
- name: update default overcloud kernel form modified overcloud image
include_tasks: tasks/images/update-kernel.yml
when:
- install['overcloud']['update']['kernel']
- install.images.packages

#Need to fix BZ1462703 to apply --os-cloud
- name: upload the overcloud images to glance
shell: |
set -exuo pipefail
source ~/stackrc
openstack overcloud image upload --update-existing
tags: skip_ansible_lint
#Need to fix BZ1462703 to apply --os-cloud
- name: upload the overcloud images to glance
shell: |
set -exuo pipefail
source ~/stackrc
openstack overcloud image upload --update-existing
tags: skip_ansible_lint

- name: check for existing nodes ( OS <= 10 )
shell: |
set -exuo pipefail
source ~/stackrc
ironic node-list 2>/dev/null | wc -l
tags:
- skip_ansible_lint
register: oc_nodes_prev
when:
- undercloud_version|openstack_release <= 10
- name: check for existing nodes ( OS <= 10 )
shell: |
set -exuo pipefail
source ~/stackrc
ironic node-list 2>/dev/null | wc -l
tags:
- skip_ansible_lint
register: oc_nodes_prev
when:
- undercloud_version|openstack_release <= 10

- name: check for existing nodes ( OS >= 11 )
shell: |
source ~/stackrc
openstack baremetal node list -c UUID -f json
tags:
- skip_ansible_lint
register: oc_nodes
when:
- undercloud_version|openstack_release >= 11
- name: check for existing nodes ( OS >= 11 )
shell: |
source ~/stackrc
openstack baremetal node list -c UUID -f json
tags:
- skip_ansible_lint
register: oc_nodes
when:
- undercloud_version|openstack_release >= 11

- name: configure nodes to use updated kernel and ramdisk ( OS <= 10 )
shell: |
source ~/stackrc
openstack baremetal configure boot
tags:
- skip_ansible_lint
when:
- undercloud_version|openstack_release <= 10
- oc_nodes_prev.stdout|int > 4
- name: configure nodes to use updated kernel and ramdisk ( OS <= 10 )
shell: |
source ~/stackrc
openstack baremetal configure boot
tags:
- skip_ansible_lint
when:
- undercloud_version|openstack_release <= 10
- oc_nodes_prev.stdout|int > 4

# https://access.redhat.com/documentation/en-us/red_hat_openstack_platform/11/html/upgrading_red_hat_openstack_platform/chap-director-minor-update#sect-Updating_Overcloud_and_Introspection_Images
- name: configure nodes to use updated kernel and ramdisk ( OS >= 11 )
shell: |
source ~/stackrc
openstack overcloud node configure {{ ' '.join(oc_nodes.stdout|from_json|map(attribute='UUID')) }}
tags:
- skip_ansible_lint
when:
- undercloud_version|openstack_release >= 11
- oc_nodes.stdout|from_json
# https://access.redhat.com/documentation/en-us/red_hat_openstack_platform/11/html/upgrading_red_hat_openstack_platform/chap-director-minor-update#sect-Updating_Overcloud_and_Introspection_Images
- name: configure nodes to use updated kernel and ramdisk ( OS >= 11 )
shell: |
source ~/stackrc
openstack overcloud node configure {{ ' '.join(oc_nodes.stdout|from_json|map(attribute='UUID')) }}
tags:
- skip_ansible_lint
when:
- undercloud_version|openstack_release >= 11
- oc_nodes.stdout|from_json

- name: remove downloaded images
file:
path: "/home/{{ install.user.name }}/{{ item[1] }}"
state: absent
with_subelements:
- "{{ (image_files|default({})).get('results',{}) }}"
- "files"
when: image_files is defined and install.images.cleanup
- name: remove downloaded images
file:
path: "/home/{{ install.user.name }}/{{ item[1] }}"
state: absent
with_subelements:
- "{{ (image_files|default({})).get('results',{}) }}"
- "files"
when: image_files is defined and install.images.cleanup
2 changes: 2 additions & 0 deletions plugins/tripleo-undercloud/plugin.spec
Original file line number Diff line number Diff line change
Expand Up @@ -342,10 +342,12 @@ subparsers:
* rpm - packaged with product (versions 8 and above)
* import - Download pre-built images from a given source (versions 7 and 8). Requires '--images-url'.
* build - build images locally (takes longer) on top of regular cloud guest image. CentOS/RHEL will be used for RDO/OSP.
* none - do not upload any Overcloud images (useful for pre-provisioned nodes)
choices:
- rpm
- import
- build
- none

images-url:
type: Value
Expand Down

0 comments on commit b1ff938

Please sign in to comment.