tripleo-operator-ansible/roles/tripleo_deploy/tasks/main.yml

101 lines
4.9 KiB
YAML

---
# 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: Write reproducer script
tripleo_shell_script:
dest: "{{ tripleo_deploy_home_dir }}/standalone_deploy.sh"
shell_command: "{{ _deploy_cmd }}"
shell_environment: "{{ _deploy_env }}"
when: tripleo_deploy_generate_scripts|bool
- 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 }}"