blob: 2fe8717ac90fa615bef146f771f51a915edabf45 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
#Prerequisite tasks before stack deployment.
#Authenticate to cloud.
- name: "authenticate to cloud"
os_auth:
auth:
auth_url: "{{ os_auth_url }}"
username: "{{ os_username }}"
password: "{{ os_password }}"
domain_name: "{{ os_domain_name }}"
project_name: "{{ os_project_name }}"
project_domain_name: "{{ os_domain_name }}"
#Will use the token from this point on.
- name: "set token"
set_fact:
os_auth:
auth_url: "{{ os_auth_url }}"
token: "{{ auth_token }}"
project_name: "{{ os_project_name }}"
project_domain_name: "{{ os_domain_name }}"
#Retrieve floating ip info.
- name: "get floating ip facts"
os_floating_ips_facts:
auth: "{{ os_auth }}"
auth_type: token
network: "{{ public_network }}"
#Group floating ips by ip address to allow looking them up.
- name: "group floating ips by address"
set_fact:
floating_ips_by_address: "{{ floating_ips_by_address | default({}) | combine({item.floating_ip_address: item}) }}"
loop: "{{ query('items', openstack_floating_ips) }}"
- name: "fail if required floating ips do not exist"
fail: msg="The required floating ips do not exist"
when: "(not (first_node_ip in floating_ips_by_address)
or not (infra_ip in floating_ips_by_address)
or not (installer_ip in floating_ips_by_address))"
#Get a ssh public key to be passed to heat, it requires ssh-keygen with -y option.
- name: "Retrieve public key from ssh private key"
command: "ssh-keygen -y -f {{ hostvars['installer'].ansible_private_key_file }}"
register: public_key_generation
- set_fact:
auth_public_key: "{{ public_key_generation.stdout }}"
|