Add role specific information to the service template
[apex-tripleo-heat-templates.git] / puppet / services / horizon.yaml
1 heat_template_version: ocata
2
3 description: >
4   Horizon 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   Debug:
14     default: ''
15     description: Set to True to enable debugging on all services.
16     type: string
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   HorizonAllowedHosts:
34     default: '*'
35     description: A list of IP/Hostname for the server Horizon is running on.
36                  Used for header checks.
37     type: comma_delimited_list
38   HorizonPasswordValidator:
39     description: Regex for password validation
40     type: string
41     default: ''
42   HorizonPasswordValidatorHelp:
43     description: Help text for password validation
44     type: string
45     default: ''
46   HorizonSecret:
47     description: Secret key for Django
48     type: string
49     hidden: true
50     default: ''
51   HorizonSecureCookies:
52     description: Set CSRF_COOKIE_SECURE / SESSION_COOKIE_SECURE in Horizon
53     type: boolean
54     default: true
55   MemcachedIPv6:
56     default: false
57     description: Enable IPv6 features in Memcached.
58     type: boolean
59   MonitoringSubscriptionHorizon:
60     default: 'overcloud-horizon'
61     type: string
62
63 conditions:
64
65   debug_empty: {equals : [{get_param: Debug}, '']}
66
67 outputs:
68   role_data:
69     description: Role data for the Horizon role.
70     value:
71       service_name: horizon
72       monitoring_subscription: {get_param: MonitoringSubscriptionHorizon}
73       config_settings:
74         map_merge:
75         - horizon::allowed_hosts: {get_param: HorizonAllowedHosts}
76           tripleo.horizon.firewall_rules:
77             '126 horizon':
78               dport:
79                 - 80
80                 - 443
81           horizon::enable_secure_proxy_ssl_header: true
82           horizon::disable_password_reveal: true
83           horizon::enforce_password_check: true
84           horizon::disallow_iframe_embed: true
85           horizon::cache_backend: django.core.cache.backends.memcached.MemcachedCache
86           horizon::django_session_engine: 'django.contrib.sessions.backends.cache'
87           horizon::vhost_extra_params:
88             add_listen: false
89             priority: 10
90             access_log_format: '%a %l %u %t \"%r\" %>s %b \"%%{}{Referer}i\" \"%%{}{User-Agent}i\"'
91             options: ['FollowSymLinks','MultiViews']
92           horizon::bind_address: {get_param: [ServiceNetMap, HorizonNetwork]}
93           horizon::keystone_url: {get_param: [EndpointMap, KeystoneInternal, uri_no_suffix]}
94           horizon::password_validator: {get_param: [HorizonPasswordValidator]}
95           horizon::password_validator_help: {get_param: [HorizonPasswordValidatorHelp]}
96           horizon::secret_key:
97             yaql:
98               expression: $.data.passwords.where($ != '').first()
99               data:
100                 passwords:
101                   - {get_param: HorizonSecret}
102                   - {get_param: [DefaultPasswords, horizon_secret]}
103           horizon::secure_cookies: {get_param: [HorizonSecureCookies]}
104           memcached_ipv6: {get_param: MemcachedIPv6}
105         -
106           if:
107           - debug_empty
108           - {}
109           - horizon::django_debug: {get_param: Debug}
110       step_config: |
111         include ::tripleo::profile::base::horizon
112       # Ansible tasks to handle upgrade
113       upgrade_tasks:
114         - name: Check if httpd is deployed
115           command: systemctl is-enabled httpd
116           tags: common
117           ignore_errors: True
118           register: httpd_enabled
119         - name: "PreUpgrade step0,validation: Check if httpd is running"
120           shell: >
121             /usr/bin/systemctl show 'httpd' --property ActiveState |
122             grep '\bactive\b'
123           when: httpd_enabled.rc == 0
124           tags: step0,validation
125         - name: Stop Horizon (under httpd)
126           tags: step1
127           when: httpd_enabled.rc == 0
128           service: name=httpd state=stopped