diff options
author | 2018-03-15 16:51:37 +0000 | |
---|---|---|
committer | 2018-03-20 08:45:22 +0000 | |
commit | 77ab4eeda0f42616c63fa3d3baef9063a1e5741e (patch) | |
tree | d7049fa3815d463d06a3a38016137e9884373416 /xci/infra/bifrost/playbooks | |
parent | c5d83347c1550efe2e7eb4e114ac2fc0a18f6e6a (diff) |
Add initial support for multiple infra deployers
bifrost is currently the only way to deploy the infrastructure but
in the future other solutions will be added so we need to do some
preparation for XCI integration.
Change-Id: I961dd42157c924d88747074ddba6a318f8b537ac
Signed-off-by: Markos Chandras <mchandras@suse.de>
Diffstat (limited to 'xci/infra/bifrost/playbooks')
-rw-r--r-- | xci/infra/bifrost/playbooks/bootstrap-bifrost.yml | 42 | ||||
-rw-r--r-- | xci/infra/bifrost/playbooks/opnfv-virtual.yaml | 123 |
2 files changed, 165 insertions, 0 deletions
diff --git a/xci/infra/bifrost/playbooks/bootstrap-bifrost.yml b/xci/infra/bifrost/playbooks/bootstrap-bifrost.yml new file mode 100644 index 00000000..23eb976c --- /dev/null +++ b/xci/infra/bifrost/playbooks/bootstrap-bifrost.yml @@ -0,0 +1,42 @@ +--- +# SPDX-license-identifier: Apache-2.0 +############################################################################## +# Copyright (c) 2017 Ericsson AB and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## +- hosts: localhost + connection: local + gather_facts: true + vars_files: + - "{{ XCI_PATH }}/xci/var/opnfv.yml" + pre_tasks: + - name: Load distribution variables + include_vars: + file: "{{ XCI_PATH }}/xci/var/{{ ansible_os_family }}.yml" + roles: + - role: clone-repository + project: "opnfv/bifrost" + repo: "{{ OPENSTACK_BIFROST_GIT_URL }}" + dest: "{{ XCI_CACHE }}/repos/bifrost" + version: "{{ OPENSTACK_BIFROST_VERSION }}" + + tasks: + - name: Load distribution variables + include_vars: + file: "{{ XCI_PATH }}/xci/var/{{ ansible_os_family }}.yml" + - name: Synchronize local development bifrost repository to XCI paths + # command module is much faster than the copy module + synchronize: + src: "{{ OPENSTACK_BIFROST_DEV_PATH }}" + dest: "{{ XCI_CACHE }}/repos/bifrost" + recursive: yes + delete: yes + when: + - OPENSTACK_BIFROST_DEV_PATH != "" + - name: combine opnfv/releng-xci and openstack/bifrost scripts/playbooks + copy: + src: "{{ XCI_PATH}}/xci/infra/bifrost/" + dest: "{{ XCI_CACHE }}/repos/bifrost" diff --git a/xci/infra/bifrost/playbooks/opnfv-virtual.yaml b/xci/infra/bifrost/playbooks/opnfv-virtual.yaml new file mode 100644 index 00000000..f44adb4d --- /dev/null +++ b/xci/infra/bifrost/playbooks/opnfv-virtual.yaml @@ -0,0 +1,123 @@ +# SPDX-license-identifier: Apache-2.0 +############################################################################## +# Copyright (c) 2016 RedHat and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## +--- +- hosts: localhost + connection: local + name: "Host and Ironic bootstrapping" + become: yes + gather_facts: yes + pre_tasks: + - name: Remove pre-existing leases file + file: path=/var/lib/misc/dnsmasq.leases state=absent + - name: "Override the ipv4_gateway setting" + set_fact: + ipv4_gateway: "192.168.122.1" + - name: Prepare the XCI pre-built images + block: + - name: Create the PXE directory + file: + path: /httpboot + state: directory + - name: Download the {{ xci_distro }} image checksum file + get_url: + dest: /httpboot/deployment_image.qcow2.sha256.txt + force: no + url: http://artifacts.opnfv.org/releng/xci/images/{{ xci_distro }}.qcow2.sha256.txt + timeout: 3000 + - name: Extract checksum + shell: awk '{print $1}' /httpboot/deployment_image.qcow2.sha256.txt + register: _image_checksum + - fail: + msg: "Failed to get image checksum" + when: _image_checksum == '' + - set_fact: + image_checksum: "{{ _image_checksum.stdout }}" + - name: Download the {{ xci_distro }} image file + get_url: + url: http://artifacts.opnfv.org/releng/xci/images/{{ xci_distro }}.qcow2 + checksum: "sha256:{{ image_checksum }}" + timeout: 3000 + dest: /httpboot/deployment_image.qcow2 + force: no + - name: Set correct mode for {{ xci_distro }}.qcow2 file + file: + path: /httpboot/deployment_image.qcow2 + mode: '0755' + owner: 'root' + group: 'root' + when: use_prebuilt_images | bool == true + + roles: + - role: bifrost-prep-for-install + when: skip_install is not defined + - role: bifrost-keystone-install + - role: bifrost-ironic-install + cleaning: false + testing: true + # NOTE(TheJulia): While the next step creates a ramdisk, some elements + # do not support ramdisk-image-create as they invoke steps to cleanup + # the ramdisk which causes ramdisk-image-create to believe it failed. + - role: bifrost-create-dib-image + dib_imagename: "{{ http_boot_folder }}/ipa" + build_ramdisk: false + dib_os_element: "{{ ipa_dib_os_element|default('debian') }}" + dib_os_release: "jessie" + dib_elements: "ironic-agent {{ ipa_extra_dib_elements | default('') }}" + dib_notmpfs: true + when: + - create_ipa_image | bool == true + - not use_prebuilt_images | bool == false + - role: bifrost-create-dib-image + dib_imagetype: "qcow2" + dib_imagename: "{{deploy_image}}" + dib_env_vars: + DIB_PYTHON_VERSION: 2 + dib_os_element: "{{ lookup('env','DIB_OS_ELEMENT') }}" + dib_os_release: "{{ lookup('env', 'DIB_OS_RELEASE') }}" + extra_dib_elements: "{{ lookup('env', 'EXTRA_DIB_ELEMENTS') | default('') }}" + dib_elements: "vm enable-serial-console simple-init devuser openssh-server growroot pip-and-virtualenv {{ extra_dib_elements }}" + dib_packages: "{{ lookup('env', 'DIB_OS_PACKAGES') }}" + dib_notmpfs: true + when: + - create_image_via_dib | bool == true + - transform_boot_image | bool == false + - use_prebuilt_images | bool == false + - role: bifrost-keystone-client-config + user: "{{ ansible_env.SUDO_USER }}" + clouds: + bifrost: + config_username: "{{ ironic.keystone.default_username }}" + config_password: "{{ ironic.keystone.default_password }}" + config_project_name: "baremetal" + config_region_name: "{{ keystone.bootstrap.region_name }}" + config_auth_url: "{{ keystone.bootstrap.public_url }}" + environment: + http_proxy: "{{ lookup('env','http_proxy') }}" + https_proxy: "{{ lookup('env','https_proxy') }}" + +- hosts: baremetal + name: "Enrollment and Deployment" + vars: + multinode_testing: "{{ inventory_dhcp | bool == true }}" + become: no + connection: local + gather_facts: yes + roles: + - role: ironic-enroll-dynamic + - { role: ironic-inspect-node, when: inspect_nodes | default('false') | bool == true } + - role: bifrost-configdrives-dynamic + - role: bifrost-deploy-nodes-dynamic + +- hosts: baremetal + name: "Deploy machines." + become: no + connection: local + serial: 1 + roles: + - role: bifrost-prepare-for-test-dynamic |