Blind stab at breaking things into more roles

This commit is contained in:
Monty Taylor 2015-03-12 17:07:46 -04:00
parent e56fe3708b
commit 046066e3c7
50 changed files with 775 additions and 80 deletions

View File

@ -35,7 +35,6 @@ Edit ./inventory/group_vars/all.yaml to match your environment.
Then run::
cd install
bash ./env-setup.sh
source /opt/stack/ansible/hacking/env-setup
cd ..
@ -62,7 +61,7 @@ restarted.
Run::
ansible-playbook -vvvv -i inventory/localhost install/install.yaml
ansible-playbook -vvvv -i inventory/localhost install.yaml
Manual CLI Use
@ -74,7 +73,7 @@ environment variables:
- IRONIC_URL - A URL to the Ironic API, such as http://localhost:6385/
- OS_AUTH_TOKEN - Any value, such as an empty space, is required to cause the client library to send requests directly to the API.
For your ease of use, install/env-vars can be sourced to allow the CLI to connect
For your ease of use, `env-vars` can be sourced to allow the CLI to connect
to a local Ironic installation operating in noauth mode.
@ -129,7 +128,7 @@ consumed and loaded into ironic.
Example::
ansible-playbook -i inventory/localhost -vvvv enroll/enroll.yaml -e baremetal_csv_file=inventory/baremetal.csv
ansible-playbook -i inventory/localhost -vvvv enroll.yaml -e baremetal_csv_file=inventory/baremetal.csv
Note that enrollment is a one-time operation. The Ansible module *does not*
synchronize data for existing nodes. You should use the Ironic CLI to do this
@ -154,4 +153,4 @@ drive and are statically assigned.
Example::
ansible-playbook -i inventory/localhost -vvvv deploy/deploy.yaml -e baremetal_csv_file=inventory/baremetal.csv
ansible-playbook -i inventory/localhost -vvvv deploy.yaml -e baremetal_csv_file=inventory/baremetal.csv

15
deploy.yml Normal file
View File

@ -0,0 +1,15 @@
---
- hosts: localhost
connection: local
name: "Enroll hardware from baremetal.csv into Ironic"
sudo: yes
gather_facts: yes
pre-tasks:
- name: "Error if variable baremetal_csv_file is not defined"
local_action: fail msg="baremetal_csv_file must be defined for this playbook to execute, please pass option '-e baremetal_csv_file=<path/to/file>'"
when: baremetal_csv_file is not defined
roles:
- role: ironic-deploy
baremetal_csv_file: "{{ baremetal_csv_file }}"
- role: bifrost-configdrives
- role: bifrost-setup-nodes

View File

@ -1,48 +0,0 @@
---
- hosts: localhost
connection: local
name: "Enroll hardware from baremetal.csv into Ironic"
sudo: yes
gather_facts: yes
# Todo: Rip vars out, refactor.
tasks:
- name: "Error if variable baremetal_csv_file is not defined"
local_action: fail msg="baremetal_csv_file must be defined for this playbook to execute, please pass option '-e baremetal_csv_file=<path/to/file>'"
when: baremetal_csv_file is not defined
- name: "Validate that CSV file exists"
local_action: stat path={{ baremetal_csv_file }}
register: test_baremetal_csv_file
- name: "Error if file does not exist."
local_action: fail msg="The variable defined for baremetal_csv_file is not to a file. Please define a file and try again."
when: test_baremetal_csv_file.stat.isreg == false
- name: "Verify CoreOS kernel is present."
local_action: stat path={{ http_boot_folder }}/coreos_production_pxe.vmlinuz
register: test_core_os_kernel_present
- name: "Error if the CoreOS kernel is missing."
local_action: fail msg="CoreOS kernel not found. Consider re-running setup."
when: test_core_os_kernel_present.stat.exists == false
- name: "Verify CoreOS ramdisk is present."
local_action: stat path={{ http_boot_folder }}/coreos_production_pxe_image-oem.cpio.gz
register: test_core_os_image_present
- name: "Error if the CoreOS ramdisk is missing."
local_action: fail msg="CoreOS ramdisk was not found. Consider re-running setup."
when: test_core_os_image_present.stat.exists == false
- name: "Verify that deployment image is present."
local_action: stat path={{deploy_image}}
register: test_deploy_image
# TODO: checksum for the above stat operation will be required for deployment.
- name: "Error if deployment image is missing."
local_action: fail msg="Deployment image is missing. Consider re-running setup."
when: test_deploy_image.stat.exists == false
- name: "Check to see if there is a file where the ssh_key_path is defined"
local_action: stat path={{ ssh_public_key_path }}
register: test_ssh_public_key_path
- name: "Error if ssh_public_key_path is not valid"
local_action: fail msg="ssh_public_key_path is not valid."
when: test_ssh_public_key_path.stat.exists == false
- name: "Read ssh public key in"
local_action: set_fact ssh_public_key="{{ lookup('file', ssh_public_key_path ) }}"
- name: "Create configdrives"
include: configdrive.yaml
- name: "Enroll nodes in Ironic"
include: setup_nodes.yaml

