-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathos-glance.yml
116 lines (103 loc) · 3.8 KB
/
os-glance.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
---
- hosts: os_controllers
vars:
verbose: true
tasks:
- name: create glance database
mysql_db: name=glance state=present login_user=root login_password="{{ mariadb_root_pass }}"
- name: grant privileges to glance user in glancedb
mysql_user: host="{{ item }}"
name=glance
password="{{ GLANCE_DBPASS }}"
priv=glance.*:ALL
state=present
login_user=root
login_password="{{ mariadb_root_pass }}"
with_items:
- localhost
- "%"
- name: "find the glance user"
command: openstack
--os-token {{ admin_token }}
--os-url http://{{ keystone_host }}:{{ keystone_admin_port }}/v3
--os-identity-api-version 3
user show glance
register: found
ignore_errors: True
- name: "create the glance user"
command: openstack
--os-token {{ admin_token }}
--os-url http://{{ keystone_host }}:{{ keystone_admin_port }}/v3
--os-identity-api-version 3
user create
--domain default
--password {{ GLANCE_PASS }}
glance
when: found | failed
- name: "add the admin role to glance user in the service project"
command: openstack
--os-token {{ admin_token }}
--os-url http://{{ keystone_host }}:{{ keystone_admin_port }}/v3
--os-identity-api-version 3
role add
--project service
--user glance
admin
when: found | failed
- name: "find the image service entity"
command: openstack
--os-token {{ admin_token }}
--os-url http://{{ keystone_host }}:{{ keystone_admin_port }}/v3
--os-identity-api-version 3
service show image
register: found
ignore_errors: True
- name: "create the image service entity"
command: openstack
--os-token {{ admin_token }}
--os-url http://{{ keystone_host }}:{{ keystone_admin_port }}/v3
--os-identity-api-version 3
service create
--name glance
--description "OpenStack Image service"
image
when: found | failed
- name: "find the image endpoint"
command: openstack
--os-token {{ admin_token }}
--os-url http://{{ keystone_host }}:{{ keystone_admin_port }}/v2.0
endpoint show image
register: found
ignore_errors: True
- name: "create the image service API endpoints"
command: openstack
--os-token {{ admin_token }}
--os-url http://{{ keystone_host }}:{{ keystone_admin_port }}/v3
--os-identity-api-version 3
endpoint create
--region RegionOne
image {{ item.endpoint }} http://controller:{{ item.port }}
with_items:
- { endpoint: public, port: 9292 }
- { endpoint: internal, port: 9292 }
- { endpoint: admin, port: 9292 }
when: found | failed
- name: "Install glance"
apt: name="{{ item }}" update_cache=yes state=latest
with_items:
- glance
- python-glanceclient
- name: "write conf files"
template: src=./templates/glance-{{ item }}.conf.j2 dest=/etc/glance/glance-{{ item }}.conf
with_items:
- api
- registry
- name: "populate database"
shell: su -s /bin/sh -c "glance-manage db_sync" glance
- name: "restart glance services"
service: name=glance-{{ item }} state=restarted
with_items:
- api
- registry
- name: "remove SQLite database"
file: path=/var/lib/glance/glance.sqlite state=absent