blob: 19906b04aefacfaf78d9c9555ed27c6a38b6953b (
plain)
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
|
---
- hosts: localhost
vars_files:
- "/etc/openstack/ironic.conf"
tasks:
- name: Create the ironic user
user:
name: ironic
comment: Openstack Ironic Daemons
shell: /sbin/nologin
home: /var/lib/ironic
- name: Create the /var folders for Ironic
file:
path: "{{ item }}"
state: directory
owner: ironic
group: ironic
with_items:
- /var/run/ironic
- /var/lock/ironic
- /var/log/ironic
- /var/lib/ironic
- file: path=/etc/ironic state=directory
- name: Add the configuration needed for ironic in /etc/ironic using templates
template:
src: /usr/share/openstack/ironic/{{ item }}
dest: /etc/ironic/{{ item }}
with_lines:
- cd /usr/share/openstack/ironic && find -type f
- name: Create Ironic service user in service tenant
keystone_user:
user: "{{ IRONIC_SERVICE_USER }}"
password: "{{ IRONIC_SERVICE_PASSWORD }}"
tenant: service
token: "{{ KEYSTONE_TEMPORARY_ADMIN_TOKEN }}"
- name: Assign admin role to Ironic service user in the service tenant
keystone_user:
role: admin
user: "{{ IRONIC_SERVICE_USER }}"
tenant: service
token: "{{ KEYSTONE_TEMPORARY_ADMIN_TOKEN }}"
- name: Add Ironic endpoint
keystone_service:
name: ironic
type: baremetal
description: Openstack Ironic Service
publicurl: 'http://{{ ansible_hostname }}:6385'
internalurl: 'http://{{ CONTROLLER_HOST_ADDRESS }}:6385'
adminurl: 'http://{{ CONTROLLER_HOST_ADDRESS }}:6385'
region: 'regionOne'
token: "{{ KEYSTONE_TEMPORARY_ADMIN_TOKEN }}"
- name: Create postgresql user for Ironic
postgresql_user:
name: "{{ IRONIC_DB_USER }}"
login_host: "{{ CONTROLLER_HOST_ADDRESS }}"
password: "{{ IRONIC_DB_PASSWORD }}"
sudo: yes
sudo_user: ironic
- name: Create database for Ironic services
postgresql_db:
name: ironic
owner: "{{ IRONIC_DB_USER }}"
login_host: "{{ CONTROLLER_HOST_ADDRESS }}"
sudo: yes
sudo_user: ironic
- name: Initiate Ironic database
# Use 'upgrade' instead of 'create_schema' to make the operation
# idempotent
shell: |
ironic-dbsync \
--config-file /etc/ironic/ironic.conf upgrade
sudo: yes
sudo_user: ironic
- name: Enable and start openstack-ironic services
service:
name: "{{ item }}"
enabled: yes
state: started
with_items:
- openstack-ironic-conductor.service
- openstack-ironic-api.service
- name: Set owner and group for the tftp root directory
file:
path: "/srv/tftp_root/"
state: directory
owner: ironic
group: ironic
recurse: yes
- name: Enable and start tftp-hpa
service:
name: tftp-hpa.socket
enabled: yes
state: started
|