-
Notifications
You must be signed in to change notification settings - Fork 16
/
setup_undercloud.yml
40 lines (36 loc) · 1.2 KB
/
setup_undercloud.yml
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
- hosts: localhost
gather_facts: yes
vars:
chassis_password: "{{ instackenv_content.nodes[0].pm_password }}"
osp_rhel_mapping:
10: 7.7
13: 7.9
14: 7.7
15: 8.0
16: 8.1
16.1: 8.2
16.2: 8.4
17.0: 9.0
17.1: 9.2
tasks:
- name: set async_install to empty list
set_fact:
async_install: []
- name: install os on undercloud node
vars:
needed_os: "RHEL {{ osp_rhel_mapping[osp_release|float] }}"
hypervisor_host: "{{ undercloud_hostname }}"
hypervisor_password: "{{ ansible_ssh_pass }}"
include_tasks: tasks/install_os.yml
- name: Check if stack user exists
shell: |
ssh -o 'PreferredAuthentications=publickey' -o 'StrictHostKeyChecking=no' -o 'UserKnownHostsFile=/dev/null' -i ~/.ssh/id_rsa stack@{{ undercloud_hostname }} 'echo success'
register: test_user
ignore_errors: true
changed_when: false
- name: check if stack user need to be created in undercloud
set_fact:
create_user: True
when: test_user.stdout != "success"
- import_playbook: prepare_undercloud.yml
when: hostvars['localhost']['create_user'] is defined