| --- |
| # ============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========================================================= |
| |
| - include_tasks: cleanup-bifrost.yml |
| |
| - name: Clone bifrost repository and checkout '{{ bifrost_version }}' |
| git: |
| repo: "{{ bifrost_git_url }}" |
| dest: "{{ engine_cache }}/repos/bifrost" |
| version: "{{ bifrost_version }}" |
| force: true |
| environment: |
| http_proxy: "{{ lookup('env','http_proxy') }}" |
| https_proxy: "{{ lookup('env','https_proxy') }}" |
| no_proxy: "{{ lookup('env','no_proxy') }}" |
| when: execution_mode == 'online-deployment' |
| |
| - name: Install bifrost requirements |
| pip: |
| requirements: "{{ engine_cache }}/repos/bifrost/requirements.txt" |
| extra_args: --upgrade |
| virtualenv: "{{ engine_venv }}" |
| |
| - name: Process PDF and IDF |
| set_fact: |
| num_nodes: "{{ nodes | length }}" |
| hosts: "{{ idf[installer_type].hostnames }}" |
| host_roles: "{{ idf[installer_type].nodes_roles }}" |
| bifrost_inventory: {} |
| |
| - name: Create DHCP hosts directory |
| file: |
| path: "/etc/dnsmasq.d/bifrost.dhcp-hosts.d" |
| state: directory |
| owner: "root" |
| group: "root" |
| mode: 0755 |
| become: true |
| |
| - include_tasks: create-bifrost-inventory-entry.yml |
| with_dict: "{{ hosts }}" |
| loop_control: |
| loop_var: host |
| |
| - include_tasks: create-bifrost-inventory-file.yml |
| |
| - include_tasks: create-bifrost-playbooks.yml |
| |
| - include_tasks: configure-bifrost-offline.yml |
| when: execution_mode == 'offline-deployment' |
| |
| - name: Create folder to override Bifrost dependencies |
| file: |
| path: "{{ engine_cache }}/repos/bifrost/playbooks/roles/bifrost-prep-for-install/vars" |
| state: "{{ item }}" |
| with_items: |
| - absent |
| - directory |
| |
| - name: Create Bifrost dependencies file to set git repos and pinned versions |
| template: |
| src: "bifrost-dependencies.yaml.j2" |
| dest: "{{ engine_cache }}/repos/bifrost/playbooks/roles/bifrost-prep-for-install/vars/main.yml" |
| |
| - name: Create folders to put ipa and deployment images |
| file: |
| path: "{{ item }}" |
| state: directory |
| owner: root |
| group: root |
| mode: 0755 |
| with_items: |
| - /httpboot |
| - /tftpboot |
| become: true |
| |
| # we want users to use prebuilt ipa images but not deployment images |
| # as the deployment images contain ssh public key of the user so we |
| # download ipa images by default and not the deployment image |
| - include_tasks: download-image.yml |
| with_items: |
| - {source: "{{ deployment_image }}", destination: "/httpboot/deployment_image.qcow2", download: "{{ use_prebuilt_deployment_image }}"} |
| - {source: "{{ ipa_initramfs }}", destination: "/httpboot/ipa.initramfs", download: "true"} |
| - {source: "{{ ipa_kernel }}", destination: "/httpboot/ipa.kernel", download: "true"} |
| when: execution_mode == 'online-deployment' |
| |
| # vim: set ts=2 sw=2 expandtab: |