10
enroll.yml Normal file
View File

@ -0,0 +1,10 @@
---
- hosts: localhost
connection: local
name: "Enroll hardware from baremetal.csv into Ironic"
sudo: yes
gather_facts: yes
roles:
- role: ironic-enroll
baremetal_csv_file: "{{ baremetal_csv_file }}"
ipmi_bridging: "{{ ipmi_bridging|default('no') }}"

View File

@ -1,26 +0,0 @@
---
- hosts: localhost
connection: local
name: "Enroll hardware from baremetal.csv into Ironic"
sudo: yes
gather_facts: yes
# Todo: Rip vars out, refactor.
tasks:
- name: "Error if variable baremetal_csv_file is not defined"
local_action: fail msg="baremetal_csv_file must be defined for this playbook to execute, please pass option '-e baremetal_csv_file=<path/to/file>'"
when: baremetal_csv_file is not defined
- name: "Validate that CSV file exists"
local_action: stat path={{ baremetal_csv_file }}
register: test_baremetal_csv_file
- name: "Error if file does not exist."
local_action: fail msg="The variable defined for baremetal_csv_file is not to a file. Please define a file and try again."
when: test_baremetal_csv_file.stat.isreg == false
- name: "If no ipmi_bridging value set, or a value of no exists, execute standard sequence."
include: standard_enroll.yaml
when: ipmi_bridging is not defined or ipmi_bridging == "no"
- name: "If ipmi_bridging is set to single, execute single bridge enrollment sequence.."
include: ipmi_bridging_single_enroll.yaml
when: ipmi_bridging is defined and ipmi_bridging == "single"
- name: "If ipmi_bridging is set to single, execute dual bridge enrollment sequence.."
include: ipmi_bridging_dual_enroll.yaml
when: ipmi_bridging is defined and ipmi_bridging == "dual"

View File

@ -5,4 +5,4 @@
sudo: yes
gather_facts: yes
roles:
- install_standalone_ironic_localhost
- install-ironic

View File

@ -0,0 +1,38 @@
Role Name
=========
A brief description of the role goes here.
Requirements
------------
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
Role Variables
--------------
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
Dependencies
------------
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
Example Playbook
----------------
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
- hosts: servers
roles:
- { role: username.rolename, x: 42 }
License
-------
BSD
Author Information
------------------
An optional section for the role authors to include contact information, or a website (HTML is not allowed).

View File

@ -0,0 +1,2 @@
---
# defaults file for bifrost-configdrives

View File

@ -0,0 +1,2 @@
---
# handlers file for bifrost-configdrives

View File

