Merge "Change database sync timeout from 300 to 900 in low-memory-usage environment...
[apex-tripleo-heat-templates.git] / puppet / services / ec2-api.yaml
1 heat_template_version: pike
2
3 description: >
4   OpenStack EC2-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   Ec2ApiWorkers:
30     default: 0
31     description: Number of workers for EC2-API service.
32     type: number
33   Ec2ApiPassword:
34     description: The password for the nova service and db account, used by nova-api.
35     type: string
36     hidden: true
37   KeystoneRegion:
38     type: string
39     default: 'regionOne'
40     description: Keystone region for endpoint
41   Ec2ApiExternalNetwork:
42     type: string
43     default: ''
44     description: Name of the external network, which is used to connect VPCs to
45                  Internet and to allocate Elastic IPs
46   NovaDefaultFloatingPool:
47     default: 'public'
48     description: Default pool for floating IP addresses
49     type: string
50   MonitoringSubscriptionEc2Api:
51     default: 'overcloud-ec2-api'
52     type: string
53   Ec2ApiLoggingSource:
54     type: json
55     default:
56       tag: openstack.ec2.api
57       path: /var/log/ec2api/ec2api.log
58   EnablePackageInstall:
59     default: 'false'
60     description: Set to true to enable package installation via Puppet
61     type: boolean
62   Ec2ApiPolicies:
63     description: |
64       A hash of policies to configure for EC2-API.
65       e.g. { ec2api-context_is_admin: { key: context_is_admin, value: 'role:admin' } }
66     default: {}
67     type: json
68
69
70 conditions:
71   nova_workers_zero: {equals : [{get_param: Ec2ApiWorkers}, 0]}
72   external_network_unset: {equals : [{get_param: Ec2ApiExternalNetwork}, '']}
73
74 outputs:
75   role_data:
76     description: Role data for the EC2-API service.
77     value:
78       service_name: ec2_api
79       monitoring_subscription: {get_param: MonitoringSubscriptionEc2Api}
80       logging_source: {get_param: Ec2ApiLoggingSource}
81       logging_groups:
82         - nova
83       config_settings:
84         map_merge:
85         - tripleo.ec2_api.firewall_rules:
86             '113 ec2_api':
87               dport:
88                 - 8788
89                 - 13788
90           ec2api::keystone::authtoken::project_name: 'service'
91           ec2api::keystone::authtoken::password: {get_param: Ec2ApiPassword}
92           ec2api::keystone::authtoken::auth_uri: {get_param: [EndpointMap, KeystoneInternal, uri] }
93           ec2api::keystone::authtoken::auth_url: {get_param: [EndpointMap, KeystoneInternal, uri_no_suffix]}
94           ec2api::policy::policies: {get_param: Ec2ApiPolicies}
95           ec2api::api::enabled: true
96           ec2api::package_manage: {get_param: EnablePackageInstall}
97           ec2api::api::ec2api_listen:
98             str_replace:
99               template:
100                 "%{hiera('fqdn_$NETWORK')}"
101               params:
102                 $NETWORK: {get_param: [ServiceNetMap, Ec2ApiNetwork]}
103           ec2api::metadata::metadata_listen:
104             str_replace:
105               template:
106                 "%{hiera('fqdn_$NETWORK')}"
107               params:
108                 $NETWORK: {get_param: [ServiceNetMap, Ec2ApiMetadataNetwork]}
109           ec2api::db::database_connection:
110             make_url:
111               scheme: {get_param: [EndpointMap, MysqlInternal, protocol]}
112               username: ec2_api
113               password: {get_param: Ec2ApiPassword}
114               host: {get_param: [EndpointMap, MysqlInternal, host]}
115               path: /ec2_api
116               query:
117                 read_default_file: /etc/my.cnf.d/tripleo.cnf
118                 read_default_group: tripleo
119           ec2api::api::keystone_ec2_tokens_url:
120             list_join:
121               - ''
122               - - {get_param: [EndpointMap, KeystoneV3Internal, uri]}
123                 - '/ec2tokens'
124         -
125           if:
126           - nova_workers_zero
127           - {}
128           - ec2api::api::ec2api_workers: {get_param: Ec2ApiWorkers}
129             ec2api::metadata::metadata_workers: {get_param: Ec2ApiWorkers}
130         -
131           if:
132           - external_network_unset
133           - ec2api::api::external_network: {get_param: NovaDefaultFloatingPool}
134           - ec2api::api::external_network: {get_param: Ec2ApiExternalNetwork}
135       step_config: |
136         include tripleo::profile::base::nova::ec2api
137       service_config_settings:
138         keystone:
139           ec2api::keystone::auth::tenant: 'service'
140           ec2api::keystone::auth::public_url: {get_param: [EndpointMap, Ec2ApiPublic, uri]}
141           ec2api::keystone::auth::internal_url: {get_param: [EndpointMap, Ec2ApiInternal, uri]}
142           ec2api::keystone::auth::admin_url: {get_param: [EndpointMap, Ec2ApiAdmin, uri]}
143           ec2api::keystone::auth::password: {get_param: Ec2ApiPassword}
144           ec2api::keystone::auth::region: {get_param: KeystoneRegion}
145         mysql:
146           ec2api::db::mysql::password: {get_param: Ec2ApiPassword}
147           ec2api::db::mysql::user: ec2_api
148           ec2api::db::mysql::host: {get_param: [EndpointMap, MysqlInternal, host_nobrackets]}
149           ec2api::db::mysql::dbname: ec2_api
150           ec2api::db::mysql::allowed_hosts:
151             - '%'
152             - "%{hiera('mysql_bind_host')}"
153       upgrade_tasks:
154         - name: Check if ec2-api is deployed
155           command: systemctl is-enabled openstack-ec2-api
156           tags: common
157           ignore_errors: True
158           register: ec2_api_enabled
159         - name: "PreUpgrade step0,validation: Check if openstack-ec2-api is running"
160           shell: >
161             /usr/bin/systemctl show 'openstack-ec2-api' --property ActiveState |
162             grep '\bactive\b'
163           when: ec2_api_enabled.rc == 0
164           tags: step0,validation
165         - name: Stop openstack-ec2-api service
166           tags: step1
167           when: ec2_api_enabled.rc == 0
168           service: name=openstack-ec2-api state=stopped
169         - name: Install openstack-ec2-api package if it was disabled
170           tags: step3
171           yum: name=openstack-ec2-api state=latest
172           when: ec2_api_enabled.rc != 0
173