diff options
Diffstat (limited to 'meta-openstack')
13 files changed, 548 insertions, 0 deletions
diff --git a/meta-openstack/recipes-support/deploychef/files/conf-templates/ceilometer-template.inc b/meta-openstack/recipes-support/deploychef/files/conf-templates/ceilometer-template.inc new file mode 100644 index 0000000..471ef1e --- /dev/null +++ b/meta-openstack/recipes-support/deploychef/files/conf-templates/ceilometer-template.inc | |||
| @@ -0,0 +1,19 @@ | |||
| 1 | #Ceilometer chefsolo template generation functions | ||
| 2 | |||
| 3 | ceilometer-conf_chefsolo_template() { | ||
| 4 | file_name=$1 | ||
| 5 | if [ -e $file_name ]; then | ||
| 6 | sed "s/^os_password=.*$/os_password=<%=node[:ADMIN_PASSWORD]%>/" -i $file_name | ||
| 7 | sed "s/^os_tenant_name=.*$/os_tenant_name= <%=node[:SERVICE_TENANT_NAME]%>/" -i $file_name | ||
| 8 | sed "s/^auth_host=.*$/auth_host=<%=node[:CONTROLLER_IP]%>/" -i $file_name | ||
| 9 | sed "s/^admin_password=.*$/admin_password= <%=node[:ADMIN_PASSWORD]%>/" -i $file_name | ||
| 10 | sed "s/^admin_tenant_name=.*$/admin_tenant_name= <%=node[:SERVICE_TENANT_NAME]%>/" -i $file_name | ||
| 11 | |||
| 12 | sed "s/^rabbit_host =.*$/rabbit_host = <%=node[:CONTROLLER_IP]%>/" -i $file_name | ||
| 13 | sed "s/$DB_USER:/<%=node[:DB_USER]%>:/g" -i $file_name | ||
| 14 | sed "s/$DB_PASSWORD@/<%=node[:DB_PASSWORD]%>@/g" -i $file_name | ||
| 15 | sed "s/$CONTROLLER_IP/<%=node[:CONTROLLER_IP]%>/g" -i $file_name | ||
| 16 | sed "s/$CONTROLLER_HOST/<%=node[:CONTROLLER_HOST]%>/g" -i $file_name | ||
| 17 | mv $file_name $file_name$SUFFIX | ||
| 18 | fi | ||
| 19 | } | ||
diff --git a/meta-openstack/recipes-support/deploychef/files/conf-templates/ceph-template.inc b/meta-openstack/recipes-support/deploychef/files/conf-templates/ceph-template.inc new file mode 100644 index 0000000..2946808 --- /dev/null +++ b/meta-openstack/recipes-support/deploychef/files/conf-templates/ceph-template.inc | |||
| @@ -0,0 +1,26 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | #Ceph related chefsolo template functions | ||
| 3 | ceph-conf_chefsolo_template() { | ||
| 4 | file_name=$1 | ||
| 5 | if [ -e $file_name ]; then | ||
| 6 | sed "s/mon initial members =.*$/mon initial members = <%=node[:HOST_NAME]%> /" -i $file_name | ||
| 7 | sed "s/mon host =.*$/mon host = <%=node[:PUBLIC_IP]%>/" -i $file_name | ||
| 8 | |||
| 9 | sed "s:public network =.*/:public network = <%=node[\:CONTROLLER_IP]%>/:" -i $file_name | ||
| 10 | sed "s/mon.$CONTROLLER_HOST/mon.<%=node[:HOST_NAME]%>/" -i $file_name | ||
| 11 | sed "s/host =.*$/host = <%=node[:HOST_NAME]%>/" -i $file_name | ||
| 12 | sed "s#mon addr =.*:#mon addr = <%=node[:PUBLIC_IP]%>:#" -i $file_name | ||
| 13 | sed "s#public addr =.*:#public addr = <%=node[:PUBLIC_IP]%>:#" -i $file_name | ||
| 14 | sed "s#cluster addr =.*:#cluster addr = <%=node[:PRIVATE_IP]%>:#" -i $file_name | ||
| 15 | mv $file_name $file_name$SUFFIX | ||
| 16 | fi | ||
| 17 | } | ||
| 18 | |||
| 19 | ceph-setup_chefsolo_template() { | ||
| 20 | file_name=$1 | ||
| 21 | if [ -e $file_name ]; then | ||
| 22 | sed "s/^HOST_NAME.*$/HOST_NAME= <%=node[:HOST_NAME]%> /" -i $file_name | ||
| 23 | sed "s/^PUBLIC_IP.*$/PUBLIC_IP= <%=node[:PUBLIC_IP]%>/" -i $file_name | ||
| 24 | mv $file_name $file_name$SUFFIX | ||
| 25 | fi | ||
| 26 | } | ||
diff --git a/meta-openstack/recipes-support/deploychef/files/conf-templates/cinder-template.inc b/meta-openstack/recipes-support/deploychef/files/conf-templates/cinder-template.inc new file mode 100644 index 0000000..4aeb616 --- /dev/null +++ b/meta-openstack/recipes-support/deploychef/files/conf-templates/cinder-template.inc | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | #Cinder related configuration functions | ||
| 2 | cinder-conf_chefsolo_template() { | ||
| 3 | file_name=$1 | ||
| 4 | if [ -e $file_name ]; then | ||
| 5 | sed "s/$DB_USER:/<%=node[:DB_USER]%>:/g" -i $file_name | ||
| 6 | sed "s/$DB_PASSWORD@/<%=node[:DB_PASSWORD]%>@/g" -i $file_name | ||
| 7 | sed "s/$CONTROLLER_HOST/<%=node[:CONTROLLER_HOST]%>/g" -i $file_name | ||
| 8 | mv $file_name $file_name$SUFFIX | ||
| 9 | fi | ||
| 10 | } | ||
| 11 | |||
| 12 | cinder-api_chefsolo_template() { | ||
| 13 | file_name=$1 | ||
| 14 | if [ -e $file_name ]; then | ||
| 15 | sed "s/^admin_tenant_name =.*$/admin_tenant_name = <%=node[:SERVICE_TENANT_NAME]%> /" -i $file_name | ||
| 16 | sed "s/^admin_user =.*$/admin_user = <%=node[:SERVICE_USER]%> /" -i $file_name | ||
| 17 | sed "s/^admin_password =.*$/admin_password = <%=node[:SERVICE_PASSWORD]%> /" -i $file_name | ||
| 18 | mv $file_name $file_name$SUFFIX | ||
| 19 | fi | ||
| 20 | } | ||
| 21 | |||
diff --git a/meta-openstack/recipes-support/deploychef/files/conf-templates/constants.inc b/meta-openstack/recipes-support/deploychef/files/conf-templates/constants.inc new file mode 100644 index 0000000..48994d3 --- /dev/null +++ b/meta-openstack/recipes-support/deploychef/files/conf-templates/constants.inc | |||
| @@ -0,0 +1,23 @@ | |||
| 1 | #This file is used in the generation of config script | ||
| 2 | CONTROLLER_HOST="%CONTROLLER_HOST%" | ||
| 3 | COMPUTE_HOST="%COMPUTE_HOST%" | ||
| 4 | CONTROLLER_IP="%CONTROLLER_IP%" | ||
| 5 | COMPUTE_IP="%COMPUTE_IP%" | ||
| 6 | |||
| 7 | DB_USER="%DB_USER%" | ||
| 8 | DB_PASSWORD="%DB_PASSWORD%" | ||
| 9 | ADMIN_USER="%ADMIN_USER%" | ||
| 10 | ADMIN_TENANT_NAME="%ADMIN_PASSWORD%" | ||
| 11 | |||
| 12 | ADMIN_PASSWORD="%ADMIN_PASSWORD%" | ||
| 13 | SERVICE_PASSWORD="%SERVICE_PASSWORD%" | ||
| 14 | SERVICE_TENANT_NAME="%SERVICE_TENANT_NAME%" | ||
| 15 | |||
| 16 | SERVICE_USER="%SERVICE_USER%" | ||
| 17 | SERVICE_TOKEN="%SERVICE_TOKEN%" | ||
| 18 | DEMO_USER="%DEMO_USER%" | ||
| 19 | DEMO_PASSWORD="%DEMO_PASSWORD%" | ||
| 20 | |||
| 21 | OS_TENANT_NAME="%OS_TENANT_NAME%" | ||
| 22 | OS_USERNAME="%OS_USERNAME%" | ||
| 23 | OS_PASSWORD="%OS_PASSWORD%" | ||
diff --git a/meta-openstack/recipes-support/deploychef/files/conf-templates/glance-template.inc b/meta-openstack/recipes-support/deploychef/files/conf-templates/glance-template.inc new file mode 100644 index 0000000..cbf3264 --- /dev/null +++ b/meta-openstack/recipes-support/deploychef/files/conf-templates/glance-template.inc | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | #Glance related configuration functions | ||
| 2 | glance_chefsolo_template() { | ||
| 3 | file_name=$1 | ||
| 4 | if [ -e $file_name ]; then | ||
| 5 | sed "s/$DB_USER:/<%=node[:DB_USER]%>:/g" -i $file_name | ||
| 6 | sed "s/$DB_PASSWORD@/<%=node[:DB_PASSWORD]%>@/g" -i $file_name | ||
| 7 | sed "s/^swift_store_user =.*$/swift_store_user = <%=node[:SERVICE_TENANT_NAME]%>:glance/" -i $file_name | ||
| 8 | sed "s/^swift_store_key =.*$/swift_store_key = <%=node[:SERVICE_PASSWORD]%> /" -i $file_name | ||
| 9 | |||
| 10 | sed "s/^admin_tenant_name =.*$/admin_tenant_name = <%=node[:SERVICE_TENANT_NAME]%> /" -i $file_name | ||
| 11 | sed "s/^admin_user =.*$/admin_user = <%=node[:SERVICE_USER]%> /" -i $file_name | ||
| 12 | sed "s/^admin_password =.*$/admin_password = <%=node[:SERVICE_PASSWORD]%> /" -i $file_name | ||
| 13 | sed "s/$CONTROLLER_HOST/<%=node[:CONTROLLER_HOST]%>/g" -i $file_name | ||
| 14 | mv $file_name $file_name$SUFFIX | ||
| 15 | fi | ||
| 16 | } | ||
diff --git a/meta-openstack/recipes-support/deploychef/files/conf-templates/heat-template.inc b/meta-openstack/recipes-support/deploychef/files/conf-templates/heat-template.inc new file mode 100644 index 0000000..578d2e7 --- /dev/null +++ b/meta-openstack/recipes-support/deploychef/files/conf-templates/heat-template.inc | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | #Heat related configuration function(s) | ||
| 2 | heat-conf_chefsolo_template() { | ||
| 3 | file_name=$1 | ||
| 4 | if [ -e $file_name ]; then | ||
| 5 | sed "s/$DB_USER:/<%=node[:DB_USER]%>:/g" -i $file_name | ||
| 6 | sed "s/$DB_PASSWORD@/<%=node[:DB_PASSWORD]%>@/g" -i $file_name | ||
| 7 | sed "s/^auth_host =.*$/auth_host = <%=node[:CONTROLLER_IP]%> /" -i $file_name | ||
| 8 | sed "s/^admin_tenant_name =.*$/admin_tenant_name = <%=node[:SERVICE_TENANT_NAME]%> /" -i $file_name | ||
| 9 | sed "s/^admin_password =.*$/admin_password = <%=node[:ADMIN_PASSWORD]%> /" -i $file_name | ||
| 10 | sed "s/$CONTROLLER_IP/<%=node[:CONTROLLER_IP]%>/g" -i $file_name | ||
| 11 | sed "s/$CONTROLLER_HOST/<%=node[:CONTROLLER_HOST]%>/g" -i $file_name | ||
| 12 | mv $file_name $file_name$SUFFIX | ||
| 13 | fi | ||
| 14 | } | ||
| 15 | |||
diff --git a/meta-openstack/recipes-support/deploychef/files/conf-templates/hosts-template.inc b/meta-openstack/recipes-support/deploychef/files/conf-templates/hosts-template.inc new file mode 100644 index 0000000..b7690b8 --- /dev/null +++ b/meta-openstack/recipes-support/deploychef/files/conf-templates/hosts-template.inc | |||
| @@ -0,0 +1,10 @@ | |||
| 1 | #Hosts related configuration function(s) | ||
| 2 | hosts_chefsolo_template() { | ||
| 3 | file_name=$1 | ||
| 4 | if [ -e $file_name ]; then | ||
| 5 | sed "s/$CONTROLLER_IP.*$/<%=node[:CONTROLLER_IP]%> <%=node[:CONTROLLER_HOST]%>/" -i $file_name | ||
| 6 | sed "s/$COMPUTE_IP*$/<%=node[:COMPUTE_IP]%> <%=node[:COMPUTE_HOST]%>/" -i $file_name | ||
| 7 | mv $file_name $file_name$SUFFIX | ||
| 8 | fi | ||
| 9 | } | ||
| 10 | |||
diff --git a/meta-openstack/recipes-support/deploychef/files/conf-templates/keystone-template.inc b/meta-openstack/recipes-support/deploychef/files/conf-templates/keystone-template.inc new file mode 100644 index 0000000..dc43639 --- /dev/null +++ b/meta-openstack/recipes-support/deploychef/files/conf-templates/keystone-template.inc | |||
| @@ -0,0 +1,24 @@ | |||
| 1 | #Keystone related configuration functions | ||
| 2 | keystone-conf_chefsolo_template() { | ||
| 3 | file_name=$1 | ||
| 4 | if [ -e $file_name ]; then | ||
| 5 | #keystone.conf related | ||
| 6 | sed "s/^admin_token =.*$/admin_token=<%=node[:SERVICE_TOKEN]%> /" -i $file_name | ||
| 7 | sed "s/$DB_USER:/<%=node[:DB_USER]%>:/g" -i $file_name | ||
| 8 | sed "s/$DB_PASSWORD@/<%=node[:DB_PASSWORD]%>@/g" -i $file_name | ||
| 9 | mv $file_name $file_name$SUFFIX | ||
| 10 | fi | ||
| 11 | } | ||
| 12 | |||
| 13 | keystone-identity_chefsolo_template() { | ||
| 14 | file_name=$1 | ||
| 15 | if [ -e $file_name ]; then | ||
| 16 | #Identifyy related substitutions | ||
| 17 | sed "s/^export OS_SERVICE_TOKEN.*$/export OS_SERVICE_TOKEN=<%=node[:SERVICE_TOKEN]%>/" \ | ||
| 18 | -i $file_name | ||
| 19 | sed "s/$ADMIN_PASSWORD/<%=node[:ADMIN_PASSWORD]%>/" -i $file_name | ||
| 20 | sed "s/$SERVICE_TENANT_NAME/<%=node[:SERVICE_TENANT_NAME]%>/" -i $file_name | ||
| 21 | sed "s/^KEYSTONE_HOST.*$/KEYSTONE_HOST=<%=node[:CONTROLLER_IP]%> /" -i $file_name | ||
| 22 | mv $file_name $file_name$SUFFIX | ||
| 23 | fi | ||
| 24 | } | ||
diff --git a/meta-openstack/recipes-support/deploychef/files/conf-templates/neutron-template.inc b/meta-openstack/recipes-support/deploychef/files/conf-templates/neutron-template.inc new file mode 100644 index 0000000..4d10607 --- /dev/null +++ b/meta-openstack/recipes-support/deploychef/files/conf-templates/neutron-template.inc | |||
| @@ -0,0 +1,24 @@ | |||
| 1 | #Neutron chefsolo template generation related function(s) | ||
| 2 | neutron-conf_chefsolo_template() { | ||
| 3 | file_name=$1 | ||
| 4 | if [ -e $file_name ]; then | ||
| 5 | sed "s/admin_tenant_name =.*$/admin_tenant_name = <%=node[:SERVICE_TENANT_NAME]%>/" -i $file_name | ||
| 6 | sed "s/^admin_tenant_name =.*$/admin_tenant_name = <%=node[:SERVICE_TENANT_NAME]%>/" -i $file_name | ||
| 7 | sed "s/^admin_user =.*$/admin_user = <%=node[:SERVICE_USER]%>/" -i $file_name | ||
| 8 | sed "s/^admin_password =.*$/admin_password =<%=node[:SERVICE_PASSWORD]%>/g" -i $file_name | ||
| 9 | sed "s/^rabbit_host =.*$/rabbit_host = <%=node[:CONTROLLER_IP]%>/" -i $file_name | ||
| 10 | mv $file_name $file_name$SUFFIX | ||
| 11 | fi | ||
| 12 | } | ||
| 13 | |||
| 14 | neutron-plugins_chefsolo_template() { | ||
| 15 | file_name=$1 | ||
| 16 | if [ -e $file_name ]; then | ||
| 17 | sed "s/$DB_USER:/<%=node[:DB_USER]%>:/g" -i $file_name | ||
| 18 | sed "s/$DB_PASSWORD@/<%=node[:DB_PASSWORD]%>@/g" -i $file_name | ||
| 19 | sed "s/$CONTROLLER_IP/<%=node[:CONTROLLER_IP]%>/g" -i $file_name | ||
| 20 | sed "s/$CONTROLLER_HOST/<%=node[:CONTROLLER_HOST]%>/g" -i $file_name | ||
| 21 | mv $file_name $file_name$SUFFIX | ||
| 22 | fi | ||
| 23 | } | ||
| 24 | |||
diff --git a/meta-openstack/recipes-support/deploychef/files/conf-templates/nova-template.inc b/meta-openstack/recipes-support/deploychef/files/conf-templates/nova-template.inc new file mode 100644 index 0000000..74b0d4c --- /dev/null +++ b/meta-openstack/recipes-support/deploychef/files/conf-templates/nova-template.inc | |||
| @@ -0,0 +1,47 @@ | |||
| 1 | #Nova chefsolo template generation functions | ||
| 2 | openrc_chefsolo_template() { | ||
| 3 | file_name=$1 | ||
| 4 | if [ -e $file_name ]; then | ||
| 5 | sed "s/^export OS_TENANT_NAME=.*$/export OS_TENANT_NAME=<%=node[:OS_TENANT_NAME]%> /" -i $file_name | ||
| 6 | sed "s/^export OS_USERNAME=.*$/export OS_USERNAME=<%=node[:OS_USERNAME]%> /" -i $file_name | ||
| 7 | sed "s/^export OS_PASSWORD=.*$/export OS_PASSWORD=<%=node[:OS_PASSWORD]%> /" -i $file_name | ||
| 8 | sed "s/^export SERVICE_TOKEN=.*$/export SERVICE_TOKEN=<%=node[:SERVICE_TOKEN]%> /" -i $file_name | ||
| 9 | sed "s/$CONTROLLER_HOST/<%=node[:CONTROLLER_HOST]%>/g" -i $file_name | ||
| 10 | mv $file_name $file_name$SUFFIX | ||
| 11 | fi | ||
| 12 | } | ||
| 13 | |||
| 14 | nova-conf_chefsolo_template() { | ||
| 15 | file_name=$1 | ||
| 16 | if [ -e $file_name ]; then | ||
| 17 | sed "s/$CONTROLLER_IP/<%=node[:CONTROLLER_IP]%>/g" -i $file_name | ||
| 18 | sed "s/$CONTROLLER_HOST/<%=node[:CONTROLLER_HOST]%>/g" -i $file_name | ||
| 19 | sed "s/$COMPUTE_IP/<%=node[:COMPUTE_IP]%>/g" -i $file_name | ||
| 20 | sed "s/$DB_USER:/<%=node[:DB_USER]%>:/g" -i $file_name | ||
| 21 | sed "s/$DB_PASSWORD@/<%=node[:DB_PASSWORD]%>@/g" -i $file_name | ||
| 22 | mv $file_name $file_name$SUFFIX | ||
| 23 | fi | ||
| 24 | } | ||
| 25 | |||
| 26 | api-paste_chefsolo_template() { | ||
| 27 | file_name=$1 | ||
| 28 | if [ -e $file_name ]; then | ||
| 29 | sed "s/auth_host =.*$/auth_host = <%=node[:CONTROLLER_IP]%> /" -i $file_name | ||
| 30 | sed "s/^admin_tenant_name =.*$/admin_tenant_name = <%=node[:SERVICE_TENANT_NAME]%> /" -i $file_name | ||
| 31 | sed "s/^admin_user =.*$/admin_user = <%=node[:SERVICE_USER]%> /" -i $file_name | ||
| 32 | sed "s/^admin_password =.*$/admin_password = <%=node[:SERVICE_PASSWORD]%> /" -i $file_name | ||
| 33 | sed "s/$CONTROLLER_HOST/<%=node[:CONTROLLER_HOST]%>/g" -i $file_name | ||
| 34 | mv $file_name $file_name$SUFFIX | ||
| 35 | fi | ||
| 36 | } | ||
| 37 | |||
| 38 | deploy-conf_chefsolo_template() { | ||
| 39 | file_name=$1 | ||
| 40 | if [ -e $file_name ]; then | ||
| 41 | sed "s/$CONTROLLER_IP/<%=node[:CONTROLLER_IP]%>/g" -i $file_name | ||
| 42 | sed "s/$CONTROLLER_HOST/<%=node[:CONTROLLER_HOST]%>/g" -i $file_name | ||
| 43 | sed "s/$COMPUTE_IP/<%=node[:COMPUTE_IP]%>/g" -i $file_name | ||
| 44 | sed "s/$COMPUTE_HOST/<%=node[:COMPUTE_HOST]%>/g" -i $file_name | ||
| 45 | mv $file_name $file_name$SUFFIX | ||
| 46 | fi | ||
| 47 | } | ||
diff --git a/meta-openstack/recipes-support/deploychef/files/conf-templates/postgresql-template.inc b/meta-openstack/recipes-support/deploychef/files/conf-templates/postgresql-template.inc new file mode 100644 index 0000000..6022cd2 --- /dev/null +++ b/meta-openstack/recipes-support/deploychef/files/conf-templates/postgresql-template.inc | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | #Postgresql chefsolo template generation functions | ||
| 2 | postgresql_chefsolo_template() { | ||
| 3 | file_name=$1 | ||
| 4 | if [ -e $file_name ]; then | ||
| 5 | sed "s/$CONTROLLER_IP/<%=node[:CONTROLLER_IP]%>/g" -i $file_name | ||
| 6 | sed "s/$COMPUTE_IP/<%=node[:COMPUTE_IP]%>/g" -i $file_name | ||
| 7 | sed "s/^DB_USER=.*$/DB_USER=<%=node[:DB_USER]%>/" -i $file_name | ||
| 8 | sed "s/^DB_PASSWORD=.*$/DB_PASSWORD=<%=node[:DB_PASSWORD]%>/" -i $file_name | ||
| 9 | mv $file_name $file_name$SUFFIX | ||
| 10 | fi | ||
| 11 | } | ||
| 12 | |||
diff --git a/meta-openstack/recipes-support/deploychef/files/conf-templates/swift-template.inc b/meta-openstack/recipes-support/deploychef/files/conf-templates/swift-template.inc new file mode 100644 index 0000000..4a33536 --- /dev/null +++ b/meta-openstack/recipes-support/deploychef/files/conf-templates/swift-template.inc | |||
| @@ -0,0 +1,37 @@ | |||
| 1 | #Swift chefso template generation functions | ||
| 2 | dispersion-conf_chefsolo_template() { | ||
| 3 | file_name=$1 | ||
| 4 | if [ -e $file_name ]; then | ||
| 5 | sed "s/$SERVICE_TENANT_NAME/<%=node[:SERVICE_TENANT_NAME]%>/" -i $file_name | ||
| 6 | sed "s/$SERVICE_USER/<%=node[:SERVICE_USER]%>/" -i $file_name | ||
| 7 | sed "s/$SERVICE_PASSWORD/<%=node[:SERVICE_PASSWORD]%>/" -i $file_name | ||
| 8 | mv $file_name $file_name$SUFFIX | ||
| 9 | fi | ||
| 10 | } | ||
| 11 | |||
| 12 | test-conf_chefsolo_template() { | ||
| 13 | file_name=$1 | ||
| 14 | if [ -e $file_name ]; then | ||
| 15 | sed "s/^account =.*$/account = <%=node[:ADMIN_TENANT_NAME]%>/" -i $file_name | ||
| 16 | sed "s/^username =.*$/username = <%=node[:ADMIN_USER]%>/" -i $file_name | ||
| 17 | sed "s/^password =.*$/password = <%=node[:ADMIN_PASSWORD]%>/g" -i $file_name | ||
| 18 | |||
| 19 | sed "s/^account2 =.*$/account = <%=node[:SERVICE_TENANT_NAME]%>/" -i $file_name | ||
| 20 | sed "s/^username2 =.*$/username = <%=node[:SERVICE_USER]%>/" -i $file_name | ||
| 21 | sed "s/^password2 =.*$/password = <%=node[:SERVICE_PASSWORD]%>/g" -i $file_name | ||
| 22 | |||
| 23 | sed "s/^username3 =.*$/username = <%=node[:DEMO_USER]%>/" -i $file_name | ||
| 24 | sed "s/^password3 =.*$/password = <%=node[:DEMO_PASSWORD]%>/g" -i $file_name | ||
| 25 | mv $file_name $file_name$SUFFIX | ||
| 26 | fi | ||
| 27 | } | ||
| 28 | |||
| 29 | proxy-server_chefsolo_template() { | ||
| 30 | file_name=$1 | ||
| 31 | if [ -e $file_name ]; then | ||
| 32 | sed "s/^admin_tenant_name =.*$/admin_tenant_name = <%=node[:SERVICE_TENANT_NAME]%> /" -i $file_name | ||
| 33 | sed "s/^admin_user =.*$/admin_user = <%=node[:SERVICE_USER]%> /" -i $file_name | ||
| 34 | sed "s/^admin_password =.*$/admin_password = <%=node[:SERVICE_PASSWORD]%> /" -i $file_name | ||
| 35 | mv $file_name $file_name$SUFFIX | ||
| 36 | fi | ||
| 37 | } | ||
diff --git a/meta-openstack/recipes-support/deploychef/files/generate-templates b/meta-openstack/recipes-support/deploychef/files/generate-templates new file mode 100644 index 0000000..178c8c3 --- /dev/null +++ b/meta-openstack/recipes-support/deploychef/files/generate-templates | |||
| @@ -0,0 +1,274 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | #Location of servics configuration files | ||
| 3 | D="%SYSCONFDIR%" | ||
| 4 | TEMPLATES="%DEPLOYCHEF_ROOT_DIR%/cookbooks/openstack/templates/default" | ||
| 5 | #Chefsolo template suffix | ||
| 6 | SUFFIX='.erb' | ||
| 7 | #List of services whose config files needs to be converted to templates | ||
| 8 | service_list="ceph swift nova heat cinder keystone glance neutron ceilometer init.d" | ||
| 9 | source %DEPLOYCHEF_ROOT_DIR%/conf-templates/constants.inc | ||
| 10 | source %DEPLOYCHEF_ROOT_DIR%/conf-templates/nova-template.inc | ||
| 11 | source %DEPLOYCHEF_ROOT_DIR%/conf-templates/ceph-template.inc | ||
| 12 | source %DEPLOYCHEF_ROOT_DIR%/conf-templates/swift-template.inc | ||
| 13 | source %DEPLOYCHEF_ROOT_DIR%/conf-templates/neutron-template.inc | ||
| 14 | source %DEPLOYCHEF_ROOT_DIR%/conf-templates/ceilometer-template.inc | ||
| 15 | source %DEPLOYCHEF_ROOT_DIR%/conf-templates/glance-template.inc | ||
| 16 | source %DEPLOYCHEF_ROOT_DIR%/conf-templates/postgresql-template.inc | ||
| 17 | source %DEPLOYCHEF_ROOT_DIR%/conf-templates/keystone-template.inc | ||
| 18 | source %DEPLOYCHEF_ROOT_DIR%/conf-templates/cinder-template.inc | ||
| 19 | source %DEPLOYCHEF_ROOT_DIR%/conf-templates/heat-template.inc | ||
| 20 | source %DEPLOYCHEF_ROOT_DIR%/conf-templates/hosts-template.inc | ||
| 21 | |||
| 22 | SRC="${D}/%POSTINSTS_DIR%/" | ||
| 23 | DST=${TEMPLATES} | ||
| 24 | #Copy postinstall scripts and make chefsolo templates | ||
| 25 | postinsts_make_templates(){ | ||
| 26 | for file in $(ls -h ${SRC}); do | ||
| 27 | dst_file=${DST}/$file$SUFFIX | ||
| 28 | install -m 0644 ${SRC}/$file $dst_file | ||
| 29 | sed 's|ADMIN_PASSWORD=.*$|ADMIN_PASSWORD=<%=node[:ADMIN_PASSWORD]%> \\|' -i $dst_file | ||
| 30 | sed 's|SERVICE_PASSWORD=.*$|SERVICE_PASSWORD=<%=node[:SERVICE_PASSWORD]%> \\|' -i $dst_file | ||
| 31 | sed 's|SERVICE_TENANT_NAME=.*$|SERVICE_TENANT_NAME=<%=node[:SERVICE_TENANT_NAME]%> \\|' -i $dst_file | ||
| 32 | sed "s|$CONTROLLER_IP|<%=node[:CONTROLLER_IP]%>|g" -i $dst_file | ||
| 33 | sed "s|$CONTROLLER_HOST|<%=node[:CONTROLLER_HOST]%>|g" -i $dst_file | ||
| 34 | done | ||
| 35 | } | ||
| 36 | |||
| 37 | #These sets of make_*_templates() helper functions | ||
| 38 | #copy the respective configuration files if they | ||
| 39 | #exist and converts them to chefsolo templates | ||
| 40 | etc-hosts_make_templates(){ | ||
| 41 | #Creat template file for /etc/hosts | ||
| 42 | SRC=${D} | ||
| 43 | DST=${TEMPLATES} | ||
| 44 | file_name=hosts | ||
| 45 | install -m 0644 ${SRC}/$file_name ${DST} | ||
| 46 | file_name="${DST}/$file_name" | ||
| 47 | hosts_chefsolo_template $file_name | ||
| 48 | } | ||
| 49 | |||
| 50 | make_ceph_templates(){ | ||
| 51 | file_name=ceph.conf | ||
| 52 | if [ -f ${SRC}/$file_name ]; then | ||
| 53 | install -m 0644 ${SRC}/$file_name ${DST} | ||
| 54 | file_name="${DST}/$file_name" | ||
| 55 | ceph-conf_chefsolo_template $file_name | ||
| 56 | fi | ||
| 57 | file_name=ceph-setup | ||
| 58 | if [ -f ${SRC}/$file_name ]; then | ||
| 59 | install -m 0644 ${SRC}/../init.d/$file_name ${DST} | ||
| 60 | file_name="${DST}/$file_name" | ||
| 61 | ceph-setup_chefsolo_template $file_name | ||
| 62 | fi | ||
| 63 | } | ||
| 64 | |||
| 65 | make_swift_templates(){ | ||
| 66 | file_name='test.conf' | ||
| 67 | if [ -f ${SRC}/$file_name ]; then | ||
| 68 | install -m 0644 ${SRC}/$file_name ${DST} | ||
| 69 | file_name="${DST}/$file_name" | ||
| 70 | test-conf_chefsolo_template $file_name | ||
| 71 | fi | ||
| 72 | |||
| 73 | file_name='dispersion.conf' | ||
| 74 | if [ -f ${SRC}/$file_name ]; then | ||
| 75 | install -m 0644 ${SRC}/$file_name ${DST} | ||
| 76 | file_name="${DST}/$file_name" | ||
| 77 | dispersion-conf_chefsolo_template $file_name | ||
| 78 | fi | ||
| 79 | file_name='proxy-server.conf' | ||
| 80 | if [ -f ${SRC}/$file_name ]; then | ||
| 81 | install -m 0644 ${SRC}/$file_name ${DST} | ||
| 82 | file_name="${DST}/$file_name" | ||
| 83 | proxy-server_chefsolo_template $file_name | ||
| 84 | fi | ||
| 85 | } | ||
| 86 | |||
| 87 | make_nova_templates(){ | ||
| 88 | file_name=nova.conf | ||
| 89 | if [ -f ${SRC}/$file_name ]; then | ||
| 90 | install -m 0644 ${SRC}/$file_name ${DST} | ||
| 91 | file_name="${DST}/$file_name" | ||
| 92 | nova-conf_chefsolo_template $file_name | ||
| 93 | fi | ||
| 94 | file_name=openrc | ||
| 95 | if [ -f ${SRC}/$file_name ]; then | ||
| 96 | install -m 0644 ${SRC}/$file_name ${DST} | ||
| 97 | file_name="${DST}/$file_name" | ||
| 98 | openrc_chefsolo_template $file_name | ||
| 99 | fi | ||
| 100 | file_name=api-paste.ini | ||
| 101 | if [ -f ${SRC}/$file_name ]; then | ||
| 102 | install -m 0644 ${SRC}/$file_name ${DST} | ||
| 103 | file_name="${DST}/$file_name" | ||
| 104 | api-paste_chefsolo_template $file_name | ||
| 105 | fi | ||
| 106 | |||
| 107 | file_name=deploy.conf | ||
| 108 | if [ -f ${SRC}/$file_name ]; then | ||
| 109 | install -m 0644 ${SRC}/$file_name ${DST} | ||
| 110 | file_name="${DST}/$file_name" | ||
| 111 | deploy-conf_chefsolo_template $file_name | ||
| 112 | fi | ||
| 113 | } | ||
| 114 | |||
| 115 | make_neutron_templates(){ | ||
| 116 | file_name=neutron.conf | ||
| 117 | install -m 0644 ${SRC}/$file_name ${DST} | ||
| 118 | file_name="${DST}/$file_name" | ||
| 119 | neutron-conf_chefsolo_template $file_name | ||
| 120 | if [ -d ${SRC}/plugins/openvswitch ]; then | ||
| 121 | file_name=ovs_neutron_plugin.ini | ||
| 122 | install -m 0644 ${SRC}/plugins/openvswitch/$file_name ${DST} | ||
| 123 | file_name="${DST}/$file_name" | ||
| 124 | neutron-plugins_chefsolo_template $file_name | ||
| 125 | fi | ||
| 126 | |||
| 127 | if [ -d ${SRC}/plugins/linuxbridge ]; then | ||
| 128 | file_name=linuxbridge_conf.ini | ||
| 129 | install -m 0644 ${SRC}/plugins/linuxbridge/$file_name ${DST} | ||
| 130 | file_name="${DST}/$file_name" | ||
| 131 | neutron-plugins_chefsolo_template $file_name | ||
| 132 | fi | ||
| 133 | } | ||
| 134 | make_heat_templates(){ | ||
| 135 | file_name=heat.conf | ||
| 136 | if [ -f ${SRC}/$file_name ]; then | ||
| 137 | install -m 0644 ${SRC}/$file_name ${DST} | ||
| 138 | file_name="${DST}/$file_name" | ||
| 139 | heat-conf_chefsolo_template $file_name | ||
| 140 | fi | ||
| 141 | } | ||
| 142 | |||
| 143 | make_cinder_templates(){ | ||
| 144 | file_name=api-paste.ini | ||
| 145 | if [ -f ${SRC}/$file_name ]; then | ||
| 146 | install -m 0644 ${SRC}/$file_name ${DST}/${file_name}.cinder | ||
| 147 | file_name="${DST}/${file_name}.cinder" | ||
| 148 | cinder-api_chefsolo_template $file_name | ||
| 149 | fi | ||
| 150 | |||
| 151 | file_name=cinder.conf | ||
| 152 | if [ -f ${SRC}/$file_name ]; then | ||
| 153 | install -m 0644 ${SRC}/$file_name ${DST} | ||
| 154 | file_name="${DST}/$file_name" | ||
| 155 | cinder-conf_chefsolo_template $file_name | ||
| 156 | fi | ||
| 157 | } | ||
| 158 | make_keystone_templates(){ | ||
| 159 | file_name=keystone.conf | ||
| 160 | if [ -f ${SRC}/$file_name ]; then | ||
| 161 | install -m 0644 ${SRC}/$file_name ${DST} | ||
| 162 | file_name="${DST}/$file_name" | ||
| 163 | keystone-conf_chefsolo_template $file_name | ||
| 164 | fi | ||
| 165 | file_name=identity.sh | ||
| 166 | if [ -f ${SRC}/$file_name ]; then | ||
| 167 | install -m 0644 ${SRC}/$file_name ${DST} | ||
| 168 | file_name="${DST}/$file_name" | ||
| 169 | keystone-identity_chefsolo_template $file_name | ||
| 170 | fi | ||
| 171 | } | ||
| 172 | make_glance_templates(){ | ||
| 173 | file_name=glance-api.conf | ||
| 174 | if [ -f ${SRC}/$file_name ]; then | ||
| 175 | install -m 0644 ${SRC}/$file_name ${DST} | ||
| 176 | file_name="${DST}/$file_name" | ||
| 177 | glance_chefsolo_template $file_name | ||
| 178 | fi | ||
| 179 | |||
| 180 | file_name=glance-cache.conf | ||
| 181 | if [ -f ${SRC}/$file_name ]; then | ||
| 182 | install -m 0644 ${SRC}/$file_name ${DST} | ||
| 183 | file_name="${DST}/$file_name" | ||
| 184 | glance_chefsolo_template $file_name | ||
| 185 | fi | ||
| 186 | file_name=glance-registry.conf | ||
| 187 | if [ -f ${SRC}/$file_name ]; then | ||
| 188 | install -m 0644 ${SRC}/$file_name ${DST} | ||
| 189 | file_name="${DST}/$file_name" | ||
| 190 | glance_chefsolo_template $file_name | ||
| 191 | fi | ||
| 192 | } | ||
| 193 | |||
| 194 | make_ceilometer_templates(){ | ||
| 195 | |||
| 196 | file_name=ceilometer.conf | ||
| 197 | if [ -f ${SRC}/$file_name ]; then | ||
| 198 | install -m 0644 ${SRC}/$file_name ${DST} | ||
| 199 | file_name="${DST}/$file_name" | ||
| 200 | ceilometer-conf_chefsolo_template $file_name | ||
| 201 | fi | ||
| 202 | } | ||
| 203 | |||
| 204 | make_postgresql_templates(){ | ||
| 205 | |||
| 206 | file_name=postgresql-init | ||
| 207 | if [ -f ${SRC}/$file_name ]; then | ||
| 208 | install -m 0644 ${SRC}/$file_name ${DST} | ||
| 209 | file_name="${DST}/$file_name" | ||
| 210 | postgresql_chefsolo_template $file_name | ||
| 211 | fi | ||
| 212 | } | ||
| 213 | |||
| 214 | |||
| 215 | #This function installs the config/script files of services | ||
| 216 | #and converts them into templates. | ||
| 217 | services-conf_make_templates(){ | ||
| 218 | for mod in ${service_list}; do | ||
| 219 | if [ -d ${D}/$mod ]; then | ||
| 220 | SRC=${D}/$mod | ||
| 221 | DST=${TEMPLATES} | ||
| 222 | case $mod in | ||
| 223 | ceph) | ||
| 224 | #Copy ceph configuration files and convert them to templates | ||
| 225 | make_ceph_templates | ||
| 226 | ;; | ||
| 227 | swift) | ||
| 228 | #Copy swift configuration files and convert them into | ||
| 229 | #chefsolo templates | ||
| 230 | make_swift_templates | ||
| 231 | |||
| 232 | ;; | ||
| 233 | nova) | ||
| 234 | #Copy nova configuration files and convert them into | ||
| 235 | #chefsolo templates | ||
| 236 | make_nova_templates | ||
| 237 | ;; | ||
| 238 | neutron) | ||
| 239 | #Copy neutron configuration files and convert them into | ||
| 240 | #chefsolo templates | ||
| 241 | make_neutron_templates | ||
| 242 | ;; | ||
| 243 | heat) | ||
| 244 | make_heat_templates | ||
| 245 | ;; | ||
| 246 | cinder) | ||
| 247 | make_cinder_templates | ||
| 248 | ;; | ||
| 249 | keystone) | ||
| 250 | make_keystone_templates | ||
| 251 | ;; | ||
| 252 | glance) | ||
| 253 | #Copy glance configuration files and convert them into | ||
| 254 | #chefsolo templates | ||
| 255 | make_glance_templates | ||
| 256 | ;; | ||
| 257 | ceilometer) | ||
| 258 | make_ceilometer_templates | ||
| 259 | ;; | ||
| 260 | init.d) | ||
| 261 | make_postgresql_templates | ||
| 262 | ;; | ||
| 263 | *) | ||
| 264 | ;; | ||
| 265 | esac | ||
| 266 | echo "Service present in $mod" | ||
| 267 | fi | ||
| 268 | done | ||
| 269 | } | ||
| 270 | |||
| 271 | install -d ${TEMPLATES} | ||
| 272 | postinsts_make_templates | ||
| 273 | etc-hosts_make_templates | ||
| 274 | services-conf_make_templates | ||