@ -0,0 +1,128 @@
---
galaxy_info:
author: your name
description:
company: your company (optional)
# Some suggested licenses:
# - BSD (default)
# - MIT
# - GPLv2
# - GPLv3
# - Apache
# - CC-BY
license: license (GPLv2, CC-BY, etc)
min_ansible_version: 1.2
#
# 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:ec2
#- cloud:gce
#- cloud:rax
#- clustering
#- database
#- database:nosql
#- database:sql
#- development
#- monitoring
#- networking
#- packaging
#- system
#- web
dependencies: []
# List your role dependencies here, one per line. Only
# dependencies available via galaxy should be listed here.
# Be sure to remove the '[]' above if you add dependencies
# to this list.

View File

@ -0,0 +1,2 @@
---
# vars file for bifrost-configdrives

View File

@ -0,0 +1,38 @@
Role Name
=========
A brief description of the role goes here.
Requirements
------------
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
Role Variables
--------------
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
Dependencies
------------
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
Example Playbook
----------------
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
- hosts: servers
roles:
- { role: username.rolename, x: 42 }
License
-------
BSD
Author Information
------------------
An optional section for the role authors to include contact information, or a website (HTML is not allowed).

View File

@ -0,0 +1,2 @@
---
# defaults file for bifrost-setup-nodes

View File

@ -0,0 +1,2 @@
---
# handlers file for bifrost-setup-nodes

View File

@ -0,0 +1,128 @@
---
galaxy_info:
author: your name
description:
company: your company (optional)
# Some suggested licenses:
# - BSD (default)
# - MIT
# - GPLv2
# - GPLv3
# - Apache
# - CC-BY
license: license (GPLv2, CC-BY, etc)
min_ansible_version: 1.2
#
# 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:ec2
#- cloud:gce
#- cloud:rax
#- clustering
#- database
#- database:nosql
#- database:sql
#- development
#- monitoring
#- networking
#- packaging
#- system
#- web
dependencies: []
# List your role dependencies here, one per line. Only
# dependencies available via galaxy should be listed here.
# Be sure to remove the '[]' above if you add dependencies
# to this list.

View File

@ -0,0 +1,2 @@
---
# vars file for bifrost-setup-nodes

View File

@ -0,0 +1,38 @@
Role Name
=========
A brief description of the role goes here.
Requirements
------------
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
Role Variables
--------------
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
Dependencies
------------
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
Example Playbook
----------------
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
- hosts: servers
roles:
- { role: username.rolename, x: 42 }
License
-------
BSD
Author Information
------------------
An optional section for the role authors to include contact information, or a website (HTML is not allowed).

View File

@ -0,0 +1,2 @@
---
# defaults file for ironic-deploy

View File

@ -0,0 +1,2 @@
---
# handlers file for ironic-deploy

View File

@ -0,0 +1,128 @@
---
galaxy_info:
author: your name
description:
company: your company (optional)
# Some suggested licenses:
# - BSD (default)
# - MIT
# - GPLv2
# - GPLv3
# - Apache
# - CC-BY
license: license (GPLv2, CC-BY, etc)
min_ansible_version: 1.2
#
# 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:ec2
#- cloud:gce
#- cloud:rax
#- clustering
#- database
#- database:nosql
#- database:sql
#- development
#- monitoring
#- networking
#- packaging
#- system
#- web
dependencies: []
# List your role dependencies here, one per line. Only
# dependencies available via galaxy should be listed here.
# Be sure to remove the '[]' above if you add dependencies
# to this list.

View File

@ -0,0 +1,37 @@
---
- name: "Error if variable baremetal_csv_file is not defined"
local_action: fail msg="baremetal_csv_file must be defined for this playbook to execute, please pass option '-e baremetal_csv_file=<path/to/file>'"
when: baremetal_csv_file is not defined
- name: "Validate that CSV file exists"
local_action: stat path={{ baremetal_csv_file }}
register: test_baremetal_csv_file
- name: "Error if file does not exist."
local_action: fail msg="The variable defined for baremetal_csv_file is not to a file. Please define a file and try again."
when: test_baremetal_csv_file.stat.isreg == false
- name: "Verify CoreOS kernel is present."
local_action: stat path={{ http_boot_folder }}/coreos_production_pxe.vmlinuz
register: test_core_os_kernel_present
- name: "Error if the CoreOS kernel is missing."
local_action: fail msg="CoreOS kernel not found. Consider re-running setup."
when: test_core_os_kernel_present.stat.exists == false
- name: "Verify CoreOS ramdisk is present."
local_action: stat path={{ http_boot_folder }}/coreos_production_pxe_image-oem.cpio.gz
register: test_core_os_image_present
- name: "Error if the CoreOS ramdisk is missing."
local_action: fail msg="CoreOS ramdisk was not found. Consider re-running setup."
when: test_core_os_image_present.stat.exists == false
- name: "Verify that deployment image is present."
local_action: stat path={{deploy_image}}
register: test_deploy_image
# TODO: checksum for the above stat operation will be required for deployment.
- name: "Error if deployment image is missing."
local_action: fail msg="Deployment image is missing. Consider re-running setup."
when: test_deploy_image.stat.exists == false
- name: "Check to see if there is a file where the ssh_key_path is defined"
local_action: stat path={{ ssh_public_key_path }}
register: test_ssh_public_key_path
- name: "Error if ssh_public_key_path is not valid"
local_action: fail msg="ssh_public_key_path is not valid."
when: test_ssh_public_key_path.stat.exists == false
- name: "Read ssh public key in"
local_action: set_fact ssh_public_key="{{ lookup('file', ssh_public_key_path ) }}"

View File

@ -0,0 +1,2 @@
---
# vars file for ironic-deploy

View File

@ -0,0 +1,38 @@
Role Name
=========
A brief description of the role goes here.
Requirements
------------
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
Role Variables
--------------
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
Dependencies
------------
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
Example Playbook
----------------
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
- hosts: servers
roles:
- { role: username.rolename, x: 42 }
License
-------
BSD
Author Information
------------------
An optional section for the role authors to include contact information, or a website (HTML is not allowed).

View File

@ -0,0 +1,2 @@
---
# defaults file for ironic-enroll

View File

@ -0,0 +1,2 @@
---
# handlers file for ironic-enroll

View File

@ -0,0 +1,128 @@
---
galaxy_info:
author: your name
description:
company: your company (optional)
# Some suggested licenses:
# - BSD (default)
# - MIT
# - GPLv2
# - GPLv3
# - Apache
# - CC-BY
license: license (GPLv2, CC-BY, etc)
min_ansible_version: 1.2
#
# 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:ec2
#- cloud:gce
#- cloud:rax
#- clustering
#- database
#- database:nosql
#- database:sql
#- development
#- monitoring
#- networking
#- packaging
#- system
#- web
dependencies: []
# List your role dependencies here, one per line. Only
# dependencies available via galaxy should be listed here.
# Be sure to remove the '[]' above if you add dependencies
# to this list.

View File

@ -0,0 +1,19 @@
---
- name: "Error if variable baremetal_csv_file is not defined"
local_action: fail msg="baremetal_csv_file must be defined for this playbook to execute, please pass option '-e baremetal_csv_file=<path/to/file>'"
when: baremetal_csv_file is not defined
- name: "Validate that CSV file exists"
local_action: stat path={{ baremetal_csv_file }}
register: test_baremetal_csv_file
- name: "Error if file does not exist."
local_action: fail msg="The variable defined for baremetal_csv_file is not to a file. Please define a file and try again."
when: test_baremetal_csv_file.stat.isreg == false
- name: "If ipmi_bridging value is no exists, execute standard sequence."
include: standard_enroll.yaml
when: ipmi_bridging == "no"
- name: "If ipmi_bridging is set to single, execute single bridge enrollment sequence.."
include: ipmi_bridging_single_enroll.yaml
when: ipmi_bridging == "single"
- name: "If ipmi_bridging is set to single, execute dual bridge enrollment sequence.."
include: ipmi_bridging_dual_enroll.yaml
when: ipmi_bridging == "dual"

View File

@ -0,0 +1,3 @@
---
# vars file for ironic-enroll
ipmi_bridging: no