Merge "Remove unused cli-baremetal-configure.yaml playbook"
This commit is contained in:
commit
34e324638c
|
@ -25,7 +25,6 @@ from ironicclient import client as ironicclient
|
||||||
from novaclient import client as novaclient
|
from novaclient import client as novaclient
|
||||||
from swiftclient import client as swift_client
|
from swiftclient import client as swift_client
|
||||||
|
|
||||||
from tripleo_common.actions import baremetal
|
|
||||||
from tripleo_common.utils import nodes
|
from tripleo_common.utils import nodes
|
||||||
from tripleo_common.utils import parameters
|
from tripleo_common.utils import parameters
|
||||||
|
|
||||||
|
@ -166,49 +165,6 @@ class TripleOCommon(object):
|
||||||
)
|
)
|
||||||
return self.client_cache['swift_client']
|
return self.client_cache['swift_client']
|
||||||
|
|
||||||
def baremetal_configure_boot(self, kwargs):
|
|
||||||
"""Run the action configure boot, and return data.
|
|
||||||
|
|
||||||
:param kwargs: options to pass into the ConfigureBootAction
|
|
||||||
:type kwargs: Dictionary
|
|
||||||
|
|
||||||
:returns: Object
|
|
||||||
"""
|
|
||||||
|
|
||||||
action = baremetal.ConfigureBootAction(**kwargs)
|
|
||||||
baremetal_client = ironicclient.Client(
|
|
||||||
1,
|
|
||||||
session=self.sess
|
|
||||||
)
|
|
||||||
image_client = glanceclient.Client(2, session=self.sess)
|
|
||||||
return action.configure_boot(
|
|
||||||
baremetal_client,
|
|
||||||
image_client
|
|
||||||
)
|
|
||||||
|
|
||||||
def baremetal_configure_root_device(self, kwargs):
|
|
||||||
"""Run the action configure root device, and return data.
|
|
||||||
|
|
||||||
:param kwargs: options to pass into the ConfigureRootDeviceAction
|
|
||||||
:type kwargs: Dictionary
|
|
||||||
|
|
||||||
:returns: Object
|
|
||||||
"""
|
|
||||||
|
|
||||||
action = baremetal.ConfigureRootDeviceAction(**kwargs)
|
|
||||||
baremetal_client = ironicclient.Client(
|
|
||||||
1,
|
|
||||||
session=self.sess
|
|
||||||
)
|
|
||||||
inspector_client = self.get_ironic_inspector_client()
|
|
||||||
if not action.root_device:
|
|
||||||
return
|
|
||||||
else:
|
|
||||||
return action.configure_root_device(
|
|
||||||
baremetal_client,
|
|
||||||
inspector_client
|
|
||||||
)
|
|
||||||
|
|
||||||
def return_introspected_node_data(self, node_id):
|
def return_introspected_node_data(self, node_id):
|
||||||
"""Return baremetal data from the ironic inspector.
|
"""Return baremetal data from the ironic inspector.
|
||||||
|
|
||||||
|
|
|
@ -1,104 +0,0 @@
|
||||||
# All Rights Reserved.
|
|
||||||
#
|
|
||||||
# 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.
|
|
||||||
|
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
|
||||||
from ansible.module_utils import tripleo_common_utils as tc
|
|
||||||
from ansible.module_utils.openstack import openstack_full_argument_spec
|
|
||||||
from ansible.module_utils.openstack import openstack_module_kwargs
|
|
||||||
from ansible.module_utils.openstack import openstack_cloud_from_module
|
|
||||||
|
|
||||||
|
|
||||||
DOCUMENTATION = """
|
|
||||||
---
|
|
||||||
module: os_tripleo_baremetal_configure
|
|
||||||
short_description: Configure Baremetal nodes
|
|
||||||
extends_documentation_fragment: openstack
|
|
||||||
author:
|
|
||||||
- "Dougal Matthews (@d0ugal)"
|
|
||||||
- "Kevin Carter (@cloudnull)"
|
|
||||||
version_added: "2.10"
|
|
||||||
description:
|
|
||||||
- Configure baremetal tripleo node.
|
|
||||||
options:
|
|
||||||
action:
|
|
||||||
description:
|
|
||||||
- Run a given action on a baremetal node target.
|
|
||||||
type: str
|
|
||||||
required: true
|
|
||||||
choices:
|
|
||||||
- baremetal_configure_boot
|
|
||||||
- baremetal_configure_root_device
|
|
||||||
args:
|
|
||||||
description:
|
|
||||||
- A set of key=value arguments.
|
|
||||||
type: dict
|
|
||||||
required: true
|
|
||||||
|
|
||||||
requirements: ["openstacksdk", "tripleo-common"]
|
|
||||||
"""
|
|
||||||
|
|
||||||
EXAMPLES = """
|
|
||||||
# Invoke baremetal setup
|
|
||||||
- name: configure boot
|
|
||||||
os_tripleo_baremetal_configure:
|
|
||||||
cloud: undercloud
|
|
||||||
action: baremetal_configure_boot
|
|
||||||
args:
|
|
||||||
node_uuid: "6d225f94-b385-4ac1-ab23-7581de425127"
|
|
||||||
kernel_name: "bm-deploy-kernel"
|
|
||||||
ramdisk_name: "bm-deploy-ramdisk"
|
|
||||||
|
|
||||||
- name: configure root device
|
|
||||||
os_tripleo_baremetal_configure:
|
|
||||||
cloud: undercloud
|
|
||||||
action: baremetal_configure_root_device
|
|
||||||
args:
|
|
||||||
node_uuid: "6d225f94-b385-4ac1-ab23-7581de425127"
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
import os
|
|
||||||
|
|
||||||
import yaml
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
argument_spec = openstack_full_argument_spec(
|
|
||||||
**yaml.safe_load(DOCUMENTATION)['options']
|
|
||||||
)
|
|
||||||
module = AnsibleModule(
|
|
||||||
argument_spec,
|
|
||||||
**openstack_module_kwargs()
|
|
||||||
)
|
|
||||||
|
|
||||||
_, conn = openstack_cloud_from_module(module)
|
|
||||||
tripleo = tc.TripleOCommon(session=conn.session)
|
|
||||||
|
|
||||||
if hasattr(tripleo, module.params["action"]):
|
|
||||||
action = getattr(tripleo, module.params["action"])
|
|
||||||
result = action(
|
|
||||||
kwargs=module.params["args"]
|
|
||||||
)
|
|
||||||
module.exit_json(result=result)
|
|
||||||
else:
|
|
||||||
module.fail_json(
|
|
||||||
msg="Unknown action name {}".format(
|
|
||||||
module.params["action"]
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
main()
|
|
|
@ -1,96 +0,0 @@
|
||||||
---
|
|
||||||
# Copyright 2019 Red Hat, Inc.
|
|
||||||
# All Rights Reserved.
|
|
||||||
#
|
|
||||||
# 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: Baremetal Configure - set the boot and root devices for ironic nodes
|
|
||||||
connection: "{{ (tripleo_target_host is defined) | ternary('ssh', 'local') }}"
|
|
||||||
hosts: "{{ tripleo_target_host | default('localhost') }}"
|
|
||||||
remote_user: "{{ tripleo_target_user | default(lookup('env', 'USER')) }}"
|
|
||||||
gather_facts: "{{ (tripleo_target_host is defined) | ternary(true, false) }}"
|
|
||||||
any_errors_fatal: true
|
|
||||||
vars:
|
|
||||||
tripleo_undercloud_name: undercloud
|
|
||||||
kernel_name: bm-deploy-kernel
|
|
||||||
ramdisk_name: bm-deploy-ramdisk
|
|
||||||
root_device_minimum_size: 4
|
|
||||||
overwrite_root_device_hints: false
|
|
||||||
pre_tasks:
|
|
||||||
- name: Check for required inputs
|
|
||||||
fail:
|
|
||||||
msg: >
|
|
||||||
`node_uuids` or `all_manageable` are required inputs but
|
|
||||||
currently undefined. Check you inputs and try again.
|
|
||||||
when:
|
|
||||||
- node_uuids is undefined
|
|
||||||
- all_manageable is undefined
|
|
||||||
|
|
||||||
- name: Check for required inputs
|
|
||||||
fail:
|
|
||||||
msg: >
|
|
||||||
The option `all_manageable` is "false" but `node_uuids` is
|
|
||||||
undefined. Check your inputs and try again.
|
|
||||||
when:
|
|
||||||
- node_uuids is undefined
|
|
||||||
- not (all_manageable | bool)
|
|
||||||
tasks:
|
|
||||||
- name: Run all manageable block
|
|
||||||
block:
|
|
||||||
# Get Node UUIDs, if "all_manageable" is True
|
|
||||||
- name: Get node UUIDS
|
|
||||||
command: >
|
|
||||||
openstack baremetal node list --provision-state=manageable -c UUID -f value
|
|
||||||
register: command_output
|
|
||||||
changed_when: false
|
|
||||||
|
|
||||||
- name: Set node_uuids fact
|
|
||||||
set_fact:
|
|
||||||
node_uuids: "{{ command_output.stdout_lines }}"
|
|
||||||
when:
|
|
||||||
- all_manageable | bool
|
|
||||||
- node_uuids is undefined
|
|
||||||
|
|
||||||
- name: exit if nothing to do
|
|
||||||
block:
|
|
||||||
- name: Notice
|
|
||||||
debug:
|
|
||||||
msg: No nodes are manageable at this time.
|
|
||||||
|
|
||||||
- name: end play
|
|
||||||
meta: end_play
|
|
||||||
when:
|
|
||||||
- (node_uuids | length) < 1
|
|
||||||
|
|
||||||
# Configure Nodes
|
|
||||||
- name: Configure node boot
|
|
||||||
os_tripleo_baremetal_configure:
|
|
||||||
cloud: "{{ tripleo_undercloud_name }}"
|
|
||||||
action: baremetal_configure_boot
|
|
||||||
args:
|
|
||||||
node_uuid: "{{ item }}"
|
|
||||||
kernel_name: "{{ kernel_name }}"
|
|
||||||
ramdisk_name: "{{ ramdisk_name }}"
|
|
||||||
instance_boot_option: "{{ instance_boot_option | default(omit) }}"
|
|
||||||
loop: "{{ node_uuids }}"
|
|
||||||
|
|
||||||
- name: Configure root device
|
|
||||||
os_tripleo_baremetal_configure:
|
|
||||||
cloud: "{{ tripleo_undercloud_name }}"
|
|
||||||
action: baremetal_configure_root_device
|
|
||||||
args:
|
|
||||||
node_uuid: "{{ item }}"
|
|
||||||
root_device: "{{ root_device | default(omit) }}"
|
|
||||||
minimum_size: "{{ root_device_minimum_size }}"
|
|
||||||
overwrite: "{{ overwrite_root_device_hints }}"
|
|
||||||
loop: "{{ node_uuids }}"
|
|
Loading…
Reference in New Issue