Add initial dynamic deployment role
Addition of a basic role to support dynamic deployment from an inventory as opposed to a CSV file. This contains an additional conceptual feature of allowing a user to override the default instance_info by defining it as a variable. Updated test-bifrost-dynamic.yaml to incorporate the dynamic deployment role. Change-Id: I5e95c4963b3deff74243126385713ac678f38759
This commit is contained in:
parent
0b82a03408
commit
2d8127aa17
63
playbooks/roles/bifrost-deploy-nodes-dynamic/README.md
Normal file
63
playbooks/roles/bifrost-deploy-nodes-dynamic/README.md
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
bifrost-deploy-nodes-dynamic
|
||||||
|
============================
|
||||||
|
|
||||||
|
Provisions nodes based on inventory utilizing the os_ironic_node module installed by Bifrost.
|
||||||
|
|
||||||
|
Requirements
|
||||||
|
------------
|
||||||
|
|
||||||
|
This role is expected to be executed on a node that the "ironic-install" node has been executed upon.
|
||||||
|
|
||||||
|
This role expects to be executed in a sequence with bifrost-configdrives-dynamic, however that is un-necessary IF the host has a dictionary named instance_info defined as that will be used as overriding values.
|
||||||
|
|
||||||
|
Role Variables
|
||||||
|
--------------
|
||||||
|
|
||||||
|
ironic_url: This is the URL to the ironic server. By default, this is set to "http://localhost:6385/"
|
||||||
|
|
||||||
|
network_interface: This is the network interface that the nodes receive DHCP/PXE/iPXE. This is utilized to generate the url that Ironic is configured with for image retrieval. This variable does not have a default in this role and expects to receive this information from the calling playbook.
|
||||||
|
|
||||||
|
deploy_image_filename: This is the filename of the image to deploy, which is combined with the network_interface variable to generate a URL used to set the Ironic instance image_source. This variable does not have a default in this role and expects to receive this information from the calling playbook.
|
||||||
|
|
||||||
|
deploy_image: This is the full path to the image to be deployed to the system. This is as Ironic requires the MD5 hash of the file to be deployed for validation during the deployment process. As a result of this requirement, the hash is automatically collected and submitted to Ironic with the node deployment request. This variable does not have a default in this role and expects to receive this information from the calling playbook.
|
||||||
|
|
||||||
|
instance_info: A dictionary containing the information to define an instance. By default, this is NOT expected to be defined, however if defined it is passed in whole to the deployment step. This value will override deploy_image_filename, deploy_image, and network_interface variables. Key-value pairs that are generally expected are image_source, image_checksum, root_gb, however any supported key/value can be submitted to the API.
|
||||||
|
|
||||||
|
Dependencies
|
||||||
|
------------
|
||||||
|
|
||||||
|
This role is intended to be executed upon a node that the ironic-install role has been executed upon. The configuration that is leveraged by this role utilizes a configuration drive to place network configuration and an SSH key on the newly deployed host. As such, the bifrost-configdrives role is required.
|
||||||
|
|
||||||
|
Example Playbook
|
||||||
|
----------------
|
||||||
|
|
||||||
|
NOTE: The example below assumes bifrost's default and that an instance_info variable is not defined.
|
||||||
|
|
||||||
|
- hosts: baremetal
|
||||||
|
connection: local
|
||||||
|
sudo: no
|
||||||
|
roles:
|
||||||
|
- role: bifrost-configdrives
|
||||||
|
- role: bifrost-setup-nodes
|
||||||
|
|
||||||
|
License
|
||||||
|
-------
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
Author Information
|
||||||
|
------------------
|
||||||
|
|
||||||
|
Ironic Developers
|
@ -0,0 +1,4 @@
|
|||||||
|
---
|
||||||
|
# defaults file for bifrost-deploy-nodes-dynamic
|
||||||
|
ironic_url: "http://localhost:6385/"
|
||||||
|
nginx_port: 8080
|
@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
# handlers file for bifrost-deploy-nodes-dynamic
|
117
playbooks/roles/bifrost-deploy-nodes-dynamic/meta/main.yml
Normal file
117
playbooks/roles/bifrost-deploy-nodes-dynamic/meta/main.yml
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
---
|
||||||
|
galaxy_info:
|
||||||
|
author: Ironic Developers
|
||||||
|
description: Deploys the image on to nodes in Ironic
|
||||||
|
company: OpenStack
|
||||||
|
license: Apache
|
||||||
|
min_ansible_version: 1.9
|
||||||
|
#
|
||||||
|
# Below are all platforms currently available. Just uncomment
|
||||||
|
# the ones that apply to your role. If you don't see your
|
||||||
|
# platform on this list, let us know and we'll get it added!
|
||||||
|
#
|
||||||
|
platforms:
|
||||||
|
#- name: EL
|
||||||
|
# versions:
|
||||||
|
# - all
|
||||||
|
# - 5
|
||||||
|
# - 6
|
||||||
|
# - 7
|
||||||
|
#- name: GenericUNIX
|
||||||
|
# versions:
|
||||||
|
# - all
|
||||||
|
# - any
|
||||||
|
#- name: Fedora
|
||||||
|
# versions:
|
||||||
|
# - all
|
||||||
|
# - 16
|
||||||
|
# - 17
|
||||||
|
# - 18
|
||||||
|
# - 19
|
||||||
|
# - 20
|
||||||
|
#- name: SmartOS
|
||||||
|
# versions:
|
||||||
|
# - all
|
||||||
|
# - any
|
||||||
|
#- name: opensuse
|
||||||
|
# versions:
|
||||||
|
# - all
|
||||||
|
# - 12.1
|
||||||
|
# - 12.2
|
||||||
|
# - 12.3
|
||||||
|
# - 13.1
|
||||||
|
# - 13.2
|
||||||
|
#- name: Amazon
|
||||||
|
# versions:
|
||||||
|
# - all
|
||||||
|
# - 2013.03
|
||||||
|
# - 2013.09
|
||||||
|
#- name: GenericBSD
|
||||||
|
# versions:
|
||||||
|
# - all
|
||||||
|
# - any
|
||||||
|
#- name: FreeBSD
|
||||||
|
# versions:
|
||||||
|
# - all
|
||||||
|
# - 8.0
|
||||||
|
# - 8.1
|
||||||
|
# - 8.2
|
||||||
|
# - 8.3
|
||||||
|
# - 8.4
|
||||||
|
# - 9.0
|
||||||
|
# - 9.1
|
||||||
|
# - 9.1
|
||||||
|
# - 9.2
|
||||||
|
#- name: Ubuntu
|
||||||
|
# versions:
|
||||||
|
# - all
|
||||||
|
# - lucid
|
||||||
|
# - maverick
|
||||||
|
# - natty
|
||||||
|
# - oneiric
|
||||||
|
# - precise
|
||||||
|
# - quantal
|
||||||
|
# - raring
|
||||||
|
# - saucy
|
||||||
|
- trusty
|
||||||
|
#- name: SLES
|
||||||
|
# versions:
|
||||||
|
# - all
|
||||||
|
# - 10SP3
|
||||||
|
# - 10SP4
|
||||||
|
# - 11
|
||||||
|
# - 11SP1
|
||||||
|
# - 11SP2
|
||||||
|
# - 11SP3
|
||||||
|
#- name: GenericLinux
|
||||||
|
# versions:
|
||||||
|
# - all
|
||||||
|
# - any
|
||||||
|
#- name: Debian
|
||||||
|
# versions:
|
||||||
|
# - all
|
||||||
|
# - etch
|
||||||
|
# - lenny
|
||||||
|
# - squeeze
|
||||||
|
# - wheezy
|
||||||
|
#
|
||||||
|
# Below are all categories currently available. Just as with
|
||||||
|
# the platforms above, uncomment those that apply to your role.
|
||||||
|
#
|
||||||
|
categories:
|
||||||
|
- cloud
|
||||||
|
- cloud:openstack
|
||||||
|
#- cloud:gce
|
||||||
|
#- cloud:rax
|
||||||
|
#- clustering
|
||||||
|
#- database
|
||||||
|
#- database:nosql
|
||||||
|
#- database:sql
|
||||||
|
#- development
|
||||||
|
#- monitoring
|
||||||
|
#- networking
|
||||||
|
#- packaging
|
||||||
|
#- system
|
||||||
|
#- web
|
||||||
|
dependencies:
|
||||||
|
- bifrost-configdrives-dynamic
|
44
playbooks/roles/bifrost-deploy-nodes-dynamic/tasks/main.yml
Normal file
44
playbooks/roles/bifrost-deploy-nodes-dynamic/tasks/main.yml
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
# 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: "Deploy to Hardware - Using custom instance_info."
|
||||||
|
os_ironic_node:
|
||||||
|
auth_type: None
|
||||||
|
auth: None
|
||||||
|
ironic_url: "{{ ironic_url }}"
|
||||||
|
uuid: "{{ uuid }}"
|
||||||
|
state: present
|
||||||
|
config_drive: "http://{{ hostvars[inventory_hostname]['ansible_' + network_interface]['ipv4']['address'] }}:{{ nginx_port }}/configdrive-{{ uuid }}.iso.gz"
|
||||||
|
instance_info: "{{ instance_info }}"
|
||||||
|
delegate_to: localhost
|
||||||
|
when: instance_info is defined
|
||||||
|
- name: "Collect the checksum of the deployment image."
|
||||||
|
local_action: stat path={{deploy_image}}
|
||||||
|
register: test_deploy_image
|
||||||
|
when: instance_info is not defined
|
||||||
|
- name: "Deploy to Hardware - Bifrost Default"
|
||||||
|
os_ironic_node:
|
||||||
|
auth_type: None
|
||||||
|
auth: None
|
||||||
|
ironic_url: "{{ ironic_url }}"
|
||||||
|
uuid: "{{ uuid }}"
|
||||||
|
state: present
|
||||||
|
config_drive: "http://{{ hostvars[inventory_hostname]['ansible_' + network_interface]['ipv4']['address'] }}:{{ nginx_port }/configdrive-{{ uuid }}.iso.gz"
|
||||||
|
instance_info:
|
||||||
|
image_source: "http://{{ hostvars[inventory_hostname]['ansible_' + network_interface]['ipv4']['address'] }}:{{ nginx_port }}/{{deploy_image_filename}}"
|
||||||
|
image_checksum: "{{ test_deploy_image.stat.md5 }}"
|
||||||
|
image_disk_format: "raw"
|
||||||
|
root_gb: 10
|
||||||
|
delegate_to: localhost
|
||||||
|
when: instance_info is not defined
|
@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
# vars file for bifrost-deploy-nodes-dynamic
|
@ -43,18 +43,18 @@
|
|||||||
roles:
|
roles:
|
||||||
- role: bifrost-validate-host-for-deploy
|
- role: bifrost-validate-host-for-deploy
|
||||||
- hosts: baremetal
|
- hosts: baremetal
|
||||||
name: "Creat configuration drives."
|
name: "Creat configuration drive files and deploy machines."
|
||||||
sudo: no
|
sudo: no
|
||||||
connection: local
|
connection: local
|
||||||
roles:
|
roles:
|
||||||
- role: bifrost-configdrives-dynamic
|
- role: bifrost-configdrives-dynamic
|
||||||
|
- role: bifrost-deploy-nodes-dynamic
|
||||||
- hosts: localhost
|
- hosts: localhost
|
||||||
connection: local
|
connection: local
|
||||||
name: "Executes install, enrollment, and testing in one playbook"
|
name: "Executes install, enrollment, and testing in one playbook"
|
||||||
sudo: no
|
sudo: no
|
||||||
gather_facts: yes
|
gather_facts: yes
|
||||||
roles:
|
roles:
|
||||||
- role: bifrost-setup-nodes
|
|
||||||
- role: bifrost-prepare-for-test
|
- role: bifrost-prepare-for-test
|
||||||
# The testvm Host group is added by bifrost-prepare-for-test based
|
# The testvm Host group is added by bifrost-prepare-for-test based
|
||||||
# on the contents of the CSV file.
|
# on the contents of the CSV file.
|
||||||
|
Loading…
Reference in New Issue
Block a user