diff --git a/roles/tripleo_undercloud_backup/README.md b/roles/tripleo_undercloud_backup/README.md index 6b90b7c..93c0a6c 100644 --- a/roles/tripleo_undercloud_backup/README.md +++ b/roles/tripleo_undercloud_backup/README.md @@ -17,7 +17,8 @@ Role Variables * `tripleo_undercloud_backup_home_dir`: (String) Home directory for the undercloud user. Default: "{{ ansible_env.HOME }}" * `tripleo_undercloud_backup_log_combine`: (Boolean) Flag to combine stdout and stderr in the logfile. Default: true * `tripleo_undercloud_backup_log_output`: (Boolean) Flag to log the output to a file rather than show it in the ansible output. Default: true -* `tripleo_undercloud_backup_timeout`: (Number) Timeout for the backup command. Default: 7200 +* `tripleo_undercloud_backup_poll`: (Integer) Number of seconds to wait between checks to see if the backup command has completed. This should be set to a value greater or equal to 1. Default: 10 +* `tripleo_undercloud_backup_timeout`: (Integer) Timeout for the backup command. Default: 7200 * `tripleo_undercloud_backup_log`: (String) Backup log file path. Default: "{{ tripleo_undercloud_backup_home_dir }}/undercloud_backup.log" Output Variables diff --git a/roles/tripleo_undercloud_backup/defaults/main.yml b/roles/tripleo_undercloud_backup/defaults/main.yml index 625acdc..a4f415e 100644 --- a/roles/tripleo_undercloud_backup/defaults/main.yml +++ b/roles/tripleo_undercloud_backup/defaults/main.yml @@ -1,10 +1,12 @@ --- # defaults file for tripleo_undercloud_backup +openstack_bin: openstack tripleo_undercloud_backup_add_path: [] tripleo_undercloud_backup_debug: false tripleo_undercloud_backup_exclude_path: [] tripleo_undercloud_backup_home_dir: "{{ ansible_env.HOME }}" tripleo_undercloud_backup_log_combine: true tripleo_undercloud_backup_log_output: true +tripleo_undercloud_backup_poll: 10 tripleo_undercloud_backup_timeout: 7200 tripleo_undercloud_backup_log: "{{ tripleo_undercloud_backup_home_dir }}/undercloud_backup.log" diff --git a/roles/tripleo_undercloud_backup/molecule/default/molecule.yml b/roles/tripleo_undercloud_backup/molecule/default/molecule.yml new file mode 100644 index 0000000..e9ae0b7 --- /dev/null +++ b/roles/tripleo_undercloud_backup/molecule/default/molecule.yml @@ -0,0 +1,22 @@ +--- +driver: + name: delegated + options: + managed: false + ansible_connection_options: + ansible_connection: local +log: true +lint: + name: yamllint + enabled: false +platforms: + - name: instance +provisioner: + name: ansible +scenario: + name: default + test_sequence: + - prepare + - syntax + - converge + - verify diff --git a/roles/tripleo_undercloud_backup/molecule/default/playbook.yml b/roles/tripleo_undercloud_backup/molecule/default/playbook.yml new file mode 100644 index 0000000..f715cb9 --- /dev/null +++ b/roles/tripleo_undercloud_backup/molecule/default/playbook.yml @@ -0,0 +1,48 @@ +--- +- name: Converge + hosts: all + collections: + - tripleo.operator + vars: + openstack_bin: echo + tripleo_os_cloud: undercloud + tripleo_undercloud_backup_debug: true + tripleo_undercloud_backup_log_output: false + tripleo_undercloud_backup_log_combine: false + tripleo_undercloud_backup_poll: 1 + tasks: + + - name: "Include tripleo_undercloud_backup" + include_role: + name: "tripleo_undercloud_backup" + + - name: Check role + assert: + that: + - tripleo_undercloud_backup_result.stdout == "undercloud backup" + + - name: Check parameter "tripleo_undercloud_backup_add_path" + include_role: + name: "tripleo_undercloud_backup" + vars: + tripleo_undercloud_backup_add_path: + - /foo + - /bar + + - name: Assert "tripleo_undercloud_backup_add_path" + assert: + that: + - tripleo_undercloud_backup_result.stdout == "undercloud backup --add-path /foo --add-path /bar" + + - name: Check parameter "tripleo_undercloud_backup_exclude_path" + include_role: + name: "tripleo_undercloud_backup" + vars: + tripleo_undercloud_backup_exclude_path: + - /home + - /usr + + - name: Assert "tripleo_undercloud_backup_exclude_path" + assert: + that: + - tripleo_undercloud_backup_result.stdout == "undercloud backup --exclude-path /home --exclude-path /usr" diff --git a/roles/tripleo_undercloud_backup/molecule/default/prepare.yml b/roles/tripleo_undercloud_backup/molecule/default/prepare.yml new file mode 100644 index 0000000..63bb6ab --- /dev/null +++ b/roles/tripleo_undercloud_backup/molecule/default/prepare.yml @@ -0,0 +1,8 @@ +--- +- name: Prepare + hosts: all + tasks: + + - name: Include molecule prep + include_role: + name: test_molecule_prep diff --git a/roles/tripleo_undercloud_backup/tasks/main.yml b/roles/tripleo_undercloud_backup/tasks/main.yml index 8567dff..cdc5b9f 100644 --- a/roles/tripleo_undercloud_backup/tasks/main.yml +++ b/roles/tripleo_undercloud_backup/tasks/main.yml @@ -2,7 +2,7 @@ - name: Setup undercloud backup facts set_fact: _backup_cmd: >- - openstack undercloud backup + {{ openstack_bin }} undercloud backup {{ tripleo_undercloud_backup_add_path | tripleo.operator.shell_arg_list(parameter='--add-path') }} {{ tripleo_undercloud_backup_exclude_path | tripleo.operator.shell_arg_list(parameter='--exclude-path') }} {{ tripleo_undercloud_backup_log_output | ternary((">" ~ tripleo_undercloud_backup_log), '') }} @@ -11,6 +11,7 @@ - name: Preserve existing log file if exists timestamp_file: path: "{{ tripleo_undercloud_backup_log }}" + when: tripleo_undercloud_backup_log_output|bool - name: Show the underclound backup command debug: @@ -23,6 +24,6 @@ chdir: "{{ tripleo_undercloud_backup_home_dir }}" warn: false async: "{{ tripleo_undercloud_backup_timeout }}" - poll: 10 + poll: "{{ tripleo_undercloud_backup_poll }}" register: tripleo_undercloud_backup_result changed_when: true diff --git a/roles/tripleo_undercloud_install/README.md b/roles/tripleo_undercloud_install/README.md index abed278..6aeee19 100644 --- a/roles/tripleo_undercloud_install/README.md +++ b/roles/tripleo_undercloud_install/README.md @@ -19,7 +19,8 @@ Role Variables * `tripleo_undercloud_install_log_combine`: (Boolean) Flag to combine stdout and stderr in the logfile. Default: true * `tripleo_undercloud_install_log_output`: (Boolean) Flag to log the output to a file rather than show it in the ansible output. Default: true * `tripleo_undercloud_install_no_validations`: (Boolean) Flag to add --no-validations to the install. Default: false -* `tripleo_undercloud_install_timeout`: (Number) Timeout for the install command. Default: 7200 +* `tripleo_undercloud_install_poll`: (Integer) Number of seconds to wait between checks to see if the install command has completed. This should be set to a value greater or equal to 1. Default: 10 +* `tripleo_undercloud_install_timeout`: (Integer) Timeout for the install command. Default: 7200 * `tripleo_undercloud_install_yes`: (Boolean) Flag to add --yes to the install. Default: false * `tripleo_undercloud_install_log`: (String) Install log file path. Default: "{{ tripleo_undercloud_install_home_dir }}/undercloud_install.log" diff --git a/roles/tripleo_undercloud_install/defaults/main.yml b/roles/tripleo_undercloud_install/defaults/main.yml index 0e317b1..bfdf0a9 100644 --- a/roles/tripleo_undercloud_install/defaults/main.yml +++ b/roles/tripleo_undercloud_install/defaults/main.yml @@ -1,5 +1,6 @@ --- # defaults file for tripleo_undercloud_install +openstack_bin: openstack tripleo_undercloud_install_debug: false tripleo_undercloud_install_dry_run: false tripleo_undercloud_install_force_stack_update: false @@ -8,6 +9,7 @@ tripleo_undercloud_install_inflight_validations: false tripleo_undercloud_install_log_combine: true tripleo_undercloud_install_log_output: true tripleo_undercloud_install_no_validations: false +tripleo_undercloud_install_poll: 10 tripleo_undercloud_install_timeout: 7200 tripleo_undercloud_install_yes: false tripleo_undercloud_install_log: "{{ tripleo_undercloud_install_home_dir }}/undercloud_install.log" diff --git a/roles/tripleo_undercloud_install/molecule/default/molecule.yml b/roles/tripleo_undercloud_install/molecule/default/molecule.yml new file mode 100644 index 0000000..e9ae0b7 --- /dev/null +++ b/roles/tripleo_undercloud_install/molecule/default/molecule.yml @@ -0,0 +1,22 @@ +--- +driver: + name: delegated + options: + managed: false + ansible_connection_options: + ansible_connection: local +log: true +lint: + name: yamllint + enabled: false +platforms: + - name: instance +provisioner: + name: ansible +scenario: + name: default + test_sequence: + - prepare + - syntax + - converge + - verify diff --git a/roles/tripleo_undercloud_install/molecule/default/playbook.yml b/roles/tripleo_undercloud_install/molecule/default/playbook.yml new file mode 100644 index 0000000..357f773 --- /dev/null +++ b/roles/tripleo_undercloud_install/molecule/default/playbook.yml @@ -0,0 +1,77 @@ +--- +- name: Converge + hosts: all + collections: + - tripleo.operator + vars: + openstack_bin: echo + tripleo_os_cloud: undercloud + tripleo_undercloud_install_debug: true + tripleo_undercloud_install_log_output: false + tripleo_undercloud_install_log_combine: false + tripleo_undercloud_install_poll: 1 + tasks: + + - name: "Include tripleo_undercloud_install" + include_role: + name: "tripleo_undercloud_install" + + - name: Check role + assert: + that: + - tripleo_undercloud_install_result.stdout == "undercloud install" + + - name: Check parameter "tripleo_undercloud_install_force_stack_update" + include_role: + name: "tripleo_undercloud_install" + vars: + tripleo_undercloud_install_force_stack_update: true + + - name: Assert "tripleo_undercloud_install_force_stack_update" + assert: + that: + - tripleo_undercloud_install_result.stdout == "undercloud install --force-stack-update" + + - name: Check parameter "tripleo_undercloud_install_no_validations" + include_role: + name: "tripleo_undercloud_install" + vars: + tripleo_undercloud_install_no_validations: true + + - name: Assert "tripleo_undercloud_install_no_validations" + assert: + that: + - tripleo_undercloud_install_result.stdout == "undercloud install --no-validations" + + - name: Check parameter "tripleo_undercloud_install_inflight_validations" + include_role: + name: "tripleo_undercloud_install" + vars: + tripleo_undercloud_install_inflight_validations: true + + - name: Assert "tripleo_undercloud_install_inflight_validations" + assert: + that: + - tripleo_undercloud_install_result.stdout == "undercloud install --inflight-validations" + + - name: Check parameter "tripleo_undercloud_install_dry_run" + include_role: + name: "tripleo_undercloud_install" + vars: + tripleo_undercloud_install_dry_run: true + + - name: Assert "tripleo_undercloud_install_dry_run" + assert: + that: + - tripleo_undercloud_install_result.stdout == "undercloud install --dry-run" + + - name: Check parameter "tripleo_undercloud_install_yes" + include_role: + name: "tripleo_undercloud_install" + vars: + tripleo_undercloud_install_yes: true + + - name: Assert "tripleo_undercloud_install_yes" + assert: + that: + - tripleo_undercloud_install_result.stdout == "undercloud install --yes" diff --git a/roles/tripleo_undercloud_install/molecule/default/prepare.yml b/roles/tripleo_undercloud_install/molecule/default/prepare.yml new file mode 100644 index 0000000..63bb6ab --- /dev/null +++ b/roles/tripleo_undercloud_install/molecule/default/prepare.yml @@ -0,0 +1,8 @@ +--- +- name: Prepare + hosts: all + tasks: + + - name: Include molecule prep + include_role: + name: test_molecule_prep diff --git a/roles/tripleo_undercloud_install/tasks/main.yml b/roles/tripleo_undercloud_install/tasks/main.yml index e19c0b8..c620f21 100644 --- a/roles/tripleo_undercloud_install/tasks/main.yml +++ b/roles/tripleo_undercloud_install/tasks/main.yml @@ -2,7 +2,7 @@ - name: Setup undercloud install facts set_fact: _install_cmd: >- - openstack undercloud install + {{ openstack_bin }} undercloud install {{ tripleo_undercloud_install_force_stack_update | ternary("--force-stack-update", '') }} {{ tripleo_undercloud_install_no_validations | ternary("--no-validations", '') }} {{ tripleo_undercloud_install_inflight_validations | ternary("--inflight-validations", '') }} @@ -14,6 +14,7 @@ - name: Preserve existing log file if exists timestamp_file: path: "{{ tripleo_undercloud_install_log }}" + when: tripleo_undercloud_install_log_output|bool - name: Show the underclound install command debug: @@ -26,6 +27,6 @@ chdir: "{{ tripleo_undercloud_install_home_dir }}" warn: false async: "{{ tripleo_undercloud_install_timeout }}" - poll: 10 + poll: "{{ tripleo_undercloud_install_poll }}" register: tripleo_undercloud_install_result changed_when: true diff --git a/roles/tripleo_undercloud_minion_install/README.md b/roles/tripleo_undercloud_minion_install/README.md index 1e3e33a..cede769 100644 --- a/roles/tripleo_undercloud_minion_install/README.md +++ b/roles/tripleo_undercloud_minion_install/README.md @@ -16,7 +16,8 @@ Role Variables * `tripleo_undercloud_minion_install_dry_run`: (Boolean) Flag to add --dry-run to the install. Default: false * `tripleo_undercloud_minion_install_force_stack_update`: (Boolean) Flag to add --force-stack-update to the install. Default: false * `tripleo_undercloud_minion_install_no_validations`: (Boolean) Flag to add --no-validations to the install. Default: false -* `tripleo_undercloud_minion_install_timeout`: (Number) Timeout for the install command. Default: 7200 +* `tripleo_undercloud_minion_install_poll`: (Integer) Number of seconds to wait between checks to see if the install command has completed. This should be set to a value greater or equal to 1. Default: 10 +* `tripleo_undercloud_minion_install_timeout`: (Integer) Timeout for the install command. Default: 7200 * `tripleo_undercloud_minion_install_yes`: (Boolean) Flag to add --yes to the install. Default: false * `tripleo_undercloud_minion_install_log_combine`: (Boolean) Flag to combine stdout and stderr in the logfile. Default: true * `tripleo_undercloud_minion_install_log_output`: (Boolean) Flag to log the output to a file rather than show it in the ansible output. Default: true diff --git a/roles/tripleo_undercloud_minion_install/defaults/main.yml b/roles/tripleo_undercloud_minion_install/defaults/main.yml index 90ea753..21bdeba 100644 --- a/roles/tripleo_undercloud_minion_install/defaults/main.yml +++ b/roles/tripleo_undercloud_minion_install/defaults/main.yml @@ -1,10 +1,12 @@ --- # defaults file for tripleo_undercloud_minion_install +openstack_bin: openstack tripleo_undercloud_minion_install_debug: false tripleo_undercloud_minion_install_home_dir: "{{ ansible_env.HOME }}" tripleo_undercloud_minion_install_dry_run: false tripleo_undercloud_minion_install_force_stack_update: false tripleo_undercloud_minion_install_no_validations: false +tripleo_undercloud_minion_install_poll: 10 tripleo_undercloud_minion_install_timeout: 7200 tripleo_undercloud_minion_install_yes: false tripleo_undercloud_minion_install_log_combine: true diff --git a/roles/tripleo_undercloud_minion_install/molecule/default/molecule.yml b/roles/tripleo_undercloud_minion_install/molecule/default/molecule.yml new file mode 100644 index 0000000..e9ae0b7 --- /dev/null +++ b/roles/tripleo_undercloud_minion_install/molecule/default/molecule.yml @@ -0,0 +1,22 @@ +--- +driver: + name: delegated + options: + managed: false + ansible_connection_options: + ansible_connection: local +log: true +lint: + name: yamllint + enabled: false +platforms: + - name: instance +provisioner: + name: ansible +scenario: + name: default + test_sequence: + - prepare + - syntax + - converge + - verify diff --git a/roles/tripleo_undercloud_minion_install/molecule/default/playbook.yml b/roles/tripleo_undercloud_minion_install/molecule/default/playbook.yml new file mode 100644 index 0000000..fc885e7 --- /dev/null +++ b/roles/tripleo_undercloud_minion_install/molecule/default/playbook.yml @@ -0,0 +1,66 @@ +--- +- name: Converge + hosts: all + collections: + - tripleo.operator + vars: + openstack_bin: echo + tripleo_os_cloud: undercloud + tripleo_undercloud_minion_install_debug: true + tripleo_undercloud_minion_install_log_output: false + tripleo_undercloud_minion_install_log_combine: false + tripleo_undercloud_minion_install_poll: 1 + tasks: + + - name: "Include tripleo_undercloud_minion_install" + include_role: + name: "tripleo_undercloud_minion_install" + + - name: Check role + assert: + that: + - tripleo_undercloud_minion_install_result.stdout == "undercloud minion install" + + - name: Check parameter "tripleo_undercloud_minion_install_force_stack_update" + include_role: + name: "tripleo_undercloud_minion_install" + vars: + tripleo_undercloud_minion_install_force_stack_update: true + + - name: Assert "tripleo_undercloud_minion_install_force_stack_update" + assert: + that: + - tripleo_undercloud_minion_install_result.stdout == "undercloud minion install --force-stack-update" + + - name: Check parameter "tripleo_undercloud_minion_install_no_validations" + include_role: + name: "tripleo_undercloud_minion_install" + vars: + tripleo_undercloud_minion_install_no_validations: true + + - name: Assert "tripleo_undercloud_minion_install_no_validations" + assert: + that: + - tripleo_undercloud_minion_install_result.stdout == "undercloud minion install --no-validations" + + - name: Check parameter "tripleo_undercloud_minion_install_dry_run" + include_role: + name: "tripleo_undercloud_minion_install" + vars: + tripleo_undercloud_minion_install_dry_run: true + + - name: Assert "tripleo_undercloud_minion_install_dry_run" + assert: + that: + - tripleo_undercloud_minion_install_result.stdout == "undercloud minion install --dry-run" + + - name: Check parameter "tripleo_undercloud_minion_install_yes" + include_role: + name: "tripleo_undercloud_minion_install" + vars: + tripleo_undercloud_minion_install_yes: true + + - name: Assert "tripleo_undercloud_minion_install_yes" + assert: + that: + - tripleo_undercloud_minion_install_result.stdout == "undercloud minion install --yes" diff --git a/roles/tripleo_undercloud_minion_install/molecule/default/prepare.yml b/roles/tripleo_undercloud_minion_install/molecule/default/prepare.yml new file mode 100644 index 0000000..63bb6ab --- /dev/null +++ b/roles/tripleo_undercloud_minion_install/molecule/default/prepare.yml @@ -0,0 +1,8 @@ +--- +- name: Prepare + hosts: all + tasks: + + - name: Include molecule prep + include_role: + name: test_molecule_prep diff --git a/roles/tripleo_undercloud_minion_install/tasks/main.yml b/roles/tripleo_undercloud_minion_install/tasks/main.yml index 0e169b9..102c0b1 100644 --- a/roles/tripleo_undercloud_minion_install/tasks/main.yml +++ b/roles/tripleo_undercloud_minion_install/tasks/main.yml @@ -2,7 +2,7 @@ - name: Setup undercloud minion install facts set_fact: _install_cmd: >- - openstack undercloud minion install + {{ openstack_bin }} undercloud minion install {{ tripleo_undercloud_minion_install_force_stack_update | ternary("--force-stack-update", '') }} {{ tripleo_undercloud_minion_install_no_validations | ternary("--no-validations", '') }} {{ tripleo_undercloud_minion_install_dry_run | ternary("--dry-run", '') }} @@ -13,6 +13,7 @@ - name: Preserve existing log file if exists timestamp_file: path: "{{ tripleo_undercloud_minion_install_log }}" + when: tripleo_undercloud_minion_install_log_output|bool - name: Show the underclound minion install command debug: @@ -24,6 +25,6 @@ args: chdir: "{{ tripleo_undercloud_minion_install_home_dir }}" async: "{{ tripleo_undercloud_minion_install_timeout }}" - poll: 10 + poll: "{{ tripleo_undercloud_minion_install_poll }}" register: tripleo_undercloud_minion_install_result changed_when: true diff --git a/roles/tripleo_undercloud_minion_upgrade/README.md b/roles/tripleo_undercloud_minion_upgrade/README.md index e541ad5..993927e 100644 --- a/roles/tripleo_undercloud_minion_upgrade/README.md +++ b/roles/tripleo_undercloud_minion_upgrade/README.md @@ -19,7 +19,8 @@ Role Variables * `tripleo_undercloud_minion_upgrade_log_combine`: (Boolean) Flag to combine stdout and stderr in the logfile. Default: true * `tripleo_undercloud_minion_upgrade_log_output`: (Boolean) Flag to log the output to a file rather than show it in the ansible output. Default: true * `tripleo_undercloud_minion_upgrade_no_validations`: (Boolean) Flag to add --no-validations to the upgrade. Default: false -* `tripleo_undercloud_minion_upgrade_timeout`: (Number) Timeout for the upgrade command. Default: 7200 +* `tripleo_undercloud_minion_upgrade_poll`: (Integer) Number of seconds to wait between checks to see if the upgrade command has completed. This should be set to a value greater or equal to 1. Default: 10 +* `tripleo_undercloud_minion_upgrade_timeout`: (Integer) Timeout for the upgrade command. Default: 7200 * `tripleo_undercloud_minion_upgrade_yes`: (Boolean) Flag to add --yes to the upgrade. Default: false * `tripleo_undercloud_minion_upgrade_log`: (String) Upgrade log file path. Default: "{{ tripleo_undercloud_minion_upgrade_home_dir }}/undercloud_minion_upgrade.log" diff --git a/roles/tripleo_undercloud_minion_upgrade/defaults/main.yml b/roles/tripleo_undercloud_minion_upgrade/defaults/main.yml index cc90ca9..f6b013a 100644 --- a/roles/tripleo_undercloud_minion_upgrade/defaults/main.yml +++ b/roles/tripleo_undercloud_minion_upgrade/defaults/main.yml @@ -1,5 +1,6 @@ --- # defaults file for tripleo_undercloud_minion_upgrade +openstack_bin: openstack tripleo_undercloud_minion_upgrade_debug: false tripleo_undercloud_minion_upgrade_dry_run: false tripleo_undercloud_minion_upgrade_force_stack_update: false @@ -7,6 +8,7 @@ tripleo_undercloud_minion_upgrade_home_dir: "{{ ansible_env.HOME }}" tripleo_undercloud_minion_upgrade_log_combine: true tripleo_undercloud_minion_upgrade_log_output: true tripleo_undercloud_minion_upgrade_no_validations: false +tripleo_undercloud_minion_upgrade_poll: 10 tripleo_undercloud_minion_upgrade_timeout: 7200 tripleo_undercloud_minion_upgrade_yes: false -tripleo_undercloud_minion_upgrade_log: "{{ tripleo_undercloud_minion_home_dir }}/undercloud_minion_upgrade.log" +tripleo_undercloud_minion_upgrade_log: "{{ tripleo_undercloud_minion_upgrade_home_dir }}/undercloud_minion_upgrade.log" diff --git a/roles/tripleo_undercloud_minion_upgrade/molecule/default/molecule.yml b/roles/tripleo_undercloud_minion_upgrade/molecule/default/molecule.yml new file mode 100644 index 0000000..e9ae0b7 --- /dev/null +++ b/roles/tripleo_undercloud_minion_upgrade/molecule/default/molecule.yml @@ -0,0 +1,22 @@ +--- +driver: + name: delegated + options: + managed: false + ansible_connection_options: + ansible_connection: local +log: true +lint: + name: yamllint + enabled: false +platforms: + - name: instance +provisioner: + name: ansible +scenario: + name: default + test_sequence: + - prepare + - syntax + - converge + - verify diff --git a/roles/tripleo_undercloud_minion_upgrade/molecule/default/playbook.yml b/roles/tripleo_undercloud_minion_upgrade/molecule/default/playbook.yml new file mode 100644 index 0000000..48bb6ff --- /dev/null +++ b/roles/tripleo_undercloud_minion_upgrade/molecule/default/playbook.yml @@ -0,0 +1,66 @@ +--- +- name: Converge + hosts: all + collections: + - tripleo.operator + vars: + openstack_bin: echo + tripleo_os_cloud: undercloud + tripleo_undercloud_minion_upgrade_debug: true + tripleo_undercloud_minion_upgrade_log_output: false + tripleo_undercloud_minion_upgrade_log_combine: false + tripleo_undercloud_minion_upgrade_poll: 1 + tasks: + + - name: "Include tripleo_undercloud_minion_upgrade" + include_role: + name: "tripleo_undercloud_minion_upgrade" + + - name: Check role + assert: + that: + - tripleo_undercloud_minion_upgrade_result.stdout == "undercloud minion upgrade" + + - name: Check parameter "tripleo_undercloud_minion_upgrade_force_stack_update" + include_role: + name: "tripleo_undercloud_minion_upgrade" + vars: + tripleo_undercloud_minion_upgrade_force_stack_update: true + + - name: Assert "tripleo_undercloud_minion_upgrade_force_stack_update" + assert: + that: + - tripleo_undercloud_minion_upgrade_result.stdout == "undercloud minion upgrade --force-stack-update" + + - name: Check parameter "tripleo_undercloud_minion_upgrade_no_validations" + include_role: + name: "tripleo_undercloud_minion_upgrade" + vars: + tripleo_undercloud_minion_upgrade_no_validations: true + + - name: Assert "tripleo_undercloud_minion_upgrade_no_validations" + assert: + that: + - tripleo_undercloud_minion_upgrade_result.stdout == "undercloud minion upgrade --no-validations" + + - name: Check parameter "tripleo_undercloud_minion_upgrade_dry_run" + include_role: + name: "tripleo_undercloud_minion_upgrade" + vars: + tripleo_undercloud_minion_upgrade_dry_run: true + + - name: Assert "tripleo_undercloud_minion_upgrade_dry_run" + assert: + that: + - tripleo_undercloud_minion_upgrade_result.stdout == "undercloud minion upgrade --dry-run" + + - name: Check parameter "tripleo_undercloud_minion_upgrade_yes" + include_role: + name: "tripleo_undercloud_minion_upgrade" + vars: + tripleo_undercloud_minion_upgrade_yes: true + + - name: Assert "tripleo_undercloud_minion_upgrade_yes" + assert: + that: + - tripleo_undercloud_minion_upgrade_result.stdout == "undercloud minion upgrade --yes" diff --git a/roles/tripleo_undercloud_minion_upgrade/molecule/default/prepare.yml b/roles/tripleo_undercloud_minion_upgrade/molecule/default/prepare.yml new file mode 100644 index 0000000..63bb6ab --- /dev/null +++ b/roles/tripleo_undercloud_minion_upgrade/molecule/default/prepare.yml @@ -0,0 +1,8 @@ +--- +- name: Prepare + hosts: all + tasks: + + - name: Include molecule prep + include_role: + name: test_molecule_prep diff --git a/roles/tripleo_undercloud_minion_upgrade/tasks/main.yml b/roles/tripleo_undercloud_minion_upgrade/tasks/main.yml index 372fff1..a2960ae 100644 --- a/roles/tripleo_undercloud_minion_upgrade/tasks/main.yml +++ b/roles/tripleo_undercloud_minion_upgrade/tasks/main.yml @@ -2,7 +2,7 @@ - name: Setup undercloud minion upgrade facts set_fact: _upgrade_cmd: >- - openstack undercloud minion upgrade + {{ openstack_bin }} undercloud minion upgrade {{ tripleo_undercloud_minion_upgrade_force_stack_update | ternary("--force-stack-update", '') }} {{ tripleo_undercloud_minion_upgrade_no_validations | ternary("--no-validations", '') }} {{ tripleo_undercloud_minion_upgrade_dry_run | ternary("--dry-run", '') }} @@ -13,6 +13,7 @@ - name: Preserve existing log file if exists timestamp_file: path: "{{ tripleo_undercloud_minion_upgrade_log }}" + when: tripleo_undercloud_minion_upgrade_log_output|bool - name: Show the underclound minion upgrade command debug: @@ -24,6 +25,6 @@ args: chdir: "{{ tripleo_undercloud_minion_upgrade_home_dir }}" async: "{{ tripleo_undercloud_minion_upgrade_timeout }}" - poll: 10 + poll: "{{ tripleo_undercloud_minion_upgrade_poll }}" register: tripleo_undercloud_minion_upgrade_result changed_when: true diff --git a/roles/tripleo_undercloud_upgrade/README.md b/roles/tripleo_undercloud_upgrade/README.md index 08f80b2..9f43d84 100644 --- a/roles/tripleo_undercloud_upgrade/README.md +++ b/roles/tripleo_undercloud_upgrade/README.md @@ -19,7 +19,8 @@ Role Variables * `tripleo_undercloud_upgrade_log_combine`: (Boolean) Flag to combine stdout and stderr in the logfile. Default: true * `tripleo_undercloud_upgrade_log_output`: (Boolean) Flag to log the output to a file rather than show it in the ansible output. Default: true * `tripleo_undercloud_upgrade_no_validations`: (Boolean) Flag to add --no-validations to the upgrade. Default: false -* `tripleo_undercloud_upgrade_timeout`: (Number) Timeout for the upgrade command. Default: 7200 +* `tripleo_undercloud_upgrade_poll`: (Integer) Number of seconds to wait between checks to see if the upgrade command has completed. This should be set to a value greater or equal to 1. Default: 10 +* `tripleo_undercloud_upgrade_timeout`: (Integer) Timeout for the upgrade command. Default: 7200 * `tripleo_undercloud_upgrade_yes`: (Boolean) Flag to add --yes to the upgrade. Default: false * `tripleo_undercloud_upgrade_log`: (String) Upgrade log file path. Default: "{{ tripleo_undercloud_upgrade_home_dir }}/undercloud_upgrade.log" diff --git a/roles/tripleo_undercloud_upgrade/defaults/main.yml b/roles/tripleo_undercloud_upgrade/defaults/main.yml index c6ff9fe..75707f8 100644 --- a/roles/tripleo_undercloud_upgrade/defaults/main.yml +++ b/roles/tripleo_undercloud_upgrade/defaults/main.yml @@ -1,5 +1,6 @@ --- # defaults file for tripleo-undercloud +openstack_bin: openstack tripleo_undercloud_upgrade_debug: false tripleo_undercloud_upgrade_dry_run: false tripleo_undercloud_upgrade_force_stack_update: false @@ -8,6 +9,7 @@ tripleo_undercloud_upgrade_inflight_validations: false tripleo_undercloud_upgrade_log_combine: true tripleo_undercloud_upgrade_log_output: true tripleo_undercloud_upgrade_no_validations: false +tripleo_undercloud_upgrade_poll: 10 tripleo_undercloud_upgrade_timeout: 7200 tripleo_undercloud_upgrade_yes: false tripleo_undercloud_upgrade_log: "{{ tripleo_undercloud_upgrade_home_dir }}/undercloud_upgrade.log" diff --git a/roles/tripleo_undercloud_upgrade/molecule/default/molecule.yml b/roles/tripleo_undercloud_upgrade/molecule/default/molecule.yml new file mode 100644 index 0000000..e9ae0b7 --- /dev/null +++ b/roles/tripleo_undercloud_upgrade/molecule/default/molecule.yml @@ -0,0 +1,22 @@ +--- +driver: + name: delegated + options: + managed: false + ansible_connection_options: + ansible_connection: local +log: true +lint: + name: yamllint + enabled: false +platforms: + - name: instance +provisioner: + name: ansible +scenario: + name: default + test_sequence: + - prepare + - syntax + - converge + - verify diff --git a/roles/tripleo_undercloud_upgrade/molecule/default/playbook.yml b/roles/tripleo_undercloud_upgrade/molecule/default/playbook.yml new file mode 100644 index 0000000..fa0f831 --- /dev/null +++ b/roles/tripleo_undercloud_upgrade/molecule/default/playbook.yml @@ -0,0 +1,77 @@ +--- +- name: Converge + hosts: all + collections: + - tripleo.operator + vars: + openstack_bin: echo + tripleo_os_cloud: undercloud + tripleo_undercloud_upgrade_debug: true + tripleo_undercloud_upgrade_log_output: false + tripleo_undercloud_upgrade_log_combine: false + tripleo_undercloud_upgrade_poll: 1 + tasks: + + - name: "Include tripleo_undercloud_upgrade" + include_role: + name: "tripleo_undercloud_upgrade" + + - name: Check role + assert: + that: + - tripleo_undercloud_upgrade_result.stdout == "undercloud upgrade" + + - name: Check parameter "tripleo_undercloud_upgrade_force_stack_update" + include_role: + name: "tripleo_undercloud_upgrade" + vars: + tripleo_undercloud_upgrade_force_stack_update: true + + - name: Assert "tripleo_undercloud_upgrade_force_stack_update" + assert: + that: + - tripleo_undercloud_upgrade_result.stdout == "undercloud upgrade --force-stack-update" + + - name: Check parameter "tripleo_undercloud_upgrade_no_validations" + include_role: + name: "tripleo_undercloud_upgrade" + vars: + tripleo_undercloud_upgrade_no_validations: true + + - name: Assert "tripleo_undercloud_upgrade_no_validations" + assert: + that: + - tripleo_undercloud_upgrade_result.stdout == "undercloud upgrade --no-validations" + + - name: Check parameter "tripleo_undercloud_upgrade_inflight_validations" + include_role: + name: "tripleo_undercloud_upgrade" + vars: + tripleo_undercloud_upgrade_inflight_validations: true + + - name: Assert "tripleo_undercloud_upgrade_inflight_validations" + assert: + that: + - tripleo_undercloud_upgrade_result.stdout == "undercloud upgrade --inflight-validations" + + - name: Check parameter "tripleo_undercloud_upgrade_dry_run" + include_role: + name: "tripleo_undercloud_upgrade" + vars: + tripleo_undercloud_upgrade_dry_run: true + + - name: Assert "tripleo_undercloud_upgrade_dry_run" + assert: + that: + - tripleo_undercloud_upgrade_result.stdout == "undercloud upgrade --dry-run" + + - name: Check parameter "tripleo_undercloud_upgrade_yes" + include_role: + name: "tripleo_undercloud_upgrade" + vars: + tripleo_undercloud_upgrade_yes: true + + - name: Assert "tripleo_undercloud_upgrade_yes" + assert: + that: + - tripleo_undercloud_upgrade_result.stdout == "undercloud upgrade --yes" diff --git a/roles/tripleo_undercloud_upgrade/molecule/default/prepare.yml b/roles/tripleo_undercloud_upgrade/molecule/default/prepare.yml new file mode 100644 index 0000000..63bb6ab --- /dev/null +++ b/roles/tripleo_undercloud_upgrade/molecule/default/prepare.yml @@ -0,0 +1,8 @@ +--- +- name: Prepare + hosts: all + tasks: + + - name: Include molecule prep + include_role: + name: test_molecule_prep diff --git a/roles/tripleo_undercloud_upgrade/tasks/main.yml b/roles/tripleo_undercloud_upgrade/tasks/main.yml index 2d1837b..a1cc707 100644 --- a/roles/tripleo_undercloud_upgrade/tasks/main.yml +++ b/roles/tripleo_undercloud_upgrade/tasks/main.yml @@ -2,7 +2,7 @@ - name: Setup undercloud upgrade facts set_fact: _upgrade_cmd: >- - openstack undercloud upgrade + {{ openstack_bin }} undercloud upgrade {{ tripleo_undercloud_upgrade_force_stack_update | ternary("--force-stack-update", '') }} {{ tripleo_undercloud_upgrade_no_validations | ternary("--no-validations", '') }} {{ tripleo_undercloud_upgrade_inflight_validations | ternary("--inflight-validations", '') }} @@ -14,6 +14,7 @@ - name: Preserve existing log file if exists timestamp_file: path: "{{ tripleo_undercloud_upgrade_log }}" + when: tripleo_undercloud_upgrade_log_output|bool - name: Show the underclound upgrade command debug: @@ -26,6 +27,6 @@ chdir: "{{ tripleo_undercloud_upgrade_home_dir }}" warn: false async: "{{ tripleo_undercloud_upgrade_timeout }}" - poll: 10 + poll: "{{ tripleo_undercloud_upgrade_poll }}" register: tripleo_undercloud_upgrade_result changed_when: true diff --git a/zuul.d/molecule.yaml b/zuul.d/molecule.yaml index 28fba05..b9466d1 100644 --- a/zuul.d/molecule.yaml +++ b/zuul.d/molecule.yaml @@ -11,9 +11,14 @@ - tripleo-operator-molecule-tripleo_overcloud_deploy - tripleo-operator-molecule-tripleo_overcloud_export - tripleo-operator-molecule-tripleo_overcloud_failures - - tripleo-operator-molecule-tripleo_overcloud_node_introspect - - tripleo-operator-molecule-tripleo_overcloud_node_configure - tripleo-operator-molecule-tripleo_overcloud_node_clean + - tripleo-operator-molecule-tripleo_overcloud_node_configure + - tripleo-operator-molecule-tripleo_overcloud_node_introspect + - tripleo-operator-molecule-tripleo_undercloud_backup + - tripleo-operator-molecule-tripleo_undercloud_install + - tripleo-operator-molecule-tripleo_undercloud_minion_install + - tripleo-operator-molecule-tripleo_undercloud_minion_upgrade + - tripleo-operator-molecule-tripleo_undercloud_upgrade gate: jobs: @@ -26,10 +31,15 @@ - tripleo-operator-molecule-tripleo_overcloud_deploy - tripleo-operator-molecule-tripleo_overcloud_export - tripleo-operator-molecule-tripleo_overcloud_failures - - tripleo-operator-molecule-tripleo_overcloud_node_introspect - - tripleo-operator-molecule-tripleo_overcloud_node_configure - tripleo-operator-molecule-tripleo_overcloud_node_clean - tripleo-operator-molecule-tripleo_container_image_prepare + - tripleo-operator-molecule-tripleo_overcloud_node_configure + - tripleo-operator-molecule-tripleo_overcloud_node_introspect + - tripleo-operator-molecule-tripleo_undercloud_backup + - tripleo-operator-molecule-tripleo_undercloud_install + - tripleo-operator-molecule-tripleo_undercloud_minion_install + - tripleo-operator-molecule-tripleo_undercloud_minion_upgrade + - tripleo-operator-molecule-tripleo_undercloud_upgrade - job: files: @@ -134,3 +144,43 @@ parent: tripleo-operator-molecule-base vars: tox_extra_args: tripleo_container_image_prepare + +- job: + files: + - ^roles/tripleo_undercloud_backup/.* + name: tripleo-operator-molecule-tripleo_undercloud_backup + parent: tripleo-operator-molecule-base + vars: + tox_extra_args: tripleo_undercloud_backup + +- job: + files: + - ^roles/tripleo_undercloud_install/.* + name: tripleo-operator-molecule-tripleo_undercloud_install + parent: tripleo-operator-molecule-base + vars: + tox_extra_args: tripleo_undercloud_install + +- job: + files: + - ^roles/tripleo_undercloud_minion_install/.* + name: tripleo-operator-molecule-tripleo_undercloud_minion_install + parent: tripleo-operator-molecule-base + vars: + tox_extra_args: tripleo_undercloud_minion_install + +- job: + files: + - ^roles/tripleo_undercloud_minion_upgrade/.* + name: tripleo-operator-molecule-tripleo_undercloud_minion_upgrade + parent: tripleo-operator-molecule-base + vars: + tox_extra_args: tripleo_undercloud_minion_upgrade + +- job: + files: + - ^roles/tripleo_undercloud_upgrade/.* + name: tripleo-operator-molecule-tripleo_undercloud_upgrade + parent: tripleo-operator-molecule-base + vars: + tox_extra_args: tripleo_undercloud_upgrade