Skip to content

Commit 04aa7bd

Browse files
committed
Templates for OpenStack Antelope version
Main changes compared to Yoga templates: - All API services, except Keystone, handled by uwsgi instead of the openstack-xxx-api service (recommended configuration) - https terminated by a Nginx proxy for all API services, including the WSGI apps run into Apache (Keystone, Horizon)
1 parent 256e604 commit 04aa7bd

File tree

105 files changed

+2601
-729
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+2601
-729
lines changed

defaults/openstack/config.pan

Lines changed: 187 additions & 32 deletions
Large diffs are not rendered by default.

defaults/openstack/functions.pan

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@ function openstack_add_component_dependency = {
120120

121121
@documentation {
122122

123-
This function returns the value receive in argument if it is defined, null
124-
otherwise. It is a helper for assigning optional values to the schema.
123+
This function returns the value received in argument if it is defined, null
124+
otherwise. It is a helper for assigning optional values to the schema.
125125

126126
}
127127
function openstack_add_if_defined = {
@@ -137,3 +137,35 @@ function openstack_add_if_defined = {
137137
null;
138138
};
139139
};
140+
141+
142+
@documentation {
143+
144+
This function returns a filecopy/services entry to load the policy file passed as
145+
argument, after checking it as a valid extension
146+
147+
Arguments:
148+
- Name of the service the policy applies to (must match a directory under /etc on the target server)
149+
- File path containing the policy source, relative to the current loadpath
150+
}
151+
function openstack_load_policy = {
152+
if ( ARGC != 2 ) {
153+
error('openstack_load_policy usage: openstack_load_policy(service, policy_file)');
154+
};
155+
service = ARGV[0];
156+
policy_source = ARGV[1];
157+
if ( is_defined(policy_source) ) {
158+
if ( !match(policy_source, '.*\.yaml$') ) {
159+
error('policy_source must be a file name with the extension .yaml');
160+
};
161+
policy_file = format('/etc/%s/policy.yaml', service);
162+
SELF[escape(policy_file)] = dict(
163+
'config', file_contents(policy_source),
164+
'owner', 'root',
165+
'perms', '0644',
166+
'backup', true,
167+
);
168+
};
169+
170+
SELF;
171+
};

defaults/openstack/utils.pan

Lines changed: 57 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -14,65 +14,70 @@ prefix '/software/components/metaconfig/services/{/root/admin-openrc.sh}';
1414
'contents/variables/OS_TENANT_NAME' = 'admin';
1515
'contents/variables/OS_USERNAME' = OS_USERNAME;
1616
'contents/variables/OS_PASSWORD' = OS_PASSWORD;
17-
'contents/variables/OS_AUTH_URL' = OS_KEYSTONE_CONTROLLER_PROTOCOL + '://' + OS_KEYSTONE_CONTROLLER_HOST + ':35357/v3';
17+
'contents/variables/OS_AUTH_URL' = format(
18+
'%s://%s:%s/v3',
19+
OS_KEYSTONE_CONTROLLER_PROTOCOL,
20+
OS_KEYSTONE_CONTROLLER_HOST,
21+
if ( !is_null(OS_KEYSTONE_PUBLIC_ADMIN_PORT) ) OS_KEYSTONE_PUBLIC_ADMIN_PORT else OS_KEYSTONE_CONTROLLER_ADMIN_PORT,
22+
);
1823
'contents/variables/OS_IDENTITY_API_VERSION' = 3;
1924

2025
# Create a initialization script
2126

2227
variable CONTENTS_INIT_SCRIPT = {
23-
if (OS_NEUTRON_DEFAULT) {
24-
file_contents('defaults/openstack/init.sh') + file_contents('defaults/openstack/init-network.sh');
25-
} else {
26-
file_contents('defaults/openstack/init.sh');
27-
};
28+
if (OS_NEUTRON_DEFAULT) {
29+
file_contents('defaults/openstack/init.sh') + file_contents('defaults/openstack/init-network.sh');
30+
} else {
31+
file_contents('defaults/openstack/init.sh');
32+
};
2833
};
2934
include 'components/filecopy/config';
3035
prefix '/software/components/filecopy/services';
3136
'{/root/init.sh}' = dict(
32-
'perms' ,'755',
33-
'config', format(
34-
CONTENTS_INIT_SCRIPT,
35-
OS_RABBITMQ_USERNAME,
36-
OS_RABBITMQ_PASSWORD,
37-
OS_REGION_NAME,
38-
OS_KEYSTONE_CONTROLLER_HOST,
39-
OS_KEYSTONE_CONTROLLER_HOST,
40-
OS_GLANCE_CONTROLLER_HOST,
41-
OS_NOVA_CONTROLLER_HOST,
42-
OS_NEUTRON_CONTROLLER_HOST,
43-
OS_HEAT_HOST,
44-
OS_HEAT_HOST,
45-
OS_CINDER_CONTROLLER_HOST,
46-
OS_CINDER_CONTROLLER_HOST,
47-
OS_CEILOMETER_CONTROLLER_HOST,
48-
OS_USERNAME,
49-
OS_PASSWORD,
50-
OS_GLANCE_USERNAME,
51-
OS_GLANCE_PASSWORD,
52-
OS_NOVA_USERNAME,
53-
OS_NOVA_PASSWORD,
54-
OS_NEUTRON_USERNAME,
55-
OS_NEUTRON_PASSWORD,
56-
OS_HEAT_USERNAME,
57-
OS_HEAT_PASSWORD,
58-
OS_HEAT_STACK_DOMAIN,
59-
OS_HEAT_DOMAIN_ADMIN_USERNAME,
60-
OS_HEAT_DOMAIN_ADMIN_PASSWORD,
61-
OS_CINDER_USERNAME,
62-
OS_CINDER_PASSWORD,
63-
OS_CEILOMETER_DB_HOST,
64-
OS_CEILOMETER_DB_USERNAME,
65-
OS_CEILOMETER_DB_PASSWORD,
66-
OS_CEILOMETER_USERNAME,
67-
OS_CEILOMETER_PASSWORD,
68-
OS_ADMIN_TOKEN,
69-
OS_NEUTRON_DEFAULT_NETWORKS,
70-
OS_NEUTRON_DEFAULT_DHCP_POOL['start'],
71-
OS_NEUTRON_DEFAULT_DHCP_POOL['end'],
72-
OS_NEUTRON_DEFAULT_GATEWAY,
73-
OS_NEUTRON_DEFAULT_NAMESERVER,
74-
OS_PLACEMENT_USERNAME,
75-
OS_PLACEMENT_PASSWORD,
76-
OS_PLACEMENT_CONTROLLER_HOST,
77-
),
37+
'perms', '755',
38+
'config', format(
39+
CONTENTS_INIT_SCRIPT,
40+
OS_RABBITMQ_USERNAME,
41+
OS_RABBITMQ_PASSWORD,
42+
OS_REGION_NAME,
43+
OS_KEYSTONE_CONTROLLER_HOST,
44+
OS_KEYSTONE_CONTROLLER_HOST,
45+
OS_GLANCE_CONTROLLER_HOST,
46+
OS_NOVA_CONTROLLER_HOST,
47+
OS_NEUTRON_CONTROLLER_HOST,
48+
OS_HEAT_CONTROLLER_HOST,
49+
OS_HEAT_CONTROLLER_HOST,
50+
OS_CINDER_CONTROLLER_HOST,
51+
OS_CINDER_CONTROLLER_HOST,
52+
OS_CEILOMETER_CONTROLLER_HOST,
53+
OS_USERNAME,
54+
OS_PASSWORD,
55+
OS_GLANCE_USERNAME,
56+
OS_GLANCE_PASSWORD,
57+
OS_NOVA_USERNAME,
58+
OS_NOVA_PASSWORD,
59+
OS_NEUTRON_USERNAME,
60+
OS_NEUTRON_PASSWORD,
61+
OS_HEAT_USERNAME,
62+
OS_HEAT_PASSWORD,
63+
OS_HEAT_STACK_DOMAIN,
64+
OS_HEAT_DOMAIN_ADMIN_USERNAME,
65+
OS_HEAT_DOMAIN_ADMIN_PASSWORD,
66+
OS_CINDER_USERNAME,
67+
OS_CINDER_PASSWORD,
68+
OS_CEILOMETER_DB_HOST,
69+
OS_CEILOMETER_DB_USERNAME,
70+
OS_CEILOMETER_DB_PASSWORD,
71+
OS_CEILOMETER_USERNAME,
72+
OS_CEILOMETER_PASSWORD,
73+
OS_ADMIN_TOKEN,
74+
OS_NEUTRON_DEFAULT_NETWORKS,
75+
OS_NEUTRON_DEFAULT_DHCP_POOL['start'],
76+
OS_NEUTRON_DEFAULT_DHCP_POOL['end'],
77+
OS_NEUTRON_DEFAULT_GATEWAY,
78+
OS_NEUTRON_DEFAULT_NAMESERVER,
79+
OS_PLACEMENT_USERNAME,
80+
OS_PLACEMENT_PASSWORD,
81+
OS_PLACEMENT_CONTROLLER_HOST,
82+
),
7883
);

features/barbican/config.pan

Lines changed: 36 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ unique template features/barbican/config;
22

33
variable OS_NODE_SERVICES = append('barbican');
44

5+
final variable OS_BARBICAN_API_PROCESSES ?= 8;
6+
final variable OS_BARBICAN_LOG_DIR ?= '/var/log/barbican';
7+
final variable OS_BARBICAN_GROUP ?= OS_BARBICAN_USERNAME;
8+
9+
510
# Load some useful functions
611
include 'defaults/openstack/functions';
712

@@ -11,11 +16,13 @@ include 'types/openstack/barbican';
1116
# Include general openstack variables
1217
include 'defaults/openstack/config';
1318

19+
# Include policy file if OS_BARBICAN_POLICY is defined
20+
include 'components/filecopy/config';
21+
'/software/components/filecopy/services' = openstack_load_policy('barbican', OS_BARBICAN_POLICY);
22+
23+
1424
include 'features/barbican/rpms';
1525

16-
include 'components/systemd/config';
17-
prefix '/software/components/systemd/unit';
18-
'httpd/startstop' = true;
1926

2027
###################################
2128
# Configuration file for Barbican #
@@ -26,7 +33,6 @@ prefix '/software/components/metaconfig/services/{/etc/barbican/barbican.conf}';
2633
'module' = 'tiny';
2734
'convert/joincomma' = true;
2835
'convert/truefalse' = true;
29-
'daemons/httpd' = 'restart';
3036
# Restart memcached to ensure considtency with service configuration changes
3137
'daemons/memcached' = 'restart';
3238
bind '/software/components/metaconfig/services/{/etc/barbican/barbican.conf}/contents' = openstack_barbican_config;
@@ -35,37 +41,41 @@ bind '/software/components/metaconfig/services/{/etc/barbican/barbican.conf}/con
3541
# [DEFAULT] section
3642
'contents/DEFAULT' = openstack_load_config('features/openstack/base');
3743
'contents/DEFAULT' = openstack_load_config('features/openstack/logging/' + OS_LOGGING_TYPE);
38-
'contents/DEFAULT' = openstack_load_ssl_config( OS_BARBICAN_PROTOCOL == 'https' );
3944
'contents/DEFAULT/my_ip' = PRIMARY_IP;
4045
'contents/DEFAULT/log_file' = 'barbican-api.log';
41-
'contents/DEFAULT/host_href' = format('%s://%s:%s', OS_BARBICAN_PROTOCOL, OS_BARBICAN_HOST, OS_BARBICAN_PORT);
46+
'contents/DEFAULT/host_href' = format(
47+
'%s://%s:%s',
48+
OS_BARBICAN_PROTOCOL,
49+
OS_BARBICAN_PUBLIC_HOST,
50+
if ( is_defined(OS_BARBICAN_PUBLIC_PORT) ) OS_BARBICAN_PUBLIC_PORT else OS_BARBICAN_CONTROLLER_PORT,
51+
);
4252
'contents/DEFAULT/log_dir' = '/var/log/barbican';
43-
'contents/DEFAULT/sql_connection' = format('mysql+pymysql://%s:%s@%s/barbican', OS_BARBICAN_DB_USERNAME, OS_BARBICAN_DB_PASSWORD, OS_BARBICAN_DB_HOST);
53+
'contents/DEFAULT/rpc_response_timeout' = 120;
54+
'contents/DEFAULT/sql_connection' = format(
55+
'mysql+pymysql://%s:%s@%s/barbican',
56+
OS_BARBICAN_DB_USERNAME,
57+
OS_BARBICAN_DB_PASSWORD,
58+
OS_BARBICAN_DB_HOST,
59+
);
60+
'contents/DEFAULT/wsgi_default_pool_size' = OS_BARBICAN_WSGI_POOL_SIZE;
4461

4562
# [keystone_authtoken] section
4663
'contents/keystone_authtoken' = openstack_load_config(OS_AUTH_CLIENT_CONFIG);
4764
'contents/keystone_authtoken/username' = OS_BARBICAN_USERNAME;
4865
'contents/keystone_authtoken/password' = OS_BARBICAN_PASSWORD;
4966

67+
#[oslo_messaging_rabbit] section
68+
'contents/oslo_messaging_rabbit' = openstack_load_config('features/rabbitmq/openstack/client/base');
69+
'contents/oslo_messaging_rabbit/heartbeat_in_pthread' = false;
70+
'contents/oslo_messaging_rabbit/kombu_missing_consumer_retry_timeout' = 120;
5071

51-
# ############
52-
# httpd conf #
53-
# ############
54-
55-
prefix '/software/components/metaconfig/services/{/etc/httpd/conf.d/wsgi-barbican.conf}';
56-
'module' = 'openstack/wsgi-barbican';
57-
'daemons/httpd' = 'restart';
58-
'contents/listen' = '9311';
72+
###################
73+
# Configure uSWGI #
74+
###################
75+
include 'features/barbican/uwsgi/config';
5976

60-
'contents/vhosts/0/port' = 9311;
61-
'contents/vhosts/0/processgroup' = 'barbican-api';
62-
'contents/vhosts/0/script' = ' /usr/lib/python3.6/site-packages/barbican/api/app.wsgi';
63-
'contents/vhosts/0/ssl' = openstack_load_ssl_config( OS_BARBICAN_PROTOCOL == 'https' );
6477

65-
# Load TT file to configure Barbican virtual host
66-
# Run metaconfig in case the TT file was modified and configuration must be regenerated
67-
include 'components/filecopy/config';
68-
'/software/components/filecopy/dependencies/post' = openstack_add_component_dependency('metaconfig');
69-
prefix '/software/components/filecopy/services/{/usr/share/templates/quattor/metaconfig/openstack/wsgi-barbican.tt}';
70-
'config' = file_contents('features/barbican/metaconfig/wsgi-barbican.tt');
71-
'perms' = '0644';
78+
#########################################
79+
# Configure SSL proxy if SSL is enabled #
80+
#########################################
81+
include if ( OS_BARBICAN_PROTOCOL == 'https' ) 'features/barbican/nginx/config';

features/barbican/metaconfig/wsgi-barbican.tt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Listen [% port %]
77
<VirtualHost *:[% vhost.port %]>
88
WSGIDaemonProcess [% vhost.processgroup %] processes=2 threads=8 user=barbican group=barbican display-name=%{GROUP}
99
WSGIProcessGroup [% vhost.processgroup %]
10-
WSGIScriptAlias / [% vhost.script %]
10+
WSGIScriptAlias / [% vhost.script_path %]/[% vhost.script_name %]
1111
WSGIApplicationGroup %{GLOBAL}
1212
WSGIPassAuthorization On
1313
<IfVersion >= 2.4>
@@ -23,7 +23,7 @@ Listen [% port %]
2323
ErrorLog /var/log/httpd//barbican_wsgi_main_error_ssl.log
2424
CustomLog /var/log/httpd/barbican_wsgi_main_access_ssl.log combined
2525

26-
<Directory /usr/lib/python3.6/site-packages/barbican/api>
26+
<Directory [% vhost.script_path %]>
2727
<IfVersion >= 2.4>
2828
Require all granted
2929
</IfVersion>

features/barbican/nginx/config.pan

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Add a Nginx VH for handling barbican https requests
2+
3+
unique template features/barbican/nginx/config;
4+
5+
variable OS_BARBICAN_PUBLIC_HOST ?= error('OS_BARBICAN_PUBLIC_HOST must be defined when using SSL with Barbican');
6+
variable OS_BARBICAN_PUBLIC_PORT ?= error('OS_BARBICAN_PUBLIC_PORT must be defined when using SSL with Barbican');
7+
8+
include 'types/openstack/core';
9+
10+
# Add Nginx and its base configuration
11+
include 'features/nginx/openstack/config';
12+
13+
# Nginx proxy configuration for Barbican
14+
include 'components/metaconfig/config';
15+
prefix '/software/components/metaconfig/services/{/etc/nginx/conf.d/barbican.conf}';
16+
'module' = 'openstack/nginx-proxy';
17+
'daemons/nginx' = 'restart';
18+
# panlint disable=LP006
19+
bind '/software/components/metaconfig/services/{/etc/nginx/conf.d/barbican.conf}/contents' = openstack_nginx_proxy_config;
20+
21+
'contents/bind_port' = OS_BARBICAN_PUBLIC_PORT;
22+
'contents/proxy_host' = OS_BARBICAN_CONTROLLER_HOST;
23+
'contents/proxy_port' = OS_BARBICAN_CONTROLLER_PORT;
24+
'contents/server_name' = OS_BARBICAN_PUBLIC_HOST;
25+
'contents/service' = 'barbican';
26+
'contents/ssl' = openstack_load_ssl_config( true );

features/barbican/rpms.pan

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ include 'defaults/openstack/functions';
77
pkg_repl('python3-barbican');
88
pkg_repl('openstack-barbican-api');
99
pkg_repl('libibverbs');
10-
openstack_add_httpd_packages( OS_BARBICAN_PROTOCOL == 'https' );
1110

1211
SELF;
1312
};

