diff --git a/roles/tripleo_undercloud_install/README.md b/roles/tripleo_undercloud_install/README.md index 6aeee19..555e2fd 100644 --- a/roles/tripleo_undercloud_install/README.md +++ b/roles/tripleo_undercloud_install/README.md @@ -14,6 +14,7 @@ Role Variables * `tripleo_undercloud_install_debug`: (Boolean) Flag used to enable the debug version of commands. Default: false * `tripleo_undercloud_install_dry_run`: (Boolean) Flag to add --dry-run to the install. Default: false * `tripleo_undercloud_install_force_stack_update`: (Boolean) Flag to add --force-stack-update to the install. Default: false +* `tripleo_undercloud_install_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_undercloud_install_home_dir`: (String) Home directory for the undercloud user. Default: "{{ ansible_env.HOME }}" * `tripleo_undercloud_install_inflight_validations`: (Boolean) Flag to add --inflight-validations to the install. Default: false * `tripleo_undercloud_install_log_combine`: (Boolean) Flag to combine stdout and stderr in the logfile. Default: true diff --git a/roles/tripleo_undercloud_install/defaults/main.yml b/roles/tripleo_undercloud_install/defaults/main.yml index bfdf0a9..2f9f4f3 100644 --- a/roles/tripleo_undercloud_install/defaults/main.yml +++ b/roles/tripleo_undercloud_install/defaults/main.yml @@ -4,6 +4,7 @@ openstack_bin: openstack tripleo_undercloud_install_debug: false tripleo_undercloud_install_dry_run: false tripleo_undercloud_install_force_stack_update: false +tripleo_undercloud_install_generate_scripts: "{{ tripleo_generate_scripts | default(False) }}" tripleo_undercloud_install_home_dir: "{{ ansible_env.HOME }}" tripleo_undercloud_install_inflight_validations: false tripleo_undercloud_install_log_combine: true diff --git a/roles/tripleo_undercloud_install/tasks/main.yml b/roles/tripleo_undercloud_install/tasks/main.yml index c620f21..d4a564a 100644 --- a/roles/tripleo_undercloud_install/tasks/main.yml +++ b/roles/tripleo_undercloud_install/tasks/main.yml @@ -10,6 +10,7 @@ {{ tripleo_undercloud_install_yes | ternary("--yes", '') }} {{ tripleo_undercloud_install_log_output | ternary((">" ~ tripleo_undercloud_install_log), '') }} {{ tripleo_undercloud_install_log_combine | ternary("2>&1", '') }} + _install_env: {} - name: Preserve existing log file if exists timestamp_file: @@ -21,6 +22,13 @@ var: _install_cmd when: tripleo_undercloud_install_debug|bool +- name: Write reproducer script + tripleo_shell_script: + dest: "{{ tripleo_undercloud_install_home_dir }}/undercloud_install.sh" + shell_command: "{{ _install_cmd }}" + shell_environment: "{{ _install_env }}" + when: tripleo_undercloud_install_generate_scripts|bool + - name: undercloud install shell: "{{ _install_cmd }}" # noqa 305 args: