forked from saikrishnaa/Ansible-Openstack-Queens-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNova.yml
137 lines (130 loc) · 6.54 KB
/
Nova.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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
---
- name: login as controller
hosts: controller
remote_user: root
become: yes
tasks:
- name: install nova
apt:
name: "{{ item }}"
state: present
with_items:
- nova-api
- nova-conductor
- nova-consoleauth
- nova-novncproxy
- nova-scheduler
- nova-placement-api
- name: update nova config file
ini_file:
path: /etc/nova/nova.conf
section: "{{ item.section }}"
option: "{{ item.option }}"
value: "{{ item.value }}"
with_items:
- { section: "api_database", option: "connection", value: "mysql+pymysql://nova:root@controller/nova_api" }
- { section: "database", option: "connection", value: "mysql+pymysql://nova:root@controller/nova"}
- { section: "DEFAULT", option: "transport_url", value: "rabbit://openstack:root@controller"}
- { section: "api ", option: "auth_strategy", value: "keystone"}
- { section: "keystone_authtoken", option: "auth_url", value: "http://controller:5000/v3"}
- { section: "keystone_authtoken", option: "memcached_servers", value: "controller:11211"}
- { section: "keystone_authtoken", option: "auth_type", value: "password"}
- { section: "keystone_authtoken", option: "project_domain_name", value: "default"}
- { section: "keystone_authtoken", option: "user_domain_name", value: "default"}
- { section: "keystone_authtoken", option: "project_name", value: "service"}
- { section: "keystone_authtoken", option: "username", value: "nova"}
- { section: "keystone_authtoken", option: "password", value: "root"}
- { section: "DEFAULT", option: "my_ip", value: "10.0.0.11"}
- { section: "DEFAULT", option: "use_neutron", value: "True"}
- { section: "DEFAULT", option: "firewall_driver", value: "nova.virt.firewall.NoopFirewallDriver"}
- { section: "vnc", option: "enabled", value: "true"}
- { section: "vnc", option: "server_listen", value: "$my_ip"}
- { section: "vnc", option: "server_proxyclient_address", value: "$my_ip"}
- { section: "glance", option: "api_servers", value: "http://controller:9292"}
- { section: "oslo_concurrency", option: "lock_path", value: "/var/lib/nova/tmp"}
- { section: "placement", option: "os_region_name", value: "RegionOne"}
- { section: "placement", option: "project_domain_name", value: "Default"}
- { section: "placement", option: "project_name", value: "service"}
- { section: "placement", option: "auth_type", value: "password"}
- { section: "placement", option: "user_domain_name", value: "Default"}
- { section: "placement", option: "auth_url", value: "http://controller:5000/v3"}
- { section: "placement", option: "username", value: "placement"}
- { section: "placement", option: "password", value: "root"}
- { section: "scheduler", option: "discover_hosts_in_cells_interval", value: "300"}
- name: db sync
shell: "{{ item }}"
with_items:
- su -s /bin/sh -c "nova-manage api_db sync" nova
- su -s /bin/sh -c "nova-manage cell_v2 map_cell0" nova
- su -s /bin/sh -c "nova-manage cell_v2 create_cell --name=cell1 --verbose" nova
- su -s /bin/sh -c "nova-manage db sync" nova
- nova-manage cell_v2 list_cells
ignore_errors: yes
- name: restart services
service:
name: "{{ item }}"
state: restarted
with_items:
- "nova-api"
- "nova-consoleauth"
- "nova-scheduler"
- "nova-conductor"
- name: login as compute
hosts: compute
remote_user: root
become: yes
tasks:
- name: install nova-compute package
apt:
name: nova-compute
state: present
- name: update glance-compute config file
ini_file:
path: /etc/nova/nova.conf
section: "{{ item.section }}"
option: "{{ item.option }}"
value: "{{ item.value }}"
with_items:
- { section: "DEFAULT", option: "transport_url", value: "rabbit://openstack:root@controller" }
- { section: "api", option: "auth_strategy", value: "keystone"}
- { section: "keystone_authtoken", option: "auth_url", value: "http://controller:5000/v3"}
- { section: "keystone_authtoken", option: "memcached_servers", value: "controller:11211"}
- { section: "keystone_authtoken", option: "auth_type", value: "password"}
- { section: "keystone_authtoken", option: "project_domain_name", value: "default"}
- { section: "keystone_authtoken", option: "user_domain_name", value: "default"}
- { section: "keystone_authtoken", option: "project_name", value: "service"}
- { section: "keystone_authtoken", option: "username", value: "nova"}
- { section: "keystone_authtoken", option: "password", value: "root"}
- { section: "DEFAULT", option: "my_ip", value: "10.0.0.31"}
- { section: "DEFAULT", option: "use_neutron", value: "True"}
- { section: "DEFAULT", option: "firewall_driver", value: "nova.virt.firewall.NoopFirewallDriver"}
- { section: "vnc", option: "enabled", value: "True"}
- { section: "vnc", option: "server_listen", value: "0.0.0.0"}
# - { section: "vnc", option: "my_ip", value: "10.0.0.21"}
- { section: "vnc", option: "server_proxyclient_address", value: "$my_ip"}
- { section: "vnc", option: "novncproxy_base_url", value: "http://controller:6080/vnc_auto.html"}
- { section: "glance", option: "api_servers", value: "http://controller:9292"}
- { section: "oslo_concurrency", option: "lock_path", value: "/var/lib/nova/tmp"}
- { section: "placement", option: "os_region_name", value: "RegionOne"}
- { section: "placement", option: "project_domain_name", value: "Default"}
- { section: "placement", option: "project_name", value: "service"}
- { section: "placement", option: "auth_type", value: "password"}
- { section: "placement", option: "user_domain_name", value: "Default"}
- { section: "placement", option: "auth_url", value: "http://controller:5000/v3"}
- { section: "placement", option: "username", value: "placement"}
- { section: "placement", option: "password", value: "root"}
# - { section: "scheduler", option: "discover_hosts_in_cells_interval", value: "300"}
- name: restart nova-compute
service: name=nova-compute state=restarted
- name: login as controller
hosts: controller
remote_user: root
become: yes
tasks:
- name: compute list and db sync
shell: "{{ item }}"
with_items:
- su -s /bin/sh -c "nova-manage cell_v2 discover_hosts --verbose" nova
- sh nova-verification.sh
# - "openstack compute service list --service nova-compute"
# ignore_errors: yes