Cleanup unused code

Remove testing playbooks, and compute-node-flavors.yml for
autogenerating flavors from baremetal nodes. These are no longer used.

Change-Id: I41903c0110e4b0f4a31942fd41cc9e6fde2a46e2
This commit is contained in:
Mark Goddard 2018-08-16 18:15:53 +01:00
parent bb79085e0d
commit c1ecbcda3d
6 changed files with 0 additions and 306 deletions

View File

@ -1,89 +0,0 @@
---
# This playbook queries the bare metal compute node inventory in ironic and
# creates flavors in nova for each unique combination of scheduling properties
# (ram, disk, cpus). More complex flavor registration must currently be
# performed manually.
- name: Ensure baremetal compute node flavors are registered in nova
hosts: controllers[0]
vars:
venv: "{{ virtualenv_path }}/shade"
flavor_base_name: baremetal-
roles:
- role: stackhpc.os-openstackclient
os_openstackclient_venv: "{{ venv }}"
os_openstackclient_install_epel: "{{ yum_install_epel }}"
tasks:
- name: Get a list of ironic nodes
shell: >
source {{ venv }}/bin/activate &&
openstack baremetal node list --fields name extra properties -f json
register: ironic_node_list
changed_when: False
environment: "{{ openstack_auth_env }}"
- name: Get a list of nova flavors
shell: >
source {{ venv }}/bin/activate &&
openstack flavor list -f json -c Name -c RAM -c VCPUs -c Disk
register: nova_flavor_list
changed_when: False
environment: "{{ openstack_auth_env }}"
- name: Set facts containing the ironic nodes and nova flavors
set_fact:
ironic_nodes: "{{ ironic_node_list.stdout | from_json }}"
ironic_node_flavor_properties: []
existing_nova_flavors: "{{ nova_flavor_list.stdout | from_json }}"
relevant_existing_flavors: []
os_flavors: []
# Build a list of nodes' flavor-relevant properties.
- name: Set a fact containing the ironic node properties
set_fact:
# Extra_specs required for CPU architecture but not currently supported
# by ansible. Will be added in 2.3.
# At that point, add "'cpu_arch': item.Properties.cpu_arch,".
ironic_node_flavor_properties: >
{{ ironic_node_flavor_properties +
[{'vcpus': item.Properties.cpus | int,
'ram': item.Properties.memory_mb | int,
'disk': item.Properties.local_gb | int}] }}
with_items: "{{ ironic_nodes }}"
# Build a list of flavors with the flavor base name, in the same format
# as the ironic node flavor properties list so that they can be compared.
- name: Set a fact containing the relevant nova flavors
set_fact:
relevant_existing_flavors: >
{{ relevant_existing_flavors +
[{'vcpus': item.VCPUs | int,
'ram': item.RAM | int,
'disk': item.Disk | int}] }}
with_items: "{{ existing_nova_flavors }}"
when: item.Name.startswith(flavor_base_name)
# Build a list of nova flavors to create. Here we offset the flavor name
# index by the length of the relevant existing flavor list. Note that this
# won't work for a list of names other than 0 to N-1.
- name: Set a fact containing a list of flavors to register in nova
set_fact:
os_flavors: >
{{ os_flavors +
[item.1 | combine({'name': flavor_base_name ~ (item.0 + relevant_existing_flavors | length)})] }}
with_indexed_items: >
{{ ironic_node_flavor_properties |
unique |
difference(relevant_existing_flavors) |
sort }}
# Register the new flavors.
- name: Include the stackhpc.os-flavors role
include_role:
name: stackhpc.os-flavors
vars:
os_flavors_venv: "{{ venv }}"
os_flavors_auth_type: "{{ openstack_auth_type }}"
os_flavors_auth: "{{ openstack_auth }}"
os_shade_install_epel: "{{ yum_install_epel }}"

View File

