bifrost/playbooks/roles/bifrost-configdrives-dynamic/tasks/main.yml
Julia Kreger edd5b67afc Switch to simple-init for network configuration
Bifrost defining and attempting to bake in configuration files
into configuration drives to allow initial configuration of
connectivity is a crazy idea.

Since the Openstack-infra folks have glean and simple-init, we
will utilize their tooling to provide greater flexibility across
operating systems.

Additionally, the ability to write out a simple debian style
interfaces config file has been retained, however off by default
as it is necessary for cirros testing.  In addition to this, the
ability for inventory based data to override the contents of the
network_info.json file.

Change-Id: Id85b18277b4d78acf418f63f046e39e889590719
Closes-Bug: 1463191
2015-07-14 08:31:34 -04:00

49 lines
3.0 KiB
YAML

# Copyright (c) 2015 Hewlett-Packard Development Company, L.P.
#
# 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: "Identify ssh_public_key if ssh_public_key_path is defined"
include: ssh_public_key_path.yaml
when: ssh_public_key is undefined and ssh_public_key_path is defined
- name: "Name Make Temporary folder to build configdrive"
local_action: command mktemp -d
register: variable_configdrive_location
- name: "Make Metadata folder - /openstack/{{ metaata_version }}"
local_action: file state=directory name={{ variable_configdrive_location.stdout }}/{{ uuid }}/openstack/{{ metadata_version }}/
- name: "Make Metadata folder - /openstack/latest"
local_action: file state=directory name={{ variable_configdrive_location.stdout }}/{{ uuid }}/openstack/latest/
- name: "Place template in each openstack/{{ metadata_version }} folder"
local_action: template src=openstack_meta_data.json.j2 dest={{ variable_configdrive_location.stdout }}/{{ uuid }}/openstack/{{ metadata_version }}/meta_data.json
- name: "Place template in each openstack/latest folder"
local_action: template src=openstack_meta_data.json.j2 dest={{ variable_configdrive_location.stdout }}/{{ uuid }}/openstack/latest/meta_data.json
- name: "Place network info template in each openstack/latest folder"
local_action: template src=network_info.json.j2 dest={{ variable_configdrive_location.stdout }}/{{ uuid }}/openstack/latest/network_info.json
when: addressing_mode is undefined and '"dhcp" not in addressing_mode'
- name: "Make Metadata folder - /openstack/latest"
local_action: file state=directory name={{ variable_configdrive_location.stdout }}/{{ uuid }}/openstack/content/
- name: "Write network Debian style interface template"
local_action: template src=interfaces.j2 dest={{ variable_configdrive_location.stdout }}/{{ uuid }}/openstack/content/0000
when: write_interfaces_file | bool
- name: "Make config drive files"
sudo: yes
local_action: command mkisofs -R -V config-2 -o {{http_boot_folder}}/configdrive-{{ uuid }}.iso {{ variable_configdrive_location.stdout }}/{{ uuid }}
- name: "Make config drive files base64 encoded and gzip compressed"
sudo: yes
local_action: shell gzip -c {{http_boot_folder}}/configdrive-{{ uuid }}.iso | base64 > {{http_boot_folder}}/configdrive-{{ uuid }}.iso.gz
- name: "Cleanup configdrive .iso files"
sudo: yes
local_action: file state=absent name={{http_boot_folder}}/configdrive-{{ uuid }}.iso
- name: "Cleanup configdrive temp folder"
sudo: yes
local_action: file state=absent force=yes name={{ variable_configdrive_location.stdout }}