Add support for Bare Metal Provisioning (BMP) of Dell switches via seed

We extend the configuration of the Bifrost dnsmasq server on the seed to
support Bare Metal Provisioning of Dell switches.
This commit is contained in:
Mark Goddard 2017-03-23 11:45:47 +00:00
parent ff7c40d3b5
commit 20fdea4bde
8 changed files with 116 additions and 1 deletions

View File

@ -0,0 +1,11 @@
---
# This playbook will configure a Bare Metal Provisioning (BMP) environment for
# Dell switches on the seed node so that they can be network booted.
- name: Ensure that a Bare Metal Provisioning (BMP) environment is configured for Dell switches on the seed
hosts: seed
roles:
- role: dell-switch-bmp
# This is the Nginx web server on the seed node.
dell_switch_bmp_http_base_url: "http://{{ provision_oc_net_name | net_ip }}:8080"
when: "{{ dell_switch_bmp_images }}"

View File

@ -0,0 +1,10 @@
---
# Dell Switch Bare Metal Provisioning (BMP) configuration.
# List of images to provide a BMP configuration for.
# Each item should be a dict with the following keys:
# url: URL of the image to download.
# dest: Name of the file to download the image to.
# match: dnsmasq match rule to match hosts against.
# tag: dnsmasq tag to apply to matching hosts.
dell_switch_bmp_images: []

View File

@ -0,0 +1,16 @@
---
# List of images to provide a BMP configuration for.
# Each item should be a dict with the following keys:
# url: URL of the image to download.
# dest: Name of the file to download the image to.
# match: dnsmasq match rule to match hosts against.
# tag: dnsmasq tag to apply to matching hosts.
# checksum: optional checksum of image, in format required for Ansible's
# get_url module.
dell_switch_bmp_images: []
# Base URL of HTTP server.
dell_switch_bmp_http_base_url:
# Path to HTTP server base directory.
dell_switch_bmp_httpboot_path: "/httpboot"

View File

@ -0,0 +1,28 @@
---
- name: Copy dnsmasq configuration
command: >
docker exec bifrost_deploy
bash -c 'source /bifrost/env-vars &&
ansible -vvvv target -i /bifrost/playbooks/inventory/target
-m copy
-a "src=/etc/bifrost/dell-switch-bmp.conf dest=/etc/dnsmasq.d/dell-switch-bmp.conf"
-e "ansible_python_interpreter=/var/lib/kolla/venv/bin/python"'
- name: Restart bifrost dnsmasq
command: >
docker exec bifrost_deploy
bash -c 'source /bifrost/env-vars &&
ansible -vvvv target -i /bifrost/playbooks/inventory/target
-m service
-a "name=dnsmasq state=restarted"
-e "ansible_python_interpreter=/var/lib/kolla/venv/bin/python"'
- name: Copy Dell switch BMP images
command: >
docker exec bifrost_deploy
bash -c 'source /bifrost/env-vars &&
ansible -vvvv target -i /bifrost/playbooks/inventory/target
-m copy
-a "src=/etc/bifrost/{{ item.dest }} dest={{ dell_switch_bmp_httpboot_path }}/{{ item.dest }}"
-e "ansible_python_interpreter=/var/lib/kolla/venv/bin/python"'
with_items: "{{ dell_switch_bmp_images }}"

View File

@ -0,0 +1,22 @@
---
- name: Ensure dnsmasq configuration is present
template:
src: dell-switch-bmp.conf.j2
dest: /etc/kolla/bifrost/dell-switch-bmp.conf
notify:
- Copy dnsmasq configuration
- Restart bifrost dnsmasq
become: True
- name: Ensure Dell BMP installer images are downloaded
get_url:
url: "{{ item.url }}"
dest: "/etc/kolla/bifrost/{{ item.dest }}"
# If no checksum is provided, download images every time to ensure changes
# are pulled.
force: "{{ omit if item.checksum is defined else 'yes' }}"
checksum: "{{ item.checksum | default(omit) }}"
with_items: "{{ dell_switch_bmp_images }}"
notify:
- Copy Dell switch BMP images
become: True

View File

@ -0,0 +1,12 @@
# {{ ansible_managed }}
# This file provides dnsmasq configuration for Dell Switches using Bare Metal
# Provisioning (BMP).
{% for image in dell_switch_bmp_images %}
# Match entry for Dell Switch BMP image {{ image.dest }}.
dhcp-match=set:{{ image.tag }},{{ image.match }}
# Boot entry for Dell Switch BMP image {{ image.dest }}.
dhcp-boot=tag:{{ image.tag }},{{ dell_switch_bmp_http_base_url }}/{{ image.dest | basename }}
{% endfor %}

View File

@ -0,0 +1,14 @@
---
# Dell Switch Bare Metal Provisioning (BMP) configuration.
# List of images to provide a BMP configuration for.
# Each item should be a dict with the following keys:
# url: URL of the image to download.
# dest: Name of the file to download the image to.
# match: dnsmasq match rule to match hosts against.
# tag: dnsmasq tag to apply to matching hosts.
#dell_switch_bmp_images:
###############################################################################
# Dummy variable to allow Ansible to accept this file.
workaround_ansible_issue_8743: yes

View File

@ -193,7 +193,9 @@ class SeedServiceDeploy(KollaAnsibleMixin, KayobeAnsibleMixin, Command):
self.app.LOG.debug("Deploying seed services") self.app.LOG.debug("Deploying seed services")
ansible.run_playbook(parsed_args, "ansible/kolla-bifrost.yml") ansible.run_playbook(parsed_args, "ansible/kolla-bifrost.yml")
kolla_ansible.run_seed(parsed_args, "deploy-bifrost") kolla_ansible.run_seed(parsed_args, "deploy-bifrost")
ansible.run_playbook(parsed_args, "ansible/seed-introspection-rules.yml") playbooks = _build_playbook_list(
"seed-introspection-rules", "dell-switch-bmp")
ansible.run_playbooks(parsed_args, playbooks)
class SeedContainerImageBuild(KayobeAnsibleMixin, Command): class SeedContainerImageBuild(KayobeAnsibleMixin, Command):