@ -1,33 +0,0 @@
---
- name: Ensure CentOS cloud image is registered with Glance
hosts: controllers[0]
vars:
os_shade_venv: "{{ virtualenv_path }}/shade"
roles:
- role: stackhpc.os-shade
os_shade_install_epel: "{{ yum_install_epel }}"
tasks:
- name: Ensure image download directory exists
file:
path: "{{ image_cache_path }}"
state: directory
- name: Ensure CentOS 7 cloud image is downloaded
get_url:
url: http://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud.qcow2
dest: "{{ image_cache_path }}/CentOS-7-x86_64-GenericCloud.qcow2"
# Note that setting this via a play or task variable seems to not
# evaluate the Jinja variable reference, so we use set_fact.
- name: Update the Ansible python interpreter fact to point to the shade virtualenv
set_fact:
ansible_python_interpreter: "{{ os_shade_venv }}/bin/python"
- name: Ensure test deployment image is registered with Glance
os_image:
auth: "{{ openstack_auth }}"
name: centos7
container_format: bare
disk_format: qcow2
state: present
filename: "{{ image_cache_path }}/CentOS-7-x86_64-GenericCloud.qcow2"

View File

@ -1,86 +0,0 @@
---
- name: Ensure user images are built and registered with Glance
hosts: controllers[0]
vars:
image_build_dir: "{{ ansible_user_dir }}/images/dib"
image_name: centos7
image_os_element: centos7
image_base_elements:
- dhcp-all-interfaces
- enable-serial-console
image_is_whole_disk: True
image_whole_disk_elements:
- vm
image_partition_elements:
- baremetal
- grub2
image_extra_elements: []
image_elements: "{{ image_base_elements + (image_whole_disk_elements if image_is_whole_disk|bool else image_partition_elements) + image_extra_elements }}"
os_shade_venv: "{{ virtualenv_path }}/shade"
roles:
- role: stackhpc.os-shade
os_shade_install_epel: "{{ yum_install_epel }}"
tasks:
- name: Ensure diskimage-builder package is installed
yum:
name: diskimage-builder
state: installed
become: True
- name: Ensure image build directory exists
file:
path: "{{ image_build_dir }}"
state: directory
- name: Display image elements
debug:
var: image_elements
- name: Ensure CentOS 7 image is built
command: >
disk-image-create
{{ image_os_element }}
{{ image_elements|join(' ') }}
-o {{ image_name }}
args:
chdir: "{{ image_build_dir }}"
creates: "{{ image_build_dir }}/{{ image_name }}.qcow2"
# Note that setting this via a play or task variable seems to not
# evaluate the Jinja variable reference, so we use set_fact.
- name: Update the Ansible python interpreter fact to point to the shade virtualenv
set_fact:
ansible_python_interpreter: "{{ os_shade_venv }}/bin/python"
- name: Ensure test deployment ramdisk and kernel images are registered with Glance
os_image:
auth: "{{ openstack_auth }}"
name: "{{ image_name }}.{{ item.ext }}"
container_format: "{{ item.container_format }}"
disk_format: "{{ item.disk_format }}"
filename: "{{ image_build_dir }}/{{ image_name }}.{{ item.ext }}"
state: present
with_items:
- { container_format: ari, disk_format: ari, ext: initrd }
- { container_format: aki, disk_format: aki, ext: vmlinuz }
register: r_and_k_result
when: not image_is_whole_disk|bool
- name: Ensure test deployment image is registered with Glance
os_image:
auth: "{{ openstack_auth }}"
name: "{{ image_name }}"
container_format: bare
disk_format: qcow2
filename: "{{ image_build_dir }}/{{ image_name }}.qcow2"
state: present
# FIXME: This does not seem to work :(
- name: Ensure test deployment image has kernel and ramdisk properties
os_image:
auth: "{{ openstack_auth }}"
name: "{{ image_name }}"
ramdisk: "{{ image_name }}.initrd"
kernel: "{{ image_name }}.vmlinuz"
state: present
when: not image_is_whole_disk|bool

View File

