Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
58 lines (49 sloc) 1.77 KB
---
- name: Set a fact containing the original python interpreter
set_fact:
old_python_interpreter: "{{ ansible_python_interpreter | default('/usr/bin/python') }}"
when: cluster_venv != None
- name: Set a fact to use the python interpreter in the virtualenv
set_fact:
ansible_python_interpreter: "{{ cluster_venv }}/bin/python"
when: cluster_venv != None
- name: Orchestrate OpenStack infrastructure
register: cluster_stack
os_stack:
auth_type: "{{ cluster_auth_type or omit }}"
auth: "{{ cluster_auth or omit }}"
cloud: "{{ cluster_cloud or omit }}"
name: "{{ cluster_name }}"
state: "{{ cluster_state }}"
environment: "{{ cluster_environment }}"
template: "{{ cluster_template }}"
parameters: "{{ cluster_params }}"
- name: Reset the python interpreter
set_fact:
ansible_python_interpreter: "{{ old_python_interpreter }}"
when: cluster_venv != None
- block:
- name: Ensure cluster inventory directory exists
file:
path: "{{ cluster_inventory | dirname }}"
state: directory
- name: Write inventory file for new cluster
template:
src: cluster_inventory.j2
dest: "{{ cluster_inventory }}"
- name: Extract node groups
set_fact:
cluster_group: "{{ cluster_stack.stack.outputs | selectattr('output_key', 'equalto', 'cluster_group') | first }}"
- name: Extract node objects
set_fact:
cluster_nodes: "{{ cluster_group.output_value | map(attribute='nodes') | list }}"
- name: Wait for SSH access to the nodes
local_action:
module: wait_for
host: "{{ item.ip }}"
port: 22
state: started
timeout: "{{ cluster_ssh_timeout }}"
with_flattened:
- "{{ cluster_nodes }}"
when: cluster_state == 'present'