diff --git a/roles/tripleo_deploy/README.md b/roles/tripleo_deploy/README.md new file mode 100644 index 0000000..0d09eb0 --- /dev/null +++ b/roles/tripleo_deploy/README.md @@ -0,0 +1,83 @@ +tripleo_deploy +============== + +A role to execute a single node standalone deployment. + +Requirements +------------ + +None. + +Role Variables +-------------- + +* `tripleo_deploy_become`: (Boolean) Execute command with escalated privileges. Default: true +* `tripleo_deploy_cleanup`: (Boolean) Cleanup temporary files after execution. Default: false +* `tripleo_deploy_control_virtual_ip`: (String) Control plain VIP address. +* `tripleo_deploy_debug`: (Boolean) Flag to print out the command that is run. Default: false +* `tripleo_deploy_deployment_python_interpreter`: (String) Path to a python interpreter for the deployment actions. +* `tripleo_deploy_deployment_user`: (String) User who is executing the tripleo deployment via sudo. Defaults: "{{ ansible_env.USER }}" +* `tripleo_deploy_environment_files`: (List) A list of environment file paths for the deployment. +* `tripleo_deploy_force_stack_create`: (Boolean) Flag to force stack create. Default: false +* `tripleo_deploy_force_stack_update`: (Boolean) Flag to force stack update. Default: false +* `tripleo_deploy_heat_api_port`: (Number) Heat API port to use for the installer. +* `tripleo_deploy_heat_user`: (String) User to execute the non-privleged heat-all process. +* `tripleo_deploy_hieradata_override`: (String) Path to hierdata override file. +* `tripleo_deploy_home_dir`: (String) Path to the directory to execute the command in. Default: "{{ ansible_env.HOME }}" +* `tripleo_deploy_inflight_validations`: (Boolean) Flag to enable inflight validations. Default: false +* `tripleo_deploy_keep_running`: (Boolean) Flag to keep the heat instance running after the deploy has run. Default: false +* `tripleo_deploy_local_domain`: (String): Local domaon for standalone cloud and the endpoints. +* `tripleo_deploy_local_ip`: (String) Local IP address to use for the cloud trafic. REQUIRED. +* `tripleo_deploy_log`: (String) Path to a log file for the command output. Default: "{{ tripleo_deploy_home_dir }}/overcloud_deploy.log" +* `tripleo_deploy_log_combine`: (Boolean) Flag to enable captching stderr with stdout. Default: true +* `tripleo_deploy_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 +* `tripleo_deploy_networks_file`: (String) File path to a networks file for the deployment. +* `tripleo_deploy_output_dir`: (String) Directory to write output data to. +* `tripleo_deploy_output_only`: (String) Flag to skip ansible execution and only output the deployment scripts. Default: false +* `tripleo_deploy_plan_environment_file`: (String) File path to a plan environment file. +* `tripleo_deploy_poll`: (Integer) Number of seconds to wait between each checks to see if the deployment command has completed. Default: 10 +* `tripleo_deploy_public_virtual_ip`: (String) Public network VIP. +* `tripleo_deploy_roles_file`: (String) File path to a deployment roles file. +* `tripleo_deploy_stack`: (String) Name for ephemeral stack. Default: standalone +* `tripleo_deploy_standalone`: (Boolean) Flag to inidicate that a standalone cloud is being deployed. Default: true +* `tripleo_deploy_standalone_role`: (String) Role name to deploy. Default: Standalone +* `tripleo_deploy_templates`: (String) Path to the directory containing heat templates for the deployment. Default: /usr/share/openstack-tripleo-heat-templates +* `tripleo_deploy_timeout`: (Integer) Number in seconds to wait for the ansible execution of the deployment command to finish. This should be larger than the `tripleo_deploy_timeout_arg` value. Default: 5700 +* `tripleo_deploy_timeout_arg`: (Integer) Number in minutes for the deployment to run. Default: 90 +* `tripleo_deploy_update_plan_only`: (Boolean) Flag to enable only updating the plan. Default: false +* `tripleo_deploy_upgrade`: (Boolean) Flag to indicate upgrade an existing deployment. Default: true +* `tripleo_deploy_yes`: (Boolean) Flag to skip yes/no prompts. Default: true + +Output Variables +---------------- + +* `tripleo_deploy_output`: (String) The command standard output. +* `tripleo_deploy_result`: Ansible shell execution results + +Dependencies +------------ + +None. + +Example Playbook +---------------- + +Example overcloud deploy execution playbook + +```yaml +- hosts: standalone + gather_facts: true + tasks: + - name: Run standalone deploy + import_role: + name: tripleo_deploy + vars: + tripleo_deploy_local_ip: 192.168.24.2/24 + tripleo_deploy_environment_files: + - /usr/share/openstack-tripleo-heat-templates/environments/enable-swap.yaml +``` + +License +------- + +Apache-2.0 diff --git a/roles/tripleo_deploy/defaults/main.yml b/roles/tripleo_deploy/defaults/main.yml new file mode 100644 index 0000000..c0fe1cf --- /dev/null +++ b/roles/tripleo_deploy/defaults/main.yml @@ -0,0 +1,39 @@ +--- +# defaults file for tripleo_deploy +openstack_bin: openstack +tripleo_deploy_become: true +tripleo_deploy_cleanup: false +tripleo_deploy_control_virtual_ip: +tripleo_deploy_debug: false +tripleo_deploy_deployment_python_interpreter: +tripleo_deploy_deployment_user: "{{ ansible_env.USER }}" +tripleo_deploy_environment_files: [] +tripleo_deploy_force_stack_create: false +tripleo_deploy_force_stack_update: false +tripleo_deploy_heat_api_port: +tripleo_deploy_heat_user: +tripleo_deploy_hieradata_override: +tripleo_deploy_home_dir: "{{ ansible_env.HOME }}" +tripleo_deploy_inflight_validations: false +tripleo_deploy_keep_running: false +tripleo_deploy_local_domain: +tripleo_deploy_local_ip: +tripleo_deploy_log: "{{ tripleo_deploy_home_dir }}/overcloud_deploy.log" +tripleo_deploy_log_combine: true +tripleo_deploy_log_output: true +tripleo_deploy_networks_file: +tripleo_deploy_output_dir: +tripleo_deploy_output_only: false +tripleo_deploy_override_ansible_cfg: +tripleo_deploy_plan_environment_file: +tripleo_deploy_poll: 10 +tripleo_deploy_public_virtual_ip: +tripleo_deploy_stack: standalone +tripleo_deploy_standalone: true +tripleo_deploy_standalone_role: Standalone +tripleo_deploy_templates: /usr/share/openstack-tripleo-heat-templates +tripleo_deploy_roles_file: "{{ tripleo_deploy_templates }}/roles/Standalone.yaml" +tripleo_deploy_timeout: 5700 +tripleo_deploy_timeout_arg: 90 +tripleo_deploy_upgrade: false +tripleo_deploy_yes: true diff --git a/roles/tripleo_deploy/meta/main.yml b/roles/tripleo_deploy/meta/main.yml new file mode 100644 index 0000000..61cf025 --- /dev/null +++ b/roles/tripleo_deploy/meta/main.yml @@ -0,0 +1,42 @@ +--- +# Copyright 2019 Red Hat, Inc. +# All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + + +galaxy_info: + author: OpenStack + description: TripleO Operator Role -- tripleo_failures + company: Red Hat + license: Apache-2.0 + min_ansible_version: 2.8 + # + # Provide a list of supported platforms, and for each platform a list of versions. + # If you don't wish to enumerate all versions for a particular platform, use 'all'. + # To view available platforms and versions (or releases), visit: + # https://galaxy.ansible.com/api/v1/platforms/ + # + platforms: + - name: CentOS + versions: + - 7 + - 8 + + galaxy_tags: + - tripleo + + +# List your role dependencies here, one per line. Be sure to remove the '[]' above, +# if you add dependencies to this list. +dependencies: [] diff --git a/roles/tripleo_deploy/molecule/default/molecule.yml b/roles/tripleo_deploy/molecule/default/molecule.yml new file mode 100644 index 0000000..e9ae0b7 --- /dev/null +++ b/roles/tripleo_deploy/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_deploy/molecule/default/playbook.yml b/roles/tripleo_deploy/molecule/default/playbook.yml new file mode 100644 index 0000000..ce80ad5 --- /dev/null +++ b/roles/tripleo_deploy/molecule/default/playbook.yml @@ -0,0 +1,387 @@ +--- +- name: Converge + hosts: all + collections: + - tripleo.operator + vars: + openstack_bin: echo + tripleo_deploy_become: false + tripleo_deploy_debug: true + tripleo_deploy_log_output: false + tripleo_deploy_log_combine: false + tripleo_deploy_poll: 1 + tripleo_deploy_local_ip: 192.168.24.2/24 + tripleo_deploy_deployment_user: + tripleo_deploy_roles_file: + tripleo_deploy_yes: false + tasks: + + - name: "Include tripleo_deploy" + include_role: + name: "tripleo_deploy" + + - name: Check role + assert: + that: + - tripleo_deploy_output == + "tripleo deploy --templates /usr/share/openstack-tripleo-heat-templates " + "--standalone --stack standalone --standalone-role Standalone --timeout 90 " + "--local-ip 192.168.24.2/24" + + - name: Check parameter "tripleo_deploy_stack" + include_role: + name: "tripleo_deploy" + vars: + tripleo_deploy_templates: + tripleo_deploy_stack: test + tripleo_deploy_standalone: false + tripleo_deploy_standalone_role: + tripleo_deploy_timeout_arg: + + - name: Assert "tripleo_deploy_stack" + assert: + that: + - tripleo_deploy_output == "tripleo deploy --stack test --local-ip 192.168.24.2/24" + + - name: Check parameter "tripleo_deploy_upgrade" + include_role: + name: "tripleo_deploy" + vars: + tripleo_deploy_templates: + tripleo_deploy_stack: + tripleo_deploy_standalone: false + tripleo_deploy_standalone_role: + tripleo_deploy_timeout_arg: + tripleo_deploy_upgrade: true + + - name: Assert "tripleo_deploy_upgrade" + assert: + that: + - tripleo_deploy_output == "tripleo deploy --upgrade --local-ip 192.168.24.2/24" + + - name: Check parameter "tripleo_deploy_yes" + include_role: + name: "tripleo_deploy" + vars: + tripleo_deploy_templates: + tripleo_deploy_stack: + tripleo_deploy_standalone: false + tripleo_deploy_standalone_role: + tripleo_deploy_timeout_arg: + tripleo_deploy_yes: true + + - name: Assert "tripleo_deploy_yes" + assert: + that: + - tripleo_deploy_output == "tripleo deploy --yes --local-ip 192.168.24.2/24" + + - name: Check parameter "tripleo_deploy_output_dir" + include_role: + name: "tripleo_deploy" + vars: + tripleo_deploy_templates: + tripleo_deploy_stack: + tripleo_deploy_standalone: false + tripleo_deploy_standalone_role: + tripleo_deploy_timeout_arg: + tripleo_deploy_output_dir: /foo + + - name: Assert "tripleo_deploy_output_dir" + assert: + that: + - tripleo_deploy_output == "tripleo deploy --output-dir /foo --local-ip 192.168.24.2/24" + + - name: Check parameter "tripleo_deploy_output_only" + include_role: + name: "tripleo_deploy" + vars: + tripleo_deploy_templates: + tripleo_deploy_stack: + tripleo_deploy_standalone: false + tripleo_deploy_standalone_role: + tripleo_deploy_timeout_arg: + tripleo_deploy_output_only: true + + - name: Assert "tripleo_deploy_output_only" + assert: + that: + - tripleo_deploy_output == "tripleo deploy --output-only --local-ip 192.168.24.2/24" + + - name: Check parameter "tripleo_deploy_environment_files" + include_role: + name: "tripleo_deploy" + vars: + tripleo_deploy_templates: + tripleo_deploy_stack: + tripleo_deploy_standalone: false + tripleo_deploy_standalone_role: + tripleo_deploy_timeout_arg: + tripleo_deploy_environment_files: + - /foo/bar.yml + - /foo/baz.yml + + - name: Assert "tripleo_deploy_environment_files" + assert: + that: + - tripleo_deploy_output == "tripleo deploy -e /foo/bar.yml -e /foo/baz.yml --local-ip 192.168.24.2/24" + + - name: Check parameter "tripleo_deploy_roles_file" + include_role: + name: "tripleo_deploy" + vars: + tripleo_deploy_templates: + tripleo_deploy_stack: + tripleo_deploy_standalone: false + tripleo_deploy_standalone_role: + tripleo_deploy_timeout_arg: + tripleo_deploy_roles_file: roles.yaml + + - name: Assert "tripleo_deploy_roles_file" + assert: + that: + - tripleo_deploy_output == "tripleo deploy -r roles.yaml --local-ip 192.168.24.2/24" + + - name: Check parameter "tripleo_deploy_networks_file" + include_role: + name: "tripleo_deploy" + vars: + tripleo_deploy_templates: + tripleo_deploy_stack: + tripleo_deploy_standalone: false + tripleo_deploy_standalone_role: + tripleo_deploy_timeout_arg: + tripleo_deploy_networks_file: net.yaml + + - name: Assert "tripleo_deploy_networks_file" + assert: + that: + - tripleo_deploy_output == "tripleo deploy -n net.yaml --local-ip 192.168.24.2/24" + + - name: Check parameter "tripleo_deploy_plan_environment_file" + include_role: + name: "tripleo_deploy" + vars: + tripleo_deploy_templates: + tripleo_deploy_stack: + tripleo_deploy_standalone: false + tripleo_deploy_standalone_role: + tripleo_deploy_timeout_arg: + tripleo_deploy_plan_environment_file: plan.yaml + + - name: Assert "tripleo_deploy_plan_environment_file" + assert: + that: + - tripleo_deploy_output == "tripleo deploy -p plan.yaml --local-ip 192.168.24.2/24" + + - name: Check parameter "tripleo_deploy_heat_api_port" + include_role: + name: "tripleo_deploy" + vars: + tripleo_deploy_templates: + tripleo_deploy_stack: + tripleo_deploy_standalone: false + tripleo_deploy_standalone_role: + tripleo_deploy_timeout_arg: + tripleo_deploy_heat_api_port: 1111 + + - name: Assert "tripleo_deploy_heat_api_port" + assert: + that: + - tripleo_deploy_output == "tripleo deploy --heat-api-port 1111 --local-ip 192.168.24.2/24" + + - name: Check parameter "tripleo_deploy_heat_user" + include_role: + name: "tripleo_deploy" + vars: + tripleo_deploy_templates: + tripleo_deploy_stack: + tripleo_deploy_standalone: false + tripleo_deploy_standalone_role: + tripleo_deploy_timeout_arg: + tripleo_deploy_heat_user: foo + + - name: Assert "tripleo_deploy_heat_user" + assert: + that: + - tripleo_deploy_output == "tripleo deploy --heat-user foo --local-ip 192.168.24.2/24" + + - name: Check parameter "tripleo_deploy_deployment_user" + include_role: + name: "tripleo_deploy" + vars: + tripleo_deploy_templates: + tripleo_deploy_stack: + tripleo_deploy_standalone: false + tripleo_deploy_standalone_role: + tripleo_deploy_timeout_arg: + tripleo_deploy_deployment_user: user + + - name: Assert "tripleo_deploy_deployment_user" + assert: + that: + - tripleo_deploy_output == "tripleo deploy --deployment-user user --local-ip 192.168.24.2/24" + + - name: Check parameter "tripleo_deploy_deployment_python_interpreter" + include_role: + name: "tripleo_deploy" + vars: + tripleo_deploy_templates: + tripleo_deploy_stack: + tripleo_deploy_standalone: false + tripleo_deploy_standalone_role: + tripleo_deploy_timeout_arg: + tripleo_deploy_deployment_python_interpreter: python2 + + - name: Assert "tripleo_deploy_deployment_python_interpreter" + assert: + that: + - tripleo_deploy_output == + "tripleo deploy --deployment-python-interpreter python2 --local-ip 192.168.24.2/24" + + - name: Check parameter "tripleo_deploy_control_virtual_ip" + include_role: + name: "tripleo_deploy" + vars: + tripleo_deploy_templates: + tripleo_deploy_stack: + tripleo_deploy_standalone: false + tripleo_deploy_standalone_role: + tripleo_deploy_timeout_arg: + tripleo_deploy_control_virtual_ip: 1.1.1.12 + + - name: Assert "tripleo_deploy_control_virtual_ip" + assert: + that: + - tripleo_deploy_output == + "tripleo deploy --local-ip 192.168.24.2/24 --control-virtual-ip 1.1.1.12" + + - name: Check parameter "tripleo_deploy_public_virtual_ip" + include_role: + name: "tripleo_deploy" + vars: + tripleo_deploy_templates: + tripleo_deploy_stack: + tripleo_deploy_standalone: false + tripleo_deploy_standalone_role: + tripleo_deploy_timeout_arg: + tripleo_deploy_public_virtual_ip: 1.1.1.13 + + - name: Assert "tripleo_deploy_public_virtual_ip" + assert: + that: + - tripleo_deploy_output == + "tripleo deploy --local-ip 192.168.24.2/24 --public-virtual-ip 1.1.1.13" + + - name: Check parameter "tripleo_deploy_local_domain" + include_role: + name: "tripleo_deploy" + vars: + tripleo_deploy_templates: + tripleo_deploy_stack: + tripleo_deploy_standalone: false + tripleo_deploy_standalone_role: + tripleo_deploy_timeout_arg: + tripleo_deploy_local_domain: rh.local + + - name: Assert "tripleo_deploy_local_domain" + assert: + that: + - tripleo_deploy_output == + "tripleo deploy --local-ip 192.168.24.2/24 --local-domain rh.local" + + - name: Check parameter "tripleo_deploy_cleanup" + include_role: + name: "tripleo_deploy" + vars: + tripleo_deploy_templates: + tripleo_deploy_stack: + tripleo_deploy_standalone: false + tripleo_deploy_standalone_role: + tripleo_deploy_timeout_arg: + tripleo_deploy_cleanup: true + + - name: Assert "tripleo_deploy_cleanup" + assert: + that: + - tripleo_deploy_output == "tripleo deploy --local-ip 192.168.24.2/24 --cleanup" + + - name: Check parameter "tripleo_deploy_hieradata_override" + include_role: + name: "tripleo_deploy" + vars: + tripleo_deploy_templates: + tripleo_deploy_stack: + tripleo_deploy_standalone: false + tripleo_deploy_standalone_role: + tripleo_deploy_timeout_arg: + tripleo_deploy_hieradata_override: /foo.yml + + - name: Assert "tripleo_deploy_hieradata_override" + assert: + that: + - tripleo_deploy_output == + "tripleo deploy --local-ip 192.168.24.2/24 --hieradata-override /foo.yml" + + - name: Check parameter "tripleo_deploy_keep_running" + include_role: + name: "tripleo_deploy" + vars: + tripleo_deploy_templates: + tripleo_deploy_stack: + tripleo_deploy_standalone: false + tripleo_deploy_standalone_role: + tripleo_deploy_timeout_arg: + tripleo_deploy_keep_running: true + + - name: Assert "tripleo_deploy_keep_running" + assert: + that: + - tripleo_deploy_output == "tripleo deploy --local-ip 192.168.24.2/24 --keep-running" + + - name: Check parameter "tripleo_deploy_inflight_validations" + include_role: + name: "tripleo_deploy" + vars: + tripleo_deploy_templates: + tripleo_deploy_stack: + tripleo_deploy_standalone: false + tripleo_deploy_standalone_role: + tripleo_deploy_timeout_arg: + tripleo_deploy_inflight_validations: true + + - name: Assert "tripleo_deploy_inflight_validations" + assert: + that: + - tripleo_deploy_output == "tripleo deploy --local-ip 192.168.24.2/24 --inflight-validations" + + - name: Check parameter "tripleo_deploy_force_stack_create" + include_role: + name: "tripleo_deploy" + vars: + tripleo_deploy_templates: + tripleo_deploy_stack: + tripleo_deploy_standalone: false + tripleo_deploy_standalone_role: + tripleo_deploy_timeout_arg: + tripleo_deploy_force_stack_create: true + + - name: Assert "tripleo_deploy_force_stack_create" + assert: + that: + - tripleo_deploy_output == "tripleo deploy --local-ip 192.168.24.2/24 --force-stack-create" + + - name: Check parameter "tripleo_deploy_force_stack_update" + include_role: + name: "tripleo_deploy" + vars: + tripleo_deploy_templates: + tripleo_deploy_stack: + tripleo_deploy_standalone: false + tripleo_deploy_standalone_role: + tripleo_deploy_timeout_arg: + tripleo_deploy_force_stack_update: true + + - name: Assert "tripleo_deploy_force_stack_update" + assert: + that: + - tripleo_deploy_output == "tripleo deploy --local-ip 192.168.24.2/24 --force-stack-update" diff --git a/roles/tripleo_deploy/molecule/default/prepare.yml b/roles/tripleo_deploy/molecule/default/prepare.yml new file mode 100644 index 0000000..63bb6ab --- /dev/null +++ b/roles/tripleo_deploy/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_deploy/tasks/main.yml b/roles/tripleo_deploy/tasks/main.yml new file mode 100644 index 0000000..f1cedea --- /dev/null +++ b/roles/tripleo_deploy/tasks/main.yml @@ -0,0 +1,93 @@ +--- +# tasks file for tripleo_deploy +- name: Validate local ip is set + fail: + msg: "tripleo_deploy_local_ip must be configured" + when: not tripleo_deploy_local_ip + +- name: Setup standalone deploy facts + set_fact: + _deploy_cmd: >- + {{ openstack_bin }} tripleo deploy + {{ tripleo_deploy_templates | ternary('--templates $DEPLOY_TEMPLATES', '') }} + {{ tripleo_deploy_standalone | ternary('--standalone', '') }} + {{ tripleo_deploy_upgrade | ternary('--upgrade', '') }} + {{ tripleo_deploy_yes | ternary('--yes', '') }} + {{ tripleo_deploy_output_dir | ternary('--output-dir $DEPLOY_OUTPUT_DIR', '') }} + {{ tripleo_deploy_output_only | ternary('--output-only', '') }} + {{ tripleo_deploy_stack | ternary('--stack $DEPLOY_STACK', '') }} + {{ tripleo_deploy_standalone_role | ternary('--standalone-role $DEPLOY_STANDALONE_ROLE', '') }} + {{ tripleo_deploy_timeout_arg | ternary('--timeout $DEPLOY_TIMEOUT_ARG', '') }} + {{ tripleo_deploy_environment_files | tripleo.operator.shell_arg_list(parameter='-e') }} + {{ tripleo_deploy_roles_file | ternary('-r $DEPLOY_ROLES_FILE', '') }} + {{ tripleo_deploy_networks_file | ternary('-n $DEPLOY_NETWORKS_FILE', '') }} + {{ tripleo_deploy_plan_environment_file | ternary('-p $DEPLOY_PLAN_ENV_FILE', '') }} + {{ tripleo_deploy_heat_api_port | ternary('--heat-api-port $DEPLOY_HEAT_API_PORT', '') }} + {{ tripleo_deploy_heat_user | ternary('--heat-user $DEPLOY_HEAT_USER', '') }} + {{ tripleo_deploy_deployment_user | ternary('--deployment-user $DEPLOY_DEPLOYMENT_USER', '') }} + {{ tripleo_deploy_deployment_python_interpreter | ternary('--deployment-python-interpreter $DEPLOY_PYTHON_INTERPRETER', '') }} + {{ tripleo_deploy_local_ip | ternary('--local-ip $DEPLOY_LOCAL_IP', '') }} + {{ tripleo_deploy_control_virtual_ip | ternary('--control-virtual-ip $DEPLOY_CONTROL_VIP', '') }} + {{ tripleo_deploy_public_virtual_ip | ternary('--public-virtual-ip $DEPLOY_PUBLIC_VIP', '') }} + {{ tripleo_deploy_local_domain | ternary('--local-domain $DEPLOY_LOCAL_DOMAIN', '') }} + {{ tripleo_deploy_cleanup | ternary('--cleanup', '') }} + {{ tripleo_deploy_hieradata_override | ternary('--hieradata-override $DEPLOY_HIERADATA_OVERRIDE', '') }} + {{ tripleo_deploy_keep_running | ternary('--keep-running', '') }} + {{ tripleo_deploy_inflight_validations | ternary('--inflight-validations', '') }} + {{ tripleo_deploy_force_stack_create | ternary('--force-stack-create', '') }} + {{ tripleo_deploy_force_stack_update | ternary('--force-stack-update', '') }} + {{ tripleo_deploy_log_output | ternary((">" ~ tripleo_deploy_log), '') }} + {{ tripleo_deploy_log_combine | ternary("2>&1", '') }} + _deploy_env: + DEPLOY_CONTROL_VIP: "{{ tripleo_deploy_control_virtual_ip }}" + DEPLOY_DEPLOYMENT_USER: "{{ tripleo_deploy_deployment_user }}" + DEPLOY_HEAT_API_PORT: "{{ tripleo_deploy_heat_api_port }}" + DEPLOY_HEAT_USER: "{{ tripleo_deploy_heat_user }}" + DEPLOY_HIERADATA_OVERRIDE: "{{ tripleo_deploy_hieradata_override }}" + DEPLOY_LOCAL_DOMAIN: "{{ tripleo_deploy_local_domain }}" + DEPLOY_LOCAL_IP: "{{ tripleo_deploy_local_ip }}" + DEPLOY_NETWORKS_FILE: "{{ tripleo_deploy_networks_file }}" + DEPLOY_OUTPUT_DIR: "{{ tripleo_deploy_output_dir }}" + DEPLOY_PLAN_ENV_FILE: "{{ tripleo_deploy_plan_environment_file }}" + DEPLOY_PUBLIC_VIP: "{{ tripleo_deploy_public_virtual_ip }}" + DEPLOY_PYTHON_INTERPRETER: "{{ tripleo_deploy_deployment_python_interpreter }}" + DEPLOY_ROLES_FILE: "{{ tripleo_deploy_roles_file }}" + DEPLOY_STACK: "{{ tripleo_deploy_stack }}" + DEPLOY_STANDALONE_ROLE: "{{ tripleo_deploy_standalone_role }}" + DEPLOY_TEMPLATES: "{{ tripleo_deploy_templates }}" + DEPLOY_TIMEOUT_ARG: "{{ tripleo_deploy_timeout_arg }}" + + +- name: Preserve existing log file if exists + timestamp_file: + path: "{{ tripleo_deploy_log }}" + when: tripleo_deploy_log_output|bool + +- name: Show debug information + when: tripleo_deploy_debug|bool + block: + - name: Show the standalone deploy command + debug: + var: _deploy_cmd + + - name: Show the standalone deploy environment + debug: + var: _deploy_env + +- name: Standalone deploy + shell: "{{ _deploy_cmd }}" # noqa 305 + environment: "{{ _deploy_env }}" + args: + executable: /bin/bash + chdir: "{{ tripleo_deploy_home_dir }}" + warn: false + become: "{{ tripleo_deploy_become }}" + register: tripleo_deploy_result + async: "{{ tripleo_deploy_timeout }}" + poll: "{{ tripleo_deploy_poll }}" + changed_when: false + when: not ansible_check_mode|bool + +- name: Set output fact + set_fact: + tripleo_deploy_output: "{{ tripleo_deploy_result.stdout }}" diff --git a/roles/tripleo_deploy/tests/inventory b/roles/tripleo_deploy/tests/inventory new file mode 100644 index 0000000..2fbb50c --- /dev/null +++ b/roles/tripleo_deploy/tests/inventory @@ -0,0 +1 @@ +localhost diff --git a/roles/tripleo_deploy/tests/test.yml b/roles/tripleo_deploy/tests/test.yml new file mode 100644 index 0000000..42ec380 --- /dev/null +++ b/roles/tripleo_deploy/tests/test.yml @@ -0,0 +1,4 @@ +--- +- hosts: localhost + roles: + - tripleo_deploy diff --git a/zuul.d/molecule.yaml b/zuul.d/molecule.yaml index b9466d1..f3cefbb 100644 --- a/zuul.d/molecule.yaml +++ b/zuul.d/molecule.yaml @@ -8,6 +8,7 @@ - tripleo-operator-molecule-tripleo_container_image_prepare - tripleo-operator-molecule-tripleo_container_image_push - tripleo-operator-molecule-tripleo_container_image_show + - tripleo-operator-molecule-tripleo_deploy - tripleo-operator-molecule-tripleo_overcloud_deploy - tripleo-operator-molecule-tripleo_overcloud_export - tripleo-operator-molecule-tripleo_overcloud_failures @@ -28,6 +29,7 @@ - tripleo-operator-molecule-tripleo_container_image_prepare - tripleo-operator-molecule-tripleo_container_image_push - tripleo-operator-molecule-tripleo_container_image_show + - tripleo-operator-molecule-tripleo_deploy - tripleo-operator-molecule-tripleo_overcloud_deploy - tripleo-operator-molecule-tripleo_overcloud_export - tripleo-operator-molecule-tripleo_overcloud_failures @@ -89,6 +91,14 @@ vars: tox_extra_args: tripleo_container_image_show +- job: + files: + - ^roles/tripleo_deploy/.* + name: tripleo-operator-molecule-tripleo_deploy + parent: tripleo-operator-molecule-base + vars: + tox_extra_args: tripleo_deploy + - job: files: - ^roles/tripleo_overcloud_deploy/.*