features/barbican/uwsgi/config.pan

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
unique template features/barbican/uwsgi/config;
2+
3+
4+
include 'features/uwsgi/openstack/config';
5+
6+
# Load TT file to configure uwsgi application
7+
# Run metaconfig in case the TT file was modified and configuration must be regenerated
8+
include 'components/filecopy/config';
9+
'/software/components/filecopy/dependencies/post' = openstack_add_component_dependency('metaconfig');
10+
prefix '/software/components/filecopy/services/{/usr/share/templates/quattor/metaconfig/openstack/barbican-api.tt}';
11+
'config' = file_contents('features/uwsgi/openstack/vassal-paste_deploy.ini.tt');
12+
'perms' = '0644';
13+
14+
# uwsgi configuration for Barbican API: no explicit restart needed, handled by uwsgi when config file changes
15+
include 'components/metaconfig/config';
16+
prefix '/software/components/metaconfig/services/{/etc/uwsgi.d/barbican-api.ini}';
17+
'module' = 'openstack/barbican-api';
18+
# Owner/group must match the one used to run the application
19+
'group' = OS_BARBICAN_GROUP;
20+
'owner' = OS_BARBICAN_USERNAME;
21+
# panlint disable=LP006
22+
bind '/software/components/metaconfig/services/{/etc/uwsgi.d/barbican-api.ini}/contents' = openstack_uwsgi_application_config;
23+
24+
'contents/bind_host' = OS_BARBICAN_CONTROLLER_HOST;
25+
'contents/bind_port' = OS_BARBICAN_CONTROLLER_PORT;
26+
'contents/config_files' = list('/etc/barbican/barbican.conf');
27+
'contents/group' = OS_BARBICAN_GROUP;
28+
'contents/log_file' = format("%s/api.log", OS_BARBICAN_LOG_DIR);
29+
'contents/processes' = OS_BARBICAN_API_PROCESSES;
30+
'contents/user' = OS_BARBICAN_USERNAME;
31+
'contents/wsgi_file' = '/etc/barbican/barbican-api-paste.ini';

0 commit comments

Comments
 (0)