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