| --- |
| # ============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========================================================= |
| |
| # NOTE (fdegir): if the same machine/jumphost used for online and offline |
| # deployments, the leftover pip config folder from offline deployments |
| # cause issues for online ones so we remove it here |
| - name: Delete outdated pip config directory |
| file: |
| path: "{{ ansible_env.HOME }}/.pip/" |
| state: absent |
| with_items: |
| - absent |
| when: execution_mode == "online-deployment" |
| |
| # NOTE (fdegir): this block is taken out from provision-engine-services |
| # in order to make it agnostic to provisioner |
| - block: |
| - name: Get IP of the jumphost from PDF |
| set_fact: |
| jumphost_ip: "{{ jumphost.interfaces[idf.net_config[engine.public_network | default('public')].interface].address }}" |
| delegate_to: localhost |
| |
| - name: Update /etc/hosts with server FQDN |
| blockinfile: |
| path: /etc/hosts |
| block: | |
| {{ jumphost_ip }} {{ server_fqdn }} |
| marker: "# {mark} Ansible managed {{ server_fqdn }}" |
| when: execution_mode == "offline-deployment" |
| |
| # vim: set ts=2 sw=2 expandtab: |