Skip to content

Commit 3542329

Browse files
jb4freemmccarre
authored andcommittedFeb 9, 2019
Multiple bug fixes, initial multipath support, and Ubuntu bond support (#194)
Multiple bug fixes, initial multipath support, and Ubuntu bond support
1 parent e7bbade commit 3542329

File tree

32 files changed

+294
-84
lines changed

32 files changed

+294
-84
lines changed
 

‎.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
pf9-express.conf
22
pf9-openstack.rc
33
platform9-install-redhat.sh
4+
platform9-install-debian.sh
45
group_vars/all.yml
56
lib/pf9-builder/openstack.rc
67
lib/pf9-builder/hosts

‎README.md

+30-11
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,10 @@ NOTE: A sample template is installed in the previous command ("./pf9-express -s"
8282
##
8383
[all]
8484
[all:vars]
85-
ansible_ssh_pass=winterwonderland
85+
ansible_user=ubuntu
8686
ansible_sudo_pass=winterwonderland
87+
ansible_ssh_pass=winterwonderland
88+
#ansible_ssh_private_key_file=~/.ssh/id_rsa
8789
8890
################################################################################################
8991
## Optional Settings
@@ -93,10 +95,10 @@ bond_ifname=bond0
9395
bond_mode=1
9496
bond_mtu=9000
9597
96-
## network configuration for bond (implemented if manage_network=True)
97-
[bond-config]
98-
hv01 bond_members='["eth1","eth2"]' bond_sub_interfaces='[{"vlanid":"100","ip":"10.0.0.11","mask":"255.255.255.0"}]'
98+
## network bond configuration implemented if manage_network=True
99+
[bond-config]
99100
hv02 bond_members='["eth1","eth2"]' bond_sub_interfaces='[{"vlanid":"100","ip":"10.0.0.12","mask":"255.255.255.0"}]'
101+
hv03 bond_members='["eth1","eth2"]' bond_sub_interfaces='[{"vlanid":"100","ip":"10.0.0.13","mask":"255.255.255.0"}]'
100102
cv01 bond_members='["eth1","eth2"]' bond_sub_interfaces='[{"vlanid":"100","ip":"10.0.0.15","mask":"255.255.255.0"}]'
101103
102104
################################################################################################
@@ -108,21 +110,34 @@ glance
108110
cinder
109111
110112
## global variables defined in group_vars/hypervisors.yml
113+
## note: if the following variables are not defined, the value of ansible_host will be inherited
114+
## - vm_console_ip
115+
## - ha_cluster_ip
116+
## - tunnel_ip
111117
[hypervisors]
112-
hv01 ansible_host=10.0.0.11 ansible_user=centos vm_console_ip=10.0.0.11 ha_cluster_ip=10.0.1.11 tunnel_ip=10.0.2.11 dhcp=on snat=on
113-
hv02 ansible_host=10.0.0.12 ansible_user=centos vm_console_ip=10.0.0.12 tunnel_ip=10.0.2.12 dhcp=on snat=on
114-
hv03 ansible_host=10.0.0.13 ansible_user=ubuntu vm_console_ip=10.0.0.13 tunnel_ip=10.0.2.13
115-
hv04 ansible_host=10.0.0.14 ansible_user=ubuntu
118+
hv01 ansible_host=10.0.0.11 vm_console_ip=10.0.0.11 ha_cluster_ip=10.0.1.11 tunnel_ip=10.0.2.11 dhcp=on snat=on
119+
hv02 ansible_host=10.0.0.12 vm_console_ip=10.0.0.12 tunnel_ip=10.0.2.12 dhcp=on snat=on
120+
hv03 ansible_host=10.0.0.13 vm_console_ip=10.0.0.13 tunnel_ip=10.0.2.13
121+
hv04 ansible_host=10.0.0.14
116122
117123
## global variables defined in group_vars/glance.yml
124+
## note: if the following variables are not defined, the value of ansible_host will be inherited
125+
## - glance_ip
118126
[glance]
119127
hv01 glance_ip=10.0.3.11 glance_public_endpoint=True
120128
hv02 glance_ip=10.0.3.12
121129
122130
## global variables defined in group_vars/cinder.yml
131+
## note: if the following variables are not defined, the value of ansible_host will be inherited
132+
## - cinder_ip
123133
[cinder]
124134
hv02 cinder_ip=10.0.4.14 pvs=["/dev/sdb","/dev/sdc","/dev/sdd","/dev/sde"]
125135
136+
## global variables defined in group_vars/designate.yml
137+
## note: this role must be enabled by Platform9 Customer Success before using
138+
[designate]
139+
#hv01
140+
126141
################################################################################################
127142
## Kubernetes Groups
128143
################################################################################################
@@ -131,12 +146,16 @@ k8s-master
131146
k8s-worker
132147
133148
## global variables defined in group_vars/containervisors.yml
149+
## note: if the following variables are not defined, their tasks will be skipped
150+
## - cluster_uuid
134151
[k8s-master]
135-
cv01 ansible_host=10.0.0.15 ansible_user=ubuntu cluster_uuid=7273706d-afd5-44ea-8fbf-901ceb6bef27
152+
cv01 ansible_host=10.0.0.15
153+
cv02 ansible_host=10.0.0.16
154+
cv03 ansible_host=10.0.0.17
136155
137156
[k8s-worker]
138-
cv02 ansible_host=10.0.0.16 ansible_user=ubuntu cluster_uuid=7273706d-afd5-44ea-8fbf-901ceb6bef27
139-
cv03 ansible_host=10.0.0.17 ansible_user=ubuntu cluster_uuid=7273706d-afd5-44ea-8fbf-901ceb6bef27
157+
cv04 ansible_host=10.0.0.18 cluster_uuid=7273706d-afd5-44ea-8fbf-901ceb6bef27
158+
cv05 ansible_host=10.0.0.19 cluster_uuid=7273706d-afd5-44ea-8fbf-901ceb6bef27
140159
```
141160

142161
## CSV Import

‎group_vars/designate.yml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
# Global Variables for 'designate' Inventory Group
3+

‎group_vars/hypervisors.yml

+4-3
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@
22
# Global Variables for 'hypervisors' Inventory Group
33

44
live_migration: True
5-
nested_virt: "False"
6-
kernel_same_page_merging: "False"
5+
nested_virt: False
6+
kernel_same_page_merging: False
77
dhcp: "off"
88
snat: "off"
99
ceilometer: "on"
1010
glance: "off"
11+
multipath: False
1112
nova_instances_path: /opt/pf9/data/instances/
1213
neutron_ovs_allow_dhcp_vms: "False"
1314
neutron_ovs_bridge_name: "br-pf9"
1415
neutron_ovs_bridge_mappings: "external:br-pf9"
15-
ceilometer_customize: "False"
16+
ceilometer_customize: False
1617
ceilometer_cpu_interval: 600

‎lib/hosts.tpl

+33-10
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
##
44
[all]
55
[all:vars]
6-
ansible_ssh_pass=winterwonderland
6+
ansible_user=ubuntu
77
ansible_sudo_pass=winterwonderland
8+
ansible_ssh_pass=winterwonderland
9+
#ansible_ssh_private_key_file=~/.ssh/id_rsa
810

911
################################################################################################
1012
## Optional Settings
@@ -14,10 +16,14 @@ bond_ifname=bond0
1416
bond_mode=1
1517
bond_mtu=9000
1618

17-
## network configuration for bond (implemented if manage_network=True)
19+
## network bond configuration implemented if manage_network=True
1820
[bond-config]
19-
hv01 bond_members='["eth1","eth2"]' bond_sub_interfaces='[{"vlanid":"100","ip":"10.0.0.11","mask":"255.255.255.0"}]'
21+
## for single interface bond configuration
22+
hv01 bond_members='eth1' bond_sub_interfaces='[{"vlanid":"100","ip":"10.0.0.11","mask":"255.255.255.0"}]'
23+
24+
## for multiple interface bond configuration
2025
hv02 bond_members='["eth1","eth2"]' bond_sub_interfaces='[{"vlanid":"100","ip":"10.0.0.12","mask":"255.255.255.0"}]'
26+
hv03 bond_members='["eth1","eth2"]' bond_sub_interfaces='[{"vlanid":"100","ip":"10.0.0.13","mask":"255.255.255.0"}]'
2127
cv01 bond_members='["eth1","eth2"]' bond_sub_interfaces='[{"vlanid":"100","ip":"10.0.0.15","mask":"255.255.255.0"}]'
2228

2329
################################################################################################
@@ -29,21 +35,34 @@ glance
2935
cinder
3036

3137
## global variables defined in group_vars/hypervisors.yml
38+
## note: if the following variables are not defined, the value of ansible_host will be inherited
39+
## - vm_console_ip
40+
## - ha_cluster_ip
41+
## - tunnel_ip
3242
[hypervisors]
33-
hv01 ansible_host=10.0.0.11 ansible_user=centos vm_console_ip=10.0.0.11 ha_cluster_ip=10.0.1.11 tunnel_ip=10.0.2.11 dhcp=on snat=on
34-
hv02 ansible_host=10.0.0.12 ansible_user=centos vm_console_ip=10.0.0.12 tunnel_ip=10.0.2.12 dhcp=on snat=on
35-
hv03 ansible_host=10.0.0.13 ansible_user=ubuntu vm_console_ip=10.0.0.13 tunnel_ip=10.0.2.13
36-
hv04 ansible_host=10.0.0.14 ansible_user=ubuntu
43+
hv01 ansible_host=10.0.0.11 vm_console_ip=10.0.0.11 ha_cluster_ip=10.0.1.11 tunnel_ip=10.0.2.11 dhcp=on snat=on
44+
hv02 ansible_host=10.0.0.12 vm_console_ip=10.0.0.12 tunnel_ip=10.0.2.12 dhcp=on snat=on
45+
hv03 ansible_host=10.0.0.13 vm_console_ip=10.0.0.13 tunnel_ip=10.0.2.13
46+
hv04 ansible_host=10.0.0.14
3747

3848
## global variables defined in group_vars/glance.yml
49+
## note: if the following variables are not defined, the value of ansible_host will be inherited
50+
## - glance_ip
3951
[glance]
4052
hv01 glance_ip=10.0.3.11 glance_public_endpoint=True
4153
hv02 glance_ip=10.0.3.12
4254

4355
## global variables defined in group_vars/cinder.yml
56+
## note: if the following variables are not defined, the value of ansible_host will be inherited
57+
## - cinder_ip
4458
[cinder]
4559
hv02 cinder_ip=10.0.4.14 pvs=["/dev/sdb","/dev/sdc","/dev/sdd","/dev/sde"]
4660

61+
## global variables defined in group_vars/designate.yml
62+
## note: this role must be enabled by Platform9 Customer Success before using
63+
[designate]
64+
#hv01
65+
4766
################################################################################################
4867
## Kubernetes Groups
4968
################################################################################################
@@ -52,9 +71,13 @@ k8s-master
5271
k8s-worker
5372

5473
## global variables defined in group_vars/containervisors.yml
74+
## note: if the following variables are not defined, their tasks will be skipped
75+
## - cluster_uuid
5576
[k8s-master]
56-
cv01 ansible_host=10.0.0.15 ansible_user=ubuntu cluster_uuid=7273706d-afd5-44ea-8fbf-901ceb6bef27
77+
cv01 ansible_host=10.0.0.15
78+
cv02 ansible_host=10.0.0.16
79+
cv03 ansible_host=10.0.0.17
5780

5881
[k8s-worker]
59-
cv02 ansible_host=10.0.0.16 ansible_user=ubuntu cluster_uuid=7273706d-afd5-44ea-8fbf-901ceb6bef27
60-
cv03 ansible_host=10.0.0.17 ansible_user=ubuntu cluster_uuid=7273706d-afd5-44ea-8fbf-901ceb6bef27
82+
cv04 ansible_host=10.0.0.18 cluster_uuid=7273706d-afd5-44ea-8fbf-901ceb6bef27
83+
cv05 ansible_host=10.0.0.19 cluster_uuid=7273706d-afd5-44ea-8fbf-901ceb6bef27

‎lib/pf9-builder/pf9-builder

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
basedir=$(dirname $0)
44
network_args=""
55
provider=openstack
6-
os_cli=~/.virtenvs/os_cli/bin/openstack
6+
os_cli=openstack
77
inventory=${basedir}/hosts
88
tpl_global=${basedir}/template/hosts-global.tpl
99
tpl_hypervisors=${basedir}/template/hosts-hypervisors.tpl
@@ -373,6 +373,7 @@ if [ "${node_type}" == "openstack" ]; then
373373
IFS=" "
374374
for instance in ${instances}; do
375375
echo -n "."
376+
sudo ansible -i ${inventory} -m raw -s -a "if [ -e /etc/lsb-release -a ! -e /usr/bin/python ]; then (apt -y update && apt install -y python-minimal); fi" ${instance}
376377
status=$(ansible -i ${inventory} -m ping ${instance})
377378
if [ $? -ne 0 ]; then launch_status=0; fi
378379
done

‎pf9-express.yml

+10-1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
become: true
3535
roles:
3636
- { role: "bond-config", when: manage_network == True }
37+
- { role: "pf9-auth", when: manage_network == True and ansible_distribution == "Ubuntu" }
3738

3839
# OpenStack Hypervisor Nodes
3940
- hosts: hypervisors
@@ -54,7 +55,8 @@
5455
- { role: "map-role", rolename: "pf9-neutron-metadata-agent", when: autoreg == "on" }
5556
- { role: "map-role", rolename: "pf9-neutron-dhcp-agent", when: autoreg == "on" and dhcp == "on" }
5657
- { role: "wait-for-convergence", when: autoreg == "on" }
57-
- { role: "enable-nested-virt", when: autoreg == "on" and nested_virt == True }
58+
- { role: "multipath", when: multipath == True }
59+
- { role: "enable-nested-virt", when: nested_virt == True }
5860
- { role: "enable-ksm", when: kernel_same_page_merging == True }
5961
- { role: "secure-live-migration", when: autoreg == "on" and live_migration == True }
6062
- { role: "customize-ceilometer", when: ceilometer == "on" and ceilometer_customize == True }
@@ -76,6 +78,13 @@
7678
- { role: "map-role", rolename: "pf9-cindervolume-lvm", when: autoreg == "on" }
7779
- { role: "wait-for-convergence", when: autoreg == "on" }
7880

81+
# Openstack Designate Nodes
82+
- hosts: designate
83+
become: true
84+
roles:
85+
- { role: "map-role", rolename: "pf9-designate", when: autoreg == "on" }
86+
- { role: "wait-for-convergence", when: autoreg == "on" }
87+
7988
# Kubernetes Master Nodes
8089
- hosts: k8s-master
8190
become: true

‎roles/bond-config/tasks/main.yml

+4-26
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,8 @@
44
##
55
## Configure the physical and sub-interfaces behind the bond
66
##########################################################################################################
7+
- include: redhat.yml
8+
when: ansible_os_family == "RedHat"
79

8-
- debug: var=bond_members
9-
- debug: var=bond_sub_interfaces
10-
11-
- block:
12-
- name: attach physical interfaces to the bond
13-
template:
14-
src: ifcfg-interface.j2
15-
dest: "/etc/sysconfig/network-scripts/ifcfg-{{item}}"
16-
mode: 0644
17-
with_items: "{{bond_members}}"
18-
when: bond_members is defined
19-
20-
- block:
21-
- name: attach physical interfaces to the bond
22-
template:
23-
src: ifcfg-sub-interface.j2
24-
dest: "/etc/sysconfig/network-scripts/ifcfg-{{bond_ifname}}.{{item['vlanid']}}"
25-
mode: 0644
26-
with_items: "{{bond_sub_interfaces|list}}"
27-
when: bond_sub_interfaces is defined
28-
29-
- name: restart network service
30-
service:
31-
name: network
32-
state: restarted
33-
when: bond_members is defined or bond_sub_interfaces is defined
10+
- include: ubuntu.yml
11+
when: ansible_distribution == "Ubuntu"

‎roles/bond-config/tasks/redhat.yml

+31-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,32 @@
11
---
2-
- name: Create the network configuration file for the bond
3-
template:
4-
src: bond_redhat.j2
5-
dest: "/etc/sysconfig/network-scripts/ifcfg-{{bond_ifname}}"
2+
- debug: var=bond_members
3+
- debug: var=bond_sub_interfaces
4+
5+
- block:
6+
- name: "RedHat - create the network configuration file for {{bond_ifname}}"
7+
template:
8+
src: rhel-bond-interface.j2
9+
dest: "/etc/sysconfig/network-scripts/ifcfg-{{bond_ifname}}"
10+
mode: 0644
11+
- name: "RedHat - attach physical interfaces to the bond"
12+
template:
13+
src: rhel-ifcfg-interface.j2
14+
dest: "/etc/sysconfig/network-scripts/ifcfg-{{item}}"
15+
mode: 0644
16+
with_items: "{{bond_members}}"
17+
when: bond_members is defined
18+
19+
- block:
20+
- name: "RedHat - attach physical interfaces to the bond"
21+
template:
22+
src: rhel-ifcfg-sub-interface.j2
23+
dest: "/etc/sysconfig/network-scripts/ifcfg-{{bond_ifname}}.{{item['vlanid']}}"
24+
mode: 0644
25+
with_items: "{{bond_sub_interfaces|list}}"
26+
when: bond_sub_interfaces is defined
27+
28+
- name: restart network service
29+
service:
30+
name: network
31+
state: restarted
32+
when: bond_members is defined or bond_sub_interfaces is defined

‎roles/bond-config/tasks/ubuntu.yml

+41-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,43 @@
11
---
2+
- debug: var=bond_members
3+
- debug: var=bond_sub_interfaces
4+
5+
- name: "Ubuntu - define physical interface"
6+
template:
7+
src: ubuntu-ifcfg-phy-interface.j2
8+
dest: "/etc/network/interfaces.d/ifcfg-{{item}}.cfg"
9+
mode: 0644
10+
with_items: "{{bond_members}}"
11+
when: bond_members is defined
12+
register: bond_task_result
13+
14+
- name: "Ubuntu - define bond interface"
15+
template:
16+
src: ubuntu-ifcfg-bond-interface.j2
17+
dest: "/etc/network/interfaces.d/ifcfg-{{bond_ifname}}.cfg"
18+
mode: 0644
19+
with_items: "{{bond_members}}"
20+
when: bond_members is defined
21+
22+
- name: "Ubuntu - create the sub interfaces"
23+
template:
24+
src: ubuntu-ifcfg-sub-interface.j2
25+
dest: "/etc/network/interfaces.d/ifcfg-{{bond_ifname}}-{{item['vlanid']}}.cfg"
26+
mode: 0644
27+
with_items: "{{bond_sub_interfaces|list}}"
28+
when: bond_sub_interfaces is defined
29+
30+
- name: "Ubuntu Reboot if there was a change"
31+
shell: "sleep 5 && reboot"
32+
async: 1
33+
poll: 0
34+
when: bond_task_result is changed
35+
36+
- name: "Ubuntu - Wait for the reboot to complete if there was a change"
37+
wait_for_connection:
38+
connect_timeout: 20
39+
sleep: 5
40+
delay: 5
41+
timeout: 300
42+
when: bond_task_result is changed
243

3-
- debug: msg="running network-hook/tasks/ubuntu.yml"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
auto {{bond_ifname}}
2+
iface {{bond_ifname}} inet manual
3+
bond-slaves {{bond_members}}
4+
mtu {{bond_mtu}}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
auto {{item}}
2+
iface {{item}} inet manual
3+
bond-master {{bond_ifname}}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
auto {{bond_ifname}}.{{item['vlanid']}}
2+
iface {{bond_ifname}}.{{item['vlanid']}} inet static
3+
address {{item['ip']}}
4+
netmask {{item['mask']}}
5+
mtu {{bond_mtu}}

‎roles/customize-ceilometer/tasks/main.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
- name: Check if pf9-ceilometer in installed (Ubuntu))
2+
- name: Check if pf9-ceilometer in installed (Ubuntu)
33
shell: "`which dpkg-query` -s pf9-ceilometer > /dev/null 2>&1; if [ $? -ne 0 ]; then echo 'not-installed'; fi"
44
register: pkg_state_ceilometer_ubuntu
55
when:

0 commit comments

Comments
 (0)
Please sign in to comment.