tripleo-ansible/tripleo_ansible/playbooks/tripleo_nova_image_cache.yml
Oliver Walsh cd7191436e Add role/playbook to manage nova image cache
Adds a tripleo-nova-image-cache role to manage the nova local image cache on
remote compute nodes.
For multi-site/stack deployments the image can be downloaded once and
distributed to the remaining nodes in the stack to minimise WAN traffic.

Also adds a playbook to run the role using the single/multi-stack inventory
and the overcloudrc environment variables.

Change-Id: Ib5aaa22f6cf307181d8f34cf89f9f24619b43004
Implements: blueprint tripleo-nova-cache-mgmt
(cherry picked from commit 8dc6d50b16)
2020-03-18 14:09:58 +00:00

62 lines
2.6 KiB
YAML

---
# Copyright 2019 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
- name: TripleO Nova image cache management
hosts: "{{ tripleo_nova_image_cache_plan + '_nova_compute' if tripleo_nova_image_cache_plan|default('') else 'nova_compute'}}"
environment:
# export everything in overcloudrc for openstacksdk
NOVA_VERSION: "{{ lookup('env', 'NOVA_VERSION') }}"
COMPUTE_API_VERSION: "{{ lookup('env', 'COMPUTE_API_VERSION') }}"
OS_USERNAME: "{{ lookup('env', 'OS_USERNAME') }}"
OS_PROJECT_NAME: "{{ lookup('env', 'OS_PROJECT_NAME') }}"
OS_USER_DOMAIN_NAME: "{{ lookup('env', 'OS_USER_DOMAIN_NAME') }}"
OS_PROJECT_DOMAIN_NAME: "{{ lookup('env', 'OS_PROJECT_DOMAIN_NAME') }}"
OS_NO_CACHE: "{{ lookup('env', 'OS_NO_CACHE') }}"
no_proxy: "{{ lookup('env', 'no_proxy') }}"
OS_AUTH_TYPE: "{{ lookup('env', 'OS_AUTH_TYPE') }}"
OS_PASSWORD: "{{ lookup('env', 'OS_PASSWORD') }}"
OS_AUTH_URL: "{{ lookup('env', 'OS_AUTH_URL') }}"
OS_IDENTITY_API_VERSION: "{{ lookup('env', 'OS_IDENTITY_API_VERSION') }}"
OS_IMAGE_API_VERSION: "{{ lookup('env', 'OS_IMAGE_API_VERSION') }}"
OS_VOLUME_API_VERSION: "{{ lookup('env', 'OS_VOLUME_API_VERSION') }}"
OS_REGION_NAME: "{{ lookup('env', 'OS_REGION_NAME') }}"
roles:
- role: tripleo-nova-image-cache
# Standard inventory:
#
# ansible-playbook -i inventory.yml --extra-vars "@test_args1.yml" tripleo_nova_image_cache.yml
# test_args1.yml
# tripleo_nova_image_cache_images:
# - id: d23c6b8f-e166-4a02-afd8-0ae8d6f73f18
# state: expired
# - id: 81bbb16-d589-4730-be70-822a82ab6bb9
# ttl: 28
#
# Multi-stack inventory:
#
# ansible-playbook -i inventory_multi.yml --extra-vars "@test_args2.yml" tripleo_nova_image_cache.yml
# test_args2.yml:
# tripleo_nova_image_cache_plan: edge0
# tripleo_nova_image_cache_images:
# - id: d23c6b8f-e166-4a02-afd8-0ae8d6f73f18
# state: expired
# - id: 81bbb16-d589-4730-be70-822a82ab6bb9
# ttl: 28
# tripleo_nova_image_cache_use_proxy: true
# tripleo_nova_image_cache_proxy_hostname: compute-1 # optional, first nova_compute host is used otherwise
#