blob: 9fc89aa341bf548466e5b19a96b6a0e7b04b3dda [file] [log] [blame]
---
# ============LICENSE_START=======================================================
# Copyright (C) 2019 The Nordix Foundation. 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.
#
# SPDX-License-Identifier: Apache-2.0
# ============LICENSE_END=========================================================
- name: Wait for target hosts to be reachable via SSH
wait_for:
host: "{{ ansible_default_ipv4.address }}"
port: 22
state: started
delay: 15
connect_timeout: 10
timeout: 1000
delegate_to: jumphost
# we need the private/internal IP of the jumphost so the nodes could reach to it
- name: Get private IP of jumphost from openstack stack output
command: "openstack stack output show {{ heat_stack_name }} jumphost_private_ip -c output_value -f json"
register: stack_output
changed_when: false
until: "'output_value' in stack_output.stdout"
retries: 10
delay: 3
environment:
PATH: "{{ engine_venv }}/bin"
delegate_to: localhost
run_once: true
- name: Set private IP of jumphost
set_fact:
jumphost_private_ip: "{{ stack_output.stdout }}"
- name: Log jumphost private IP to console
debug:
msg: "Jumphost internal IP is {{ jumphost_private_ip.output_value[0] }}"
delegate_to: localhost
run_once: true
- name: Update /etc/hosts with server FQDN
blockinfile:
path: /etc/hosts
block: |
# private IP of jumphost
{{ jumphost_private_ip.output_value[0] }} {{ server_fqdn }}
marker: "# {mark} Ansible managed"
# NOTE (fdegir): apt sources.list is only updated for offline deployments
# NOTE (fdegir): apt sources.list is only updated for offline deployments
- name: Update /etc/apt/sources.list to use local apt repository
template:
src: sources.list.j2
dest: /etc/apt/sources.list
owner: root
group: root
mode: '0644'
backup: true
when: execution_mode == "offline-deployment"
# vim: set ts=2 sw=2 expandtab: