Merge "Optimize kernel neighbour table for large scale environments"
[apex-tripleo-heat-templates.git] / puppet / services / apache.yaml
1 heat_template_version: ocata
2
3 description: >
4   Apache service configured with Puppet. Note this is typically included
5   automatically via other services which run via Apache.
6
7 parameters:
8   ApacheMaxRequestWorkers:
9     default: 256
10     description: Maximum number of simultaneously processed requests.
11     type: number
12   ApacheServerLimit:
13     default: 256
14     description: Maximum number of Apache processes.
15     type: number
16   ServiceNetMap:
17     default: {}
18     description: Mapping of service_name -> network name. Typically set
19                  via parameter_defaults in the resource registry.  This
20                  mapping overrides those in ServiceNetMapDefaults.
21     type: json
22   DefaultPasswords:
23     default: {}
24     type: json
25   RoleName:
26     default: ''
27     description: Role name on which the service is applied
28     type: string
29   RoleParameters:
30     default: {}
31     description: Parameters specific to the role
32     type: json
33   EndpointMap:
34     default: {}
35     description: Mapping of service endpoint -> protocol. Typically set
36                  via parameter_defaults in the resource registry.
37     type: json
38   EnableInternalTLS:
39     type: boolean
40     default: false
41
42 conditions:
43
44   internal_tls_enabled: {equals: [{get_param: EnableInternalTLS}, true]}
45
46 resources:
47
48   ApacheNetworks:
49     type: OS::Heat::Value
50     properties:
51       value:
52         # NOTE(jaosorior) Get unique network names to create
53         # certificates for those. We skip the tenant network since
54         # we don't need a certificate for that, and the external
55         # is for HAProxy so it isn't used for apache either.
56         yaql:
57           expression: list($.data.map.items().map($1[1])).distinct().where($ != external and $ != tenant)
58           data:
59             map:
60               get_param: ServiceNetMap
61
62 outputs:
63   role_data:
64     description: Role data for the Apache role.
65     value:
66       service_name: apache
67       config_settings:
68         map_merge:
69           -
70             # for the given network; replacement examples (eg. for internal_api):
71             # internal_api -> IP
72             # internal_api_uri -> [IP]
73             # internal_api_subnet - > IP/CIDR
74             apache::ip: {get_param: [ServiceNetMap, ApacheNetwork]}
75             apache::default_vhost: false
76             apache::server_signature: 'Off'
77             apache::server_tokens: 'Prod'
78             apache_remote_proxy_ips_network:
79               str_replace:
80                 template: "NETWORK_subnet"
81                 params:
82                   NETWORK: {get_param: [ServiceNetMap, ApacheNetwork]}
83             apache::mod::prefork::maxclients: { get_param: ApacheMaxRequestWorkers }
84             apache::mod::prefork::serverlimit: { get_param: ApacheServerLimit }
85             apache::mod::remoteip::proxy_ips:
86               - "%{hiera('apache_remote_proxy_ips_network')}"
87           -
88             generate_service_certificates: true
89             tripleo::certmonger::apache_dirs::certificate_dir: '/etc/pki/tls/certs/httpd'
90             tripleo::certmonger::apache_dirs::key_dir: '/etc/pki/tls/private/httpd'
91             apache_certificates_specs:
92               map_merge:
93                 repeat:
94                   template:
95                     httpd-NETWORK:
96                       service_certificate: '/etc/pki/tls/certs/httpd/httpd-NETWORK.crt'
97                       service_key: '/etc/pki/tls/private/httpd/httpd-NETWORK.key'
98                       hostname: "%{hiera('fqdn_NETWORK')}"
99                       principal: "HTTP/%{hiera('fqdn_NETWORK')}"
100                   for_each:
101                     NETWORK: {get_attr: [ApacheNetworks, value]}
102       metadata_settings:
103         if:
104           - internal_tls_enabled
105           -
106             repeat:
107               template:
108                 - service: HTTP
109                   network: $NETWORK
110                   type: node
111               for_each:
112                 $NETWORK: {get_attr: [ApacheNetworks, value]}
113           - null
114       upgrade_tasks:
115         - name: Check if httpd is deployed
116           command: systemctl is-enabled httpd
117           tags: common
118           ignore_errors: True
119           register: httpd_enabled
120         - name: "PreUpgrade step0,validation: Check service httpd is running"
121           shell: /usr/bin/systemctl show 'httpd' --property ActiveState | grep '\bactive\b'
122           when: httpd_enabled.rc == 0
123           tags: step0,validation
124         - name: Ensure mod_ssl package is installed
125           tags: step3
126           yum: name=mod_ssl state=latest