Merge "Use --disable= in subscription-manager to avoid shell expansion."
[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
46
47 conditions:
48   nova_workers_zero: {equals : [{get_param: Ec2ApiWorkers}, 0]}
49
50 outputs:
51   role_data:
52     description: Role data for the EC2-API service.
53     value:
54       service_name: ec2_api
55       monitoring_subscription: {get_param: MonitoringSubscriptionEc2Api}
56       logging_source: {get_param: Ec2ApiLoggingSource}
57       logging_groups:
58         - nova
59       config_settings:
60         map_merge:
61         - tripleo.ec2_api.firewall_rules:
62             '113 ec2_api':
63               dport:
64                 - 8788
65                 - 13788
66           ec2api::keystone::authtoken::project_name: 'service'
67           ec2api::keystone::authtoken::password: {get_param: Ec2ApiPassword}
68           ec2api::keystone::authtoken::auth_uri: {get_param: [EndpointMap, KeystoneInternal, uri] }
69           ec2api::keystone::authtoken::auth_url: {get_param: [EndpointMap, KeystoneInternal, uri_no_suffix]}
70           ec2api::api::enabled: true
71           ec2api::package_manage: {get_param: EnablePackageInstall}
72           ec2api::api::ec2api_listen:
73             str_replace:
74               template:
75                 '"%{::fqdn_$NETWORK}"'
76               params:
77                 $NETWORK: {get_param: [ServiceNetMap, Ec2ApiNetwork]}
78           ec2api::metadata::metadata_listen:
79             str_replace:
80               template:
81                 '"%{::fqdn_$NETWORK}"'
82               params:
83                 $NETWORK: {get_param: [ServiceNetMap, Ec2ApiMetadataNetwork]}
84           ec2api::db::database_connection:
85             list_join:
86               - ''
87               - - {get_param: [EndpointMap, MysqlInternal, protocol]}
88                 - '://ec2_api:'
89                 - {get_param: Ec2ApiPassword}
90                 - '@'
91                 - {get_param: [EndpointMap, MysqlInternal, host]}
92                 - '/ec2_api'
93                 - '?read_default_file=/etc/my.cnf.d/tripleo.cnf&read_default_group=tripleo'
94         -
95           if:
96           - nova_workers_zero
97           - {}
98           - ec2api::api::ec2api_workers: {get_param: Ec2ApiWorkers}
99             ec2api::metadata::metadata_workers: {get_param: Ec2ApiWorkers}
100       step_config: |
101         include tripleo::profile::base::nova::ec2api
102       service_config_settings:
103         keystone:
104           ec2api::keystone::auth::tenant: 'service'
105           ec2api::keystone::auth::public_url: {get_param: [EndpointMap, Ec2ApiPublic, uri]}
106           ec2api::keystone::auth::internal_url: {get_param: [EndpointMap, Ec2ApiInternal, uri]}
107           ec2api::keystone::auth::admin_url: {get_param: [EndpointMap, Ec2ApiAdmin, uri]}
108           ec2api::keystone::auth::password: {get_param: Ec2ApiPassword}
109           ec2api::keystone::auth::region: {get_param: KeystoneRegion}
110         mysql:
111           ec2api::db::mysql::password: {get_param: Ec2ApiPassword}
112           ec2api::db::mysql::user: ec2_api
113           ec2api::db::mysql::host: {get_param: [EndpointMap, MysqlInternal, host_nobrackets]}
114           ec2api::db::mysql::dbname: ec2_api
115           ec2api::db::mysql::allowed_hosts:
116             - '%'
117             - "%{hiera('mysql_bind_host')}"
118       upgrade_tasks:
119         - name: Check if ec2-api is deployed
120           command: systemctl is-enabled openstack-ec2-api
121           tags: step0,validation
122           ignore_errors: True
123           register: ec2_api_enabled
124         - name: "PreUpgrade step0,validation: Check if openstack-ec2-api is running"
125           shell: >
126             /usr/bin/systemctl show 'openstack-ec2-api' --property ActiveState |
127             grep '\bactive\b'
128           when: ec2_api_enabled.rc == 0
129           tags: step0,validation
130         - name: Stop openstack-ec2-api service
131           tags: step1
132           service: name=openstack-ec2-api state=stopped
133