@ -1,22 +0,0 @@
---
- name: Ensure user SSH keypair is registered with Nova
hosts: controllers[0]
vars:
public_key_path: "{{ ssh_public_key_path }}"
os_shade_venv: "{{ virtualenv_path }}/shade"
roles:
- role: stackhpc.os-shade
os_shade_install_epel: "{{ yum_install_epel }}"
tasks:
# Note that setting this via a play or task variable seems to not
# evaluate the Jinja variable reference, so we use set_fact.
- name: Update the Ansible python interpreter fact to point to the shade virtualenv
set_fact:
ansible_python_interpreter: "{{ os_shade_venv }}/bin/python"
- name: Ensure a test SSH key pair is registered with Nova
os_keypair:
auth: "{{ openstack_auth }}"
name: test
public_key: "{{ lookup('file', public_key_path) }}"
state: present

View File

@ -1,72 +0,0 @@
---
- name: Ensure a test project exists
hosts: controllers[0]
vars:
# Dict of quotas to set for the test project.
test_project_quotas:
cores: -1
floating_ips: -1
injected_files: -1
injected_file_size: -1
instances: -1
key_pairs: -1
fixed_ips: -1
ram: -1
secgroup_rules: -1
secgroups: -1
test_ssh_private_key_path: "{{ ansible_env.PWD ~ '/.ssh/id_rsa' }}"
test_ssh_public_key_path: "{{ test_ssh_private_key_path ~ '.pub' }}"
test_ssh_key_type: rsa
pre_tasks:
- name: Validate OpenStack password authentication parameters
fail:
msg: >
Required OpenStack authentication parameter {{ item }} is
{% if item in openstack_auth %}empty{% else %}not present{% endif %}
in openstack_auth. Have you sourced the environment file?
when:
- openstack_auth_type == 'password'
- item not in openstack_auth or not openstack_auth[item]
with_items: "{{ openstack_auth_password_required_params }}"
tags:
- config-validation
- name: Check whether an SSH key exists on the controller
stat:
path: "{{ test_ssh_private_key_path }}"
get_checksum: False
get_md5: False
mime: False
register: ssh_key_stat
- name: Generate an SSH key on the controller
command: ssh-keygen -t {{ test_ssh_key_type }} -N '' -f {{ test_ssh_private_key_path }}
when: not ssh_key_stat.stat.exists
- name: Read the SSH public key on the controller
slurp:
src: "{{ test_ssh_public_key_path }}"
register: ssh_public_key
roles:
- role: stackhpc.os-projects
os_projects_venv: "{{ virtualenv_path }}/shade"
os_projects_auth_type: "{{ openstack_auth_type }}"
os_projects_admin_auth: "{{ openstack_auth }}"
os_projects:
- name: test-project
description: Kayobe test project
project_domain: default
user_domain: default
users:
- name: test-user
password: test-password
roles:
- admin
- heat_stack_owner
openrc_file: "{{ kayobe_config_path }}/test-user-openrc.sh"
keypairs:
- name: test-keypair
public_key: "{{ ssh_public_key.content | b64decode }}"
quotas: "{{ test_project_quotas }}"

View File

@ -26,8 +26,6 @@
version: v1.1.0 version: v1.1.0
- src: stackhpc.mellanox-switch - src: stackhpc.mellanox-switch
version: v1.0.0 version: v1.0.0
- src: stackhpc.os-flavors
version: v1.0.0
- src: stackhpc.os-images - src: stackhpc.os-images
version: v1.0.0 version: v1.0.0
- src: stackhpc.os-ironic-state - src: stackhpc.os-ironic-state
@ -36,8 +34,6 @@
version: v1.0.0 version: v1.0.0
- src: stackhpc.os-openstackclient - src: stackhpc.os-openstackclient
version: v1.2.0 version: v1.2.0
- src: stackhpc.os-projects
version: v1.1.2
- src: stackhpc.os-shade - src: stackhpc.os-shade
version: v1.2.0 version: v1.2.0
- src: yatesr.timezone - src: yatesr.timezone