openstack-ansible-os_octavia/tasks/octavia_flavor_create.yml
Mohammed Naser e82141a02a Only run OpenStack tasks once
By having run_once on the entire include, the set_fact only
runs on a single node which means the configuration for all
the other nodes fails.

This patch makes the play get included for everything, but
only the OpenStack creation happens once, with fact setting
happening on all nodes.

Change-Id: Iddd4afebb491dcf9f78f13b7ad96574f8a68e074
2018-09-28 20:30:26 -04:00

53 lines
2.0 KiB
YAML

---
# Copyright 2016, Rackspace US, Inc.
#
# 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.
# We set the python interpreter to the ansible runtime venv if
# the delegation is to localhost so that we get access to the
# appropriate python libraries in that venv. If the delegation
# is to another host, we assume that it is accessible by the
# system python instead.
- name: Setup the octavia flavor
delegate_to: "{{ octavia_service_setup_host }}"
vars:
ansible_python_interpreter: >-
{{ (octavia_service_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_python['executable']) }}
block:
- name: Create Octavia Flavor
run_once: true
os_nova_flavor:
auth:
auth_url: "{{ keystone_service_adminurl }}"
username: "{{ octavia_service_user_name }}"
password: "{{ octavia_service_password }}"
project_name: "{{ octavia_service_project_name }}"
user_domain_name: "{{ octavia_service_user_domain_id }}"
project_domain_name: "{{ octavia_service_project_domain_id }}"
state: present
name: "{{ octavia_amp_flavor_name }}"
ram: "{{ octavia_amp_ram }}"
vcpus: "{{ octavia_amp_vcpu }}"
disk: "{{ octavia_amp_disk }}"
is_public: False
interface: admin
verify: "{{ not keystone_service_adminuri_insecure }}"
register: add_flavor
until: add_flavor is success
retries: 5
delay: 10
- name: Set Octavia Flavor UUID fact 1
set_fact:
octavia_nova_flavor_uuid: "{{ add_flavor.flavor.id }}"