Browse Source

Generate node unprovision script if wanted

This script might be handy in some cases - for instance if the node
provisionning is failing, it's always better to unprovision things
before retrying.

Change-Id: Ie067226b509fbc1186be956f20866b8104e555ad
changes/39/814539/4
Cédric Jeanneret 7 months ago committed by Cedric Jeanneret
parent
commit
36778dd949
  1. 2
      roles/tripleo_overcloud_node_unprovision/README.md
  2. 2
      roles/tripleo_overcloud_node_unprovision/defaults/main.yml
  3. 12
      roles/tripleo_overcloud_node_unprovision/tasks/main.yml

2
roles/tripleo_overcloud_node_unprovision/README.md

@ -14,6 +14,8 @@ Role Variables
* `tripleo_overcloud_node_unprovision_all`: (Boolean) Unprovision every instance in the deployment. Defaults: false
* `tripleo_overcloud_node_unprovision_debug`: (Boolean) Flag to print out the delete command. Default: False
* `tripleo_overcloud_node_unprovision_deployment_file`: (String) REQUIRED. Configuration file describing the baremetal deployment.
* `tripleo_overcloud_node_unprovision_generate_scripts`: (Boolean) Write out a shell script that can be used to reproduce the command being executed. By default uses the value of `tripleo_generate_scripts` or False if tripleo_generate_scripts is not defined.
* `tripleo_overcloud_node_unprovision_generate_scripts_only`: (Boolean) Do not run the actual command - to be used in conjunction with `tripleo_overcloud_node_unprovision_generate_scripts`. By default uses the value of `tripleo_generate_scripts_only` or False if `tripleo_generate_scripts_only` is not defined.
* `tripleo_overcloud_node_unprovision_home_dir`: (String) Home directory to where the command is run from. Default: "{{ ansible_env.HOME }}"
* `tripleo_overcloud_node_unprovision_log_combine`: (Boolean) Flag to enable capturing stderr with stdout. Default: true
* `tripleo_overcloud_node_unprovision_log_output`: (Boolean) Flag to enable logging to a file. Since the output of this command can be large, it is not recommended to disable this. Default: true

2
roles/tripleo_overcloud_node_unprovision/defaults/main.yml

@ -4,6 +4,8 @@ openstack_bin: openstack
tripleo_overcloud_node_unprovision_all: false
tripleo_overcloud_node_unprovision_debug: false
tripleo_overcloud_node_unprovision_deployment_file:
tripleo_overcloud_node_unprovision_generate_scripts: "{{ tripleo_generate_scripts|default(False) }}"
tripleo_overcloud_node_unprovision_generate_scripts_only: "{{ tripleo_generate_scripts_only|default(False) }}"
tripleo_overcloud_node_unprovision_home_dir: "{{ ansible_env.HOME }}"
tripleo_overcloud_node_unprovision_log: "{{ tripleo_overcloud_node_unprovision_home_dir }}/CHANGEME.log"
tripleo_overcloud_node_unprovision_log_combine: true

12
roles/tripleo_overcloud_node_unprovision/tasks/main.yml

@ -32,6 +32,14 @@
debug:
var: _unprovision_env
- name: write reproducer script
tripleo_shell_script:
dest: "{{ tripleo_config_generate_home_dir }}/tripleo_overcloud_node_unprovision.sh"
shell_command: "{{ _unprovision_cmd }}"
shell_environment: "{{ _unprovision_env }}"
when:
- tripleo_overcloud_node_unprovision_generate_scripts|bool
- name: overcloud node unprovision
shell: "{{ _unprovision_cmd }}" # noqa 305
environment: "{{ _unprovision_env }}"
@ -43,7 +51,9 @@
async: "{{ tripleo_overcloud_node_unprovision_timeout }}"
poll: "{{ tripleo_overcloud_node_unprovision_poll }}"
changed_when: false
when: not ansible_check_mode|bool
when:
- not ansible_check_mode|bool
- not tripleo_overcloud_node_unprovision_generate_scripts_only|bool
- name: Set output fact
when:

Loading…
Cancel
Save