-
Notifications
You must be signed in to change notification settings - Fork 16
/
common.yml
86 lines (72 loc) · 3.71 KB
/
common.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
---
- hosts: localhost
tasks:
- name: fail if ceph machine type is not defined
fail:
msg: ceph machine type is not defined
when: ceph_enabled and (ceph_machine_type is not defined)
- name: load instackenv file
include_tasks: tasks/load_instackenv.yml
- name: get tn10rt machines list
shell: curl http://wiki.scalelab.redhat.com/1029u/ > ~/tn10rt.html
- name: load tn10rt machines list
set_fact:
tn10rt: "{{ lookup('file', '~/tn10rt.html') }}"
- name: set storage-protocol-backend
set_fact:
storage_protocol_backend: ' --storage-protocol-backend nfs-ganesha'
when: manila_enabled
- block:
- name: set machine_type
set_fact:
machine_type: "{{ (type != '1029u') | ternary(type, (undercloud_hostname in tn10rt) | ternary('1029utn10rt', '1029utrtp')) }}"
vars:
type: "{{ (lab_name == 'scale') | ternary(undercloud_hostname.split('.')[0].split('-')[3], undercloud_hostname.split('.')[0].split('-')[2]) }}"
when: virtual_uc != true
- name: set machine type for virtual undercloud
set_fact:
machine_type: "{{ (type != '1029u') | ternary(type, (instackenv_content.nodes[0].pm_addr.replace('mgmt-', '') in tn10rt) | ternary('1029utn10rt', '1029utrtp') }}"
vars:
type: "{{ (lab_name == 'scale') | ternary(instackenv_content.nodes[0].pm_addr.split('.')[0].split('-')[4], instackenv_content.nodes[0].pm_addr.split('.')[0].split('-')[3]) }}"
when: virtual_uc
- name: set vendor
set_fact:
vendor: "{{ (machine_type in lab_vars['machine_types']['supermicro']) | ternary('supermicro', 'dell') }}"
vars:
lab_vars: "{{ (lab_name == 'scale') | ternary(scale, alias) }}"
when: lab_name in ['scale', 'alias']
- block:
- name: load overcloud instackenv
set_fact:
stack_data: "{{ lookup('file', '{{ overcloud_instackenv_path }}') | from_json }}"
- name: get machine types
set_fact:
machine_types: "{{ machine_types|default([]) + [ (type != '1029u') | ternary(type, (item.pm_addr.replace('mgmt-', '') in tn10rt) | ternary('1029utn10rt', '1029utrtp')) ] }}"
vars:
type: "{{ (lab_name == 'scale') | ternary(item.pm_addr.split('.')[0].split('-')[4], item.pm_addr.split('.')[0].split('-')[3]) }}"
loop: "{{ stack_data.nodes|flatten(levels=1) }}"
- name: set vendors of overcloud nodes
set_fact:
vendors: "{{ vendors|default([])+ [(item in lab_vars['machine_types']['supermicro']) | ternary('supermicro', 'dell')] }}"
with_items:
- "{{ machine_types }}"
vars:
lab_vars: "{{ (lab_name == 'scale') | ternary(scale, alias) }}"
when: lab_name in ['scale', 'alias'] and virtual_uc != true
- name: list oc_instackenv_content
shell: |
echo "{{ (oc_instackenv_content.nodes[item | int].pm_addr | replace('mgmt-','') | replace('-drac', '')) }}"
with_sequence: 0-{{ (oc_instackenv_content.nodes|length - 1) }}
register: host_list
- name: clear existing dell-hosts file
shell: echo "" > {{ playbook_dir }}/badfish/dell-hosts
- name: prepare dell hosts for badfish
shell: echo "mgmt-{{ item[1].stdout }}" >> {{ playbook_dir }}/badfish/dell-hosts
when: vendors is defined and item[0] == "dell"
with_together:
- "{{ vendors }}"
- "{{ host_list.results }}"
- include_tasks: tasks/get_interpreter.yml
vars:
hostname: "{{ undercloud_hostname }}"
user: "root"