diff --git a/doc/source/admin/drivers/ansible.rst b/doc/source/admin/drivers/ansible.rst index 9ecca79796..31e06f00f9 100644 --- a/doc/source/admin/drivers/ansible.rst +++ b/doc/source/admin/drivers/ansible.rst @@ -362,6 +362,7 @@ Those values are then accessible in your plays as well preserve_ephemeral: "" ephemeral_format: "" partitions: "" + raid_config: "" ``ironic.nodes`` @@ -434,6 +435,10 @@ Those values are then accessible in your plays as well Optional. Taken from the ``instance_info``, it specifies if the ephemeral partition must be preserved or rebuilt. Defaults to ``no``. +``ironic.raid_config`` + Taken from the ``target_raid_config`` if not empty, it specifies the RAID + configuration to apply. + As usual for Ansible playbooks, you also have access to standard Ansible facts discovered by ``setup`` module. diff --git a/ironic/drivers/modules/ansible/deploy.py b/ironic/drivers/modules/ansible/deploy.py index bb83f069c8..b40df6cf6e 100644 --- a/ironic/drivers/modules/ansible/deploy.py +++ b/ironic/drivers/modules/ansible/deploy.py @@ -428,8 +428,10 @@ class AnsibleDeploy(agent_base.HeartbeatMixin, base.DeployInterface): {'node': node.uuid, 'ip': node_address}) variables = _prepare_variables(task) if not node.driver_internal_info.get('is_whole_disk_image'): - variables.update(_parse_partitioning_info(task.node)) - playbook, user, key = _parse_ansible_driver_info(task.node) + variables.update(_parse_partitioning_info(node)) + if node.target_raid_config: + variables.update({'raid_config': node.target_raid_config}) + playbook, user, key = _parse_ansible_driver_info(node) node_list = [(node.uuid, node_address, user, node.extra)] extra_vars = _prepare_extra_vars(node_list, variables=variables) @@ -535,11 +537,18 @@ class AnsibleDeploy(agent_base.HeartbeatMixin, base.DeployInterface): node_address = _get_node_ip(task) node_list = [(node.uuid, node_address, user, node.extra)] - extra_vars = _prepare_extra_vars(node_list) + + if node.target_raid_config: + variables = {'raid_config': node.target_raid_config} + extra_vars = _prepare_extra_vars(node_list, variables=variables) + else: + extra_vars = _prepare_extra_vars(node_list) LOG.debug('Starting cleaning step %(step)s on node %(node)s', {'node': node.uuid, 'step': stepname}) step_tags = step['args'].get('tags', []) + LOG.debug("Detected tags from cleaning step: %(tags)s", + {'tags': step_tags}) _run_playbook(node, playbook, extra_vars, key, tags=step_tags) LOG.info('Ansible completed cleaning step %(step)s ' 'on node %(node)s.', diff --git a/releasenotes/notes/add-target-raid-config-ansible-deploy-c9ae81d9d25c62fe.yaml b/releasenotes/notes/add-target-raid-config-ansible-deploy-c9ae81d9d25c62fe.yaml new file mode 100644 index 0000000000..b485fafd88 --- /dev/null +++ b/releasenotes/notes/add-target-raid-config-ansible-deploy-c9ae81d9d25c62fe.yaml @@ -0,0 +1,8 @@ +--- +features: + - | + Add ``target_raid_config`` data to ``ironic`` variable under + ``raid_config`` top-level key which will expose the RAID configuration + to the ``ansible`` driver. + See `story 2006417 + `__ for details.