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