Add role specific information to the service template
[apex-tripleo-heat-templates.git] / puppet / services / barbican-api.yaml
1 heat_template_version: pike
2
3 description: >
4   OpenStack Barbican API service configured with Puppet
5
6 parameters:
7   ServiceNetMap:
8     default: {}
9     description: Mapping of service_name -> network name. Typically set
10                  via parameter_defaults in the resource registry.  This
11                  mapping overrides those in ServiceNetMapDefaults.
12     type: json
13   DefaultPasswords:
14     default: {}
15     type: json
16   RoleName:
17     default: ''
18     description: Role name on which the service is applied
19     type: string
20   RoleParameters:
21     default: {}
22     description: Parameters specific to the role
23     type: json
24   EndpointMap:
25     default: {}
26     description: Mapping of service endpoint -> protocol. Typically set
27                  via parameter_defaults in the resource registry.
28     type: json
29   BarbicanPassword:
30     description: The password for the barbican service account.
31     type: string
32     hidden: true
33   BarbicanWorkers:
34     description: Set the number of workers for barbican::wsgi::apache
35     default: '%{::processorcount}'
36     type: string
37   Debug:
38     default: ''
39     description: Set to True to enable debugging on all services.
40     type: string
41   KeystoneRegion:
42     type: string
43     default: 'regionOne'
44     description: Keystone region for endpoint
45   RabbitClientPort:
46     default: 5672
47     description: Set rabbit subscriber port, change this if using SSL
48     type: number
49   RabbitClientUseSSL:
50     default: false
51     description: >
52         Rabbit client subscriber parameter to specify
53         an SSL connection to the RabbitMQ host.
54     type: string
55   RabbitPassword:
56     description: The password for RabbitMQ
57     type: string
58     hidden: true
59   RabbitUserName:
60     default: guest
61     description: The username for RabbitMQ
62     type: string
63   EnableInternalTLS:
64     type: boolean
65     default: false
66   BarbicanPolicies:
67     description: |
68       A hash of policies to configure for Barbican.
69       e.g. { barbican-context_is_admin: { key: context_is_admin, value: 'role:admin' } }
70     default: {}
71     type: json
72
73 resources:
74
75   ApacheServiceBase:
76     type: ./apache.yaml
77     properties:
78       ServiceNetMap: {get_param: ServiceNetMap}
79       DefaultPasswords: {get_param: DefaultPasswords}
80       EndpointMap: {get_param: EndpointMap}
81       RoleName: {get_param: RoleName}
82       RoleParameters: {get_param: RoleParameters}
83
84 outputs:
85   role_data:
86     description: Role data for the Barbican API role.
87     value:
88       service_name: barbican_api
89       config_settings:
90         map_merge:
91           - get_attr: [ApacheServiceBase, role_data, config_settings]
92           - barbican::keystone::authtoken::password: {get_param: BarbicanPassword}
93             barbican::keystone::authtoken::auth_uri: {get_param: [EndpointMap, KeystoneInternal, uri_no_suffix]}
94             barbican::keystone::authtoken::auth_url: { get_param: [EndpointMap, KeystoneInternal, uri_no_suffix]}
95             barbican::keystone::authtoken::project_name: 'service'
96             barbican::policy::policies: {get_param: BarbicanPolicies}
97             barbican::api::host_href: {get_param: [EndpointMap, BarbicanPublic, uri]}
98             barbican::api::db_auto_create: false
99             barbican::api::enabled_certificate_plugins: ['simple_certificate']
100             barbican::api::logging::debug: {get_param: Debug}
101             barbican::api::rabbit_use_ssl: {get_param: RabbitClientUseSSL}
102             barbican::api::rabbit_userid: {get_param: RabbitUserName}
103             barbican::api::rabbit_password: {get_param: RabbitPassword}
104             barbican::api::rabbit_port: {get_param: RabbitClientPort}
105             barbican::api::rabbit_heartbeat_timeout_threshold: 60
106             barbican::api::service_name: 'httpd'
107             barbican::wsgi::apache::bind_host: {get_param: [ServiceNetMap, BarbicanApiNetwork]}
108             barbican::wsgi::apache::ssl:  {get_param: EnableInternalTLS}
109             barbican::wsgi::apache::workers: {get_param: BarbicanWorkers}
110             barbican::wsgi::apache::servername:
111               str_replace:
112                 template:
113                   "%{hiera('fqdn_$NETWORK')}"
114                 params:
115                   $NETWORK: {get_param: [ServiceNetMap, BarbicanApiNetwork]}
116             barbican::db::database_connection:
117               make_url:
118                 scheme: {get_param: [EndpointMap, MysqlInternal, protocol]}
119                 username: barbican
120                 password: {get_param: BarbicanPassword}
121                 host: {get_param: [EndpointMap, MysqlInternal, host]}
122                 path: /barbican
123                 query:
124                   read_default_file: /etc/my.cnf.d/tripleo.cnf
125                   read_default_group: tripleo
126             tripleo.barbican_api.firewall_rules:
127               '117 barbican':
128                 dport:
129                   - 9311
130                   - 13311
131       step_config: |
132         include ::tripleo::profile::base::barbican::api
133       service_config_settings:
134         mysql:
135           barbican::db::mysql::password: {get_param: BarbicanPassword}
136           barbican::db::mysql::user: barbican
137           barbican::db::mysql::host: {get_param: [EndpointMap, MysqlInternal, host_nobrackets]}
138           barbican::db::mysql::dbname: barbican
139           barbican::db::mysql::allowed_hosts:
140             - '%'
141             - "%{hiera('mysql_bind_host')}"
142         keystone:
143           barbican::keystone::auth::public_url: {get_param: [EndpointMap, BarbicanPublic, uri]}
144           barbican::keystone::auth::internal_url: {get_param: [EndpointMap, BarbicanInternal, uri]}
145           barbican::keystone::auth::admin_url: {get_param: [EndpointMap, BarbicanAdmin, uri]}
146           barbican::keystone::auth::password: {get_param: BarbicanPassword}
147           barbican::keystone::auth::region: {get_param: KeystoneRegion}
148           barbican::keystone::auth::tenant: 'service'
149         nova_compute:
150           nova::compute::keymgr_api_class: >
151             castellan.key_manager.barbican_key_manager.BarbicanKeyManager
152           nova::compute::barbican_endpoint:
153             get_param: [EndpointMap, BarbicanInternal, uri]
154           nova::compute::barbican_auth_endpoint:
155             get_param: [EndpointMap, KeystoneInternal, uri_no_suffix]
156         cinder_api:
157           cinder::api::keymgr_api_class: >
158             castellan.key_manager.barbican_key_manager.BarbicanKeyManager
159           cinder::api::keymgr_encryption_api_url:
160             get_param: [EndpointMap, BarbicanInternal, uri]
161           cinder::api::keymgr_encryption_auth_url:
162             get_param: [EndpointMap, KeystoneInternal, uri_no_suffix]
163       metadata_settings:
164         get_attr: [ApacheServiceBase, role_data, metadata_settings]
165       upgrade_tasks:
166         yaql:
167           expression: $.data.apache_upgrade + $.data.barbican_api_upgrade
168           data:
169             apache_upgrade:
170               get_attr: [ApacheServiceBase, role_data, upgrade_tasks]
171             barbican_api_upgrade:
172               - name: Check if barbican_api is deployed
173                 command: systemctl is-enabled openstack-barbican-api
174                 tags: common
175                 ignore_errors: True
176                 register: barbican_api_enabled
177               - name: "PreUpgrade step0,validation: Check service openstack-barbican-api is running"
178                 shell: /usr/bin/systemctl show 'openstack-barbican-api' --property ActiveState | grep '\bactive\b'
179                 when: barbican_api_enabled.rc == 0
180                 tags: step0,validation
181               - name: Install openstack-barbican-api package if it was disabled
182                 tags: step3
183                 yum: name=openstack-barbican-api state=latest
184                 when: barbican_api_enabled.rc != 0