Merge "Allow to set Notification Driver to 'noop'"
[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   BarbicanDebug:
42     default: ''
43     description: Set to True to enable debugging Barbican service.
44     type: string
45   KeystoneRegion:
46     type: string
47     default: 'regionOne'
48     description: Keystone region for endpoint
49   RabbitClientPort:
50     default: 5672
51     description: Set rabbit subscriber port, change this if using SSL
52     type: number
53   RabbitClientUseSSL:
54     default: false
55     description: >
56         Rabbit client subscriber parameter to specify
57         an SSL connection to the RabbitMQ host.
58     type: string
59   RabbitPassword:
60     description: The password for RabbitMQ
61     type: string
62     hidden: true
63   RabbitUserName:
64     default: guest
65     description: The username for RabbitMQ
66     type: string
67   EnableInternalTLS:
68     type: boolean
69     default: false
70   BarbicanPolicies:
71     description: |
72       A hash of policies to configure for Barbican.
73       e.g. { barbican-context_is_admin: { key: context_is_admin, value: 'role:admin' } }
74     default: {}
75     type: json
76   NotificationDriver:
77     type: string
78     default: 'messagingv2'
79     description: Driver or drivers to handle sending notifications.
80     constraints:
81       - allowed_values: [ 'messagingv2', 'noop' ]
82
83 resources:
84
85   ApacheServiceBase:
86     type: ./apache.yaml
87     properties:
88       ServiceNetMap: {get_param: ServiceNetMap}
89       DefaultPasswords: {get_param: DefaultPasswords}
90       EndpointMap: {get_param: EndpointMap}
91       RoleName: {get_param: RoleName}
92       RoleParameters: {get_param: RoleParameters}
93
94 conditions:
95   service_debug_unset: {equals : [{get_param: BarbicanDebug}, '']}
96
97 outputs:
98   role_data:
99     description: Role data for the Barbican API role.
100     value:
101       service_name: barbican_api
102       config_settings:
103         map_merge:
104           - get_attr: [ApacheServiceBase, role_data, config_settings]
105           - barbican::keystone::authtoken::password: {get_param: BarbicanPassword}
106             barbican::keystone::authtoken::auth_uri: {get_param: [EndpointMap, KeystoneInternal, uri_no_suffix]}
107             barbican::keystone::authtoken::auth_url: { get_param: [EndpointMap, KeystoneInternal, uri_no_suffix]}
108             barbican::keystone::authtoken::project_name: 'service'
109             barbican::policy::policies: {get_param: BarbicanPolicies}
110             barbican::api::host_href: {get_param: [EndpointMap, BarbicanPublic, uri]}
111             barbican::api::db_auto_create: false
112             barbican::api::enabled_certificate_plugins: ['simple_certificate']
113             barbican::api::logging::debug:
114               if:
115               - service_debug_unset
116               - {get_param: Debug }
117               - {get_param: BarbicanDebug }
118             barbican::api::notification_driver: {get_param: NotificationDriver}
119             barbican::api::rabbit_use_ssl: {get_param: RabbitClientUseSSL}
120             barbican::api::rabbit_userid: {get_param: RabbitUserName}
121             barbican::api::rabbit_password: {get_param: RabbitPassword}
122             barbican::api::rabbit_port: {get_param: RabbitClientPort}
123             barbican::api::rabbit_heartbeat_timeout_threshold: 60
124             barbican::api::service_name: 'httpd'
125             barbican::wsgi::apache::bind_host: {get_param: [ServiceNetMap, BarbicanApiNetwork]}
126             barbican::wsgi::apache::ssl:  {get_param: EnableInternalTLS}
127             barbican::wsgi::apache::workers: {get_param: BarbicanWorkers}
128             barbican::wsgi::apache::servername:
129               str_replace:
130                 template:
131                   "%{hiera('fqdn_$NETWORK')}"
132                 params:
133                   $NETWORK: {get_param: [ServiceNetMap, BarbicanApiNetwork]}
134             barbican::db::database_connection:
135               make_url:
136                 scheme: {get_param: [EndpointMap, MysqlInternal, protocol]}
137                 username: barbican
138                 password: {get_param: BarbicanPassword}
139                 host: {get_param: [EndpointMap, MysqlInternal, host]}
140                 path: /barbican
141                 query:
142                   read_default_file: /etc/my.cnf.d/tripleo.cnf
143                   read_default_group: tripleo
144             tripleo.barbican_api.firewall_rules:
145               '117 barbican':
146                 dport:
147                   - 9311
148                   - 13311
149       step_config: |
150         include ::tripleo::profile::base::barbican::api
151       service_config_settings:
152         mysql:
153           barbican::db::mysql::password: {get_param: BarbicanPassword}
154           barbican::db::mysql::user: barbican
155           barbican::db::mysql::host: {get_param: [EndpointMap, MysqlInternal, host_nobrackets]}
156           barbican::db::mysql::dbname: barbican
157           barbican::db::mysql::allowed_hosts:
158             - '%'
159             - "%{hiera('mysql_bind_host')}"
160         keystone:
161           barbican::keystone::auth::public_url: {get_param: [EndpointMap, BarbicanPublic, uri]}
162           barbican::keystone::auth::internal_url: {get_param: [EndpointMap, BarbicanInternal, uri]}
163           barbican::keystone::auth::admin_url: {get_param: [EndpointMap, BarbicanAdmin, uri]}
164           barbican::keystone::auth::password: {get_param: BarbicanPassword}
165           barbican::keystone::auth::region: {get_param: KeystoneRegion}
166           barbican::keystone::auth::tenant: 'service'
167         nova_compute:
168           nova::compute::keymgr_api_class: >
169             castellan.key_manager.barbican_key_manager.BarbicanKeyManager
170           nova::compute::barbican_endpoint:
171             get_param: [EndpointMap, BarbicanInternal, uri]
172           nova::compute::barbican_auth_endpoint:
173             get_param: [EndpointMap, KeystoneInternal, uri_no_suffix]
174         cinder_api:
175           cinder::api::keymgr_api_class: >
176             castellan.key_manager.barbican_key_manager.BarbicanKeyManager
177           cinder::api::keymgr_encryption_api_url:
178             get_param: [EndpointMap, BarbicanInternal, uri]
179           cinder::api::keymgr_encryption_auth_url:
180             get_param: [EndpointMap, KeystoneInternal, uri_no_suffix]
181       metadata_settings:
182         get_attr: [ApacheServiceBase, role_data, metadata_settings]
183       upgrade_tasks:
184         yaql:
185           expression: $.data.apache_upgrade + $.data.barbican_api_upgrade
186           data:
187             apache_upgrade:
188               get_attr: [ApacheServiceBase, role_data, upgrade_tasks]
189             barbican_api_upgrade:
190               - name: Check if barbican_api is deployed
191                 command: systemctl is-enabled openstack-barbican-api
192                 tags: common
193                 ignore_errors: True
194                 register: barbican_api_enabled
195               - name: "PreUpgrade step0,validation: Check service openstack-barbican-api is running"
196                 shell: /usr/bin/systemctl show 'openstack-barbican-api' --property ActiveState | grep '\bactive\b'
197                 when: barbican_api_enabled.rc == 0
198                 tags: step0,validation
199               - name: Install openstack-barbican-api package if it was disabled
200                 tags: step3
201                 yum: name=openstack-barbican-api state=latest
202                 when: barbican_api_enabled.rc != 0