80 lines
2.5 KiB
YAML
80 lines
2.5 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: Add CellController internalapi to control plan controller
|
|
become: true
|
|
lineinfile:
|
|
dest: "/etc/hosts"
|
|
regexp: ".*{{ hostvars[item]['internal_api_hostname'] }}.*$"
|
|
line: >-
|
|
{{ hostvars[item]['internal_api_ip'] }}
|
|
{{ hostvars[item]['internal_api_hostname'] }}
|
|
{{ hostvars[item]['internal_api_hostname'].split('.')[:2] | join('.') }}
|
|
insertafter: "# HEAT_HOSTS_END"
|
|
state: present
|
|
when:
|
|
- hostvars[item]['internal_api_ip'] is defined
|
|
- hostvars[item]['internal_api_hostname'] is defined
|
|
with_items: "{{ tripleo_cellv2_cellcontroller_group }}"
|
|
register: hosts_result
|
|
tags:
|
|
- hosts
|
|
- create
|
|
|
|
- name: Add Cell internalapi VIP to control plan controller
|
|
become: true
|
|
vars:
|
|
cell_domain_name: >-
|
|
{{ hostvars[item]['internal_api_hostname'] | regex_replace(item ~ '\.?', '') }}
|
|
lineinfile:
|
|
dest: "/etc/hosts"
|
|
regexp: "\\s*{{ tripleo_cellv2_cell_name }}\\.?{{ cell_domain_name }}.*$"
|
|
line: >-
|
|
{{ hostvars[item]['internal_api_vip'] }}
|
|
{{ cell_domain_name | ternary(tripleo_cellv2_cell_name ~ '.' ~ cell_domain_name, tripleo_cellv2_cell_name) }}
|
|
insertafter: "# HEAT_HOSTS_END"
|
|
state: present
|
|
when:
|
|
- hostvars[item]['internal_api_vip'] is defined
|
|
- hostvars[item]['internal_api_hostname'] is defined
|
|
with_items: "{{ tripleo_cellv2_cellcontroller_group }}"
|
|
register: hosts_result2
|
|
tags:
|
|
- hosts
|
|
- create
|
|
|
|
- name: Restart nova services
|
|
become: true
|
|
block:
|
|
- name: nova restart podman
|
|
systemd:
|
|
name: "{{ item }}"
|
|
state: restarted
|
|
with_items:
|
|
- tripleo_nova_api
|
|
- tripleo_nova_conductor
|
|
- tripleo_nova_scheduler
|
|
when: tripleo_cellv2_containercli == "podman"
|
|
|
|
- name: nova restart docker
|
|
command: docker restart nova_api nova_scheduler nova_conductor
|
|
when: tripleo_cellv2_containercli == "docker"
|
|
when:
|
|
- hosts_result.changed or hosts_result2.changed
|
|
tags:
|
|
- hosts
|
|
- create
|