-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathinstall-ironic.sh
executable file
·76 lines (61 loc) · 2.6 KB
/
install-ironic.sh
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
#/bin/bash
# Install Ironic
# Environment
. ./env.conf
. $HOME/keystonerc_admin
create_db(){
# Configure MySQL for Ironic
MYSQL="mysql -uroot -p$PASSWORD -e"
$MYSQL "CREATE DATABASE ironic;"
$MYSQL "GRANT ALL PRIVILEGES ON ironic.* TO 'ironic'@'localhost' IDENTIFIED BY '$PASSWORD';"
$MYSQL "GRANT ALL PRIVILEGES ON ironic.* TO 'ironic'@'%' IDENTIFIED BY '$PASSWORD';"
}
create_entity(){
# create user
openstack user create --password $PASSWORD ironic
# Add the admin role to the ironic user and service project
openstack role add --project service --user ironic admin
# Create the ironic service entity
openstack service create --name ironic \
--description "Ironic bare metal provisioning service" baremetal
# Create the Baremetal service API endpoint
openstack endpoint create \
--publicurl http://$CONTROLLER:6385 \
--adminurl http://$CONTROLLER:6385 \
--internalurl http://$CONTROLLER:6385 \
--region RegionOne \
baremetal
}
install_packages(){
apt install -y ironic-api ironic-conductor python-ironicclient ipmitool
}
config_setting(){
sed -i "/^\[glance\]/a glance_host=$CONTROLLER" /etc/ironic/ironic.conf
sed -i "/^\[neutron\]/a url=http://$CONTROLLER:9696" /etc/ironic/ironic.conf
sed -i "/^\[keystone_authtoken\]/a auth_protocol=http" /etc/ironic/ironic.conf
sed -i "/^\[keystone_authtoken\]/a admin_tenant_name=service" /etc/ironic/ironic.conf
sed -i "/^\[keystone_authtoken\]/a admin_password=$PASSWORD" /etc/ironic/ironic.conf
sed -i "/^\[keystone_authtoken\]/a admin_user=ironic" /etc/ironic/ironic.conf
sed -i "/^\[keystone_authtoken\]/a auth_uri=http://$CONTROLLER:5000/" /etc/ironic/ironic.conf
sed -i "/^\[keystone_authtoken\]/a auth_host=$CONTROLLER" /etc/ironic/ironic.conf
sed -i "/^\[DEFAULT\]/a auth_strategy=keystone" /etc/ironic/ironic.conf
sed -i "s/connection=sqlite:\/\/\/\/var\/lib\/ironic\/ironic\.db/connection = mysql:\/\/ironic:$PASSWORD@$CONTROLLER\/ironic/" /etc/ironic/ironic.conf
sed -i "/^\[DEFAULT\]/a rabbit_password=$PASSWORD" /etc/ironic/ironic.conf
sed -i "/^\[DEFAULT\]/a rabbit_userid=openstack" /etc/ironic/ironic.conf
sed -i "/^\[DEFAULT\]/a rabbit_host=$CONTROLLER" /etc/ironic/ironic.conf
sed -i "/^\[DEFAULT\]/a verbose = True" /etc/ironic/ironic.conf
sed -i "/^\[DEFAULT\]/a debug = True" /etc/ironic/ironic.conf
}
sync_db(){
su -s /bin/sh -c "ironic-dbsync --config-file /etc/ironic/ironic.conf create_schema" ironic
}
service_restart(){
service ironic-api restart
service ironic-conductor restart
}
create_db
create_entity
install_packages
config_setting
sync_db
service_restart