| --- |
| # ============LICENSE_START======================================================= |
| # Copyright (C) 2019 The Nordix Foundation. 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. |
| # |
| # SPDX-License-Identifier: Apache-2.0 |
| # ============LICENSE_END========================================================= |
| |
| - name: Copy Heat templates |
| copy: |
| src: "{{ item }}" |
| dest: "{{ config_path }}" |
| with_items: |
| - heat-template.yaml |
| - heat-server.yaml |
| - heat-jumphost.yaml |
| |
| - name: Set keypair name |
| set_fact: |
| keypair_name: "keypair-{{ heat_stack_name | regex_replace('\\.', '_') }}" |
| |
| - name: Delete keypair '{{ keypair_name }}' |
| os_keypair: |
| name: "{{ keypair_name }}" |
| state: absent |
| ignore_errors: true |
| |
| - name: Delete stack '{{ heat_stack_name }}' |
| os_stack: |
| name: "{{ heat_stack_name }}" |
| state: absent |
| wait: true |
| ignore_errors: false |
| register: stack_delete_output |
| |
| - name: Log stack delete output to console |
| debug: |
| msg: "{{ stack_delete_output }}" |
| |
| - name: Create keypair '{{ keypair_name }}' |
| os_keypair: |
| name: "{{ keypair_name }}" |
| state: present |
| public_key_file: "{{ ansible_env.HOME }}/.ssh/id_rsa.pub" |
| |
| - name: Create stack '{{ heat_stack_name }}' |
| os_stack: |
| name: "{{ heat_stack_name }}" |
| state: present |
| template: "{{ engine_cache }}/config/heat-template.yaml" |
| environment: |
| - "{{ inventory_path }}/group_vars/all/pdf.yaml" |
| parameters: |
| keypair: "{{ keypair_name }}" |
| wait: true |
| ignore_errors: false |
| register: stack_create_output |
| |
| - name: Log stack create output to console |
| debug: |
| msg: "{{ stack_create_output }}" |
| |
| - name: Get stack list |
| command: "openstack stack list --property name={{ heat_stack_name }}" |
| when: stack_create_output |
| register: stack_list_output |
| environment: |
| PATH: "{{ engine_venv }}/bin" |
| |
| - name: Log stack list output to console |
| debug: |
| msg: "{{ stack_list_output.stdout_lines }}" |
| |
| # vim: set ts=2 sw=2 expandtab: |