Files
tripleo-operator-ansible/roles/tripleo_overcloud_node_import/tasks/main.yml
Cédric Jeanneret 5a73e0a718 Add new parameter in order to get a kind of dry-run
A new global parameter is introduced:
tripleo_generate_scripts_only

It allows to get the roles running as usual, but it won't actually
execute the "shell" module.
With the "tripleo_generate_scripts", it allows to get everything ready
for manual investigations, with the generated scripts ready.

Of course, every role can be instructed to only generate scripts, using
the standard <role_name>_generate_scripts_only parameter.

Change-Id: I841743fb6c2c24e4a3d86598f99322022b27804d
2020-05-12 15:14:47 +02:00

56 lines
2.5 KiB
YAML

---
# tasks file for tripleo_overcloud_node_import
- name: Setup overcloud node import command
set_fact:
_import_cmd: >-
{{ tripleo_overcloud_node_import_os_cloud | ternary('', "source " ~ tripleo_overcloud_node_import_rc_file ~ "; ") }}
{{ openstack_bin }} overcloud node import
{{ tripleo_overcloud_node_import_introspect | ternary('--introspect', '') }}
{{ tripleo_overcloud_node_import_run_validations | ternary('--run-validations', '') }}
{{ tripleo_overcloud_node_import_validate_only | ternary('--validate-only', '') }}
{{ tripleo_overcloud_node_import_provide | ternary('--provide', '') }}
{{ tripleo_overcloud_node_import_no_deploy_image | ternary('--no-deploy-image', '') }}
{{ tripleo_overcloud_node_import_instance_boot_option | ternary('--instance-boot-option $IMPORT_INSTANCE_BOOT_OPTION', '') }}
{{ tripleo_overcloud_node_import_http_boot | ternary('--http-boot $IMPORT_HTTP_BOOT', '') }}
{{ tripleo_overcloud_node_import_concurrency | ternary('--concurrency ' ~ tripleo_overcloud_node_import_concurrency, '') }}
{{ tripleo_overcloud_node_import_environment_file }}
_import_env:
IMPORT_INSTANCE_BOOT_OPTION: "{{ tripleo_overcloud_node_import_instance_boot_option }}"
IMPORT_HTTP_BOOT: "{{ tripleo_overcloud_node_import_http_boot }}"
OS_CLOUD: "{{ tripleo_overcloud_node_import_os_cloud }}"
- name: Show debug information
when: tripleo_overcloud_node_import_debug|bool
block:
- name: Show the node import command
debug:
var: _import_cmd
- name: Show the node import environment
debug:
var: _import_env
- name: Write reproducer script
tripleo_shell_script:
dest: "{{ tripleo_overcloud_node_import_home_dir }}/tripleo_overcloud_node_import.sh"
shell_command: "{{ _import_cmd }}"
shell_environment: "{{ _import_env }}"
when: tripleo_overcloud_node_import_generate_scripts|bool
- name: Import node(s)
shell: "{{ _import_cmd }}" # noqa 305
environment: "{{ _import_env }}"
args:
executable: /bin/bash
chdir: "{{ tripleo_overcloud_node_import_home_dir }}"
warn: false
async: "{{ tripleo_overcloud_node_import_timeout }}"
poll: "{{ tripleo_overcloud_node_import_poll }}"
register: tripleo_overcloud_node_import_result
changed_when: true
when: not tripleo_overcloud_node_import_generate_scripts_only|bool
- name: Set output fact
set_fact:
tripleo_overcloud_node_import_output: "{{ tripleo_overcloud_node_import_result.stdout }}"