Merge "Use tripleo profile for bigswitch agent"
[apex-tripleo-heat-templates.git] / puppet / services / ec2-api.yaml
1 heat_template_version: ocata
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   EndpointMap:
17     default: {}
18     description: Mapping of service endpoint -> protocol. Typically set
19                  via parameter_defaults in the resource registry.
20     type: json
21   Ec2ApiWorkers:
22     default: 0
23     description: Number of workers for EC2-API service.
24     type: number
25   Ec2ApiPassword:
26     description: The password for the nova service and db account, used by nova-api.
27     type: string
28     hidden: true
29   KeystoneRegion:
30     type: string
31     default: 'regionOne'
32     description: Keystone region for endpoint
33   MonitoringSubscriptionEc2Api:
34     default: 'overcloud-ec2-api'
35     type: string
36   Ec2ApiLoggingSource:
37     type: json
38     default:
39       tag: openstack.ec2.api
40       path: /var/log/ec2api/ec2api.log
41   EnablePackageInstall:
42     default: 'false'
43     description: Set to true to enable package installation via Puppet
44     type: boolean
45   Ec2ApiPolicies:
46     description: |
47       A hash of policies to configure for EC2-API.
48       e.g. { ec2api-context_is_admin: { key: context_is_admin, value: 'role:admin' } }
49     default: {}
50     type: json
51
52
53 conditions:
54   nova_workers_zero: {equals : [{get_param: Ec2ApiWorkers}, 0]}
55
56 outputs:
57   role_data:
58     description: Role data for the EC2-API service.
59     value:
60       service_name: ec2_api
61       monitoring_subscription: {get_param: MonitoringSubscriptionEc2Api}
62       logging_source: {get_param: Ec2ApiLoggingSource}
63       logging_groups:
64         - nova
65       config_settings:
66         map_merge:
67         - tripleo.ec2_api.firewall_rules:
68             '113 ec2_api':
69               dport:
70                 - 8788
71                 - 13788
72           ec2api::keystone::authtoken::project_name: 'service'
73           ec2api::keystone::authtoken::password: {get_param: Ec2ApiPassword}
74           ec2api::keystone::authtoken::auth_uri: {get_param: [EndpointMap, KeystoneInternal, uri] }
75           ec2api::keystone::authtoken::auth_url: {get_param: [EndpointMap, KeystoneInternal, uri_no_suffix]}
76           ec2api::policy::policies: {get_param: Ec2ApiPolicies}
77           ec2api::api::enabled: true
78           ec2api::package_manage: {get_param: EnablePackageInstall}
79           ec2api::api::ec2api_listen:
80             str_replace:
81               template:
82                 "%{hiera('fqdn_$NETWORK')}"
83               params:
84                 $NETWORK: {get_param: [ServiceNetMap, Ec2ApiNetwork]}
85           ec2api::metadata::metadata_listen:
86             str_replace:
87               template:
88                 "%{hiera('fqdn_$NETWORK')}"
89               params:
90                 $NETWORK: {get_param: [ServiceNetMap, Ec2ApiMetadataNetwork]}
91           ec2api::db::database_connection:
92             list_join:
93               - ''
94               - - {get_param: [EndpointMap, MysqlInternal, protocol]}
95                 - '://ec2_api:'
96                 - {get_param: Ec2ApiPassword}
97                 - '@'
98                 - {get_param: [EndpointMap, MysqlInternal, host]}
99                 - '/ec2_api'
100                 - '?read_default_file=/etc/my.cnf.d/tripleo.cnf&read_default_group=tripleo'
101           ec2api::api::keystone_ec2_tokens_url:
102             list_join:
103               - ''
104               - - {get_param: [EndpointMap, KeystoneV3Internal, uri]}
105                 - '/ec2tokens'
106         -
107           if:
108           - nova_workers_zero
109           - {}
110           - ec2api::api::ec2api_workers: {get_param: Ec2ApiWorkers}
111             ec2api::metadata::metadata_workers: {get_param: Ec2ApiWorkers}
112       step_config: |
113         include tripleo::profile::base::nova::ec2api
114       service_config_settings:
115         keystone:
116           ec2api::keystone::auth::tenant: 'service'
117           ec2api::keystone::auth::public_url: {get_param: [EndpointMap, Ec2ApiPublic, uri]}
118           ec2api::keystone::auth::internal_url: {get_param: [EndpointMap, Ec2ApiInternal, uri]}
119           ec2api::keystone::auth::admin_url: {get_param: [EndpointMap, Ec2ApiAdmin, uri]}
120           ec2api::keystone::auth::password: {get_param: Ec2ApiPassword}
121           ec2api::keystone::auth::region: {get_param: KeystoneRegion}
122         mysql:
123           ec2api::db::mysql::password: {get_param: Ec2ApiPassword}
124           ec2api::db::mysql::user: ec2_api
125           ec2api::db::mysql::host: {get_param: [EndpointMap, MysqlInternal, host_nobrackets]}
126           ec2api::db::mysql::dbname: ec2_api
127           ec2api::db::mysql::allowed_hosts:
128             - '%'
129             - "%{hiera('mysql_bind_host')}"
130       upgrade_tasks:
131         - name: Check if ec2-api is deployed
132           command: systemctl is-enabled openstack-ec2-api
133           tags: common
134           ignore_errors: True
135           register: ec2_api_enabled
136         - name: "PreUpgrade step0,validation: Check if openstack-ec2-api is running"
137           shell: >
138             /usr/bin/systemctl show 'openstack-ec2-api' --property ActiveState |
139             grep '\bactive\b'
140           when: ec2_api_enabled.rc == 0
141           tags: step0,validation
142         - name: Stop openstack-ec2-api service
143           tags: step1
144           when: ec2_api_enabled.rc == 0
145           service: name=openstack-ec2-api state=stopped
146         - name: Install openstack-ec2-api package if it was disabled
147           tags: step3
148           yum: name=openstack-ec2-api state=latest
149           when: ec2_api_enabled.rc != 0
150