Add heat parameter for all of config_volume images
[apex-tripleo-heat-templates.git] / docker / services / pacemaker / haproxy.yaml
1 heat_template_version: pike
2
3 description: >
4   OpenStack containerized HAproxy service for pacemaker
5
6 parameters:
7   DockerNamespace:
8     description: namespace
9     default: 'tripleoupstream'
10     type: string
11   DockerHAProxyImage:
12     description: image
13     default: 'centos-binary-haproxy:latest'
14     type: string
15   DockerHAProxyConfigImage:
16     description: The container image to use for the haproxy config_volume
17     default: 'centos-binary-haproxy:latest'
18     type: string
19   ServiceNetMap:
20     default: {}
21     description: Mapping of service_name -> network name. Typically set
22                  via parameter_defaults in the resource registry.  This
23                  mapping overrides those in ServiceNetMapDefaults.
24     type: json
25   DefaultPasswords:
26     default: {}
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   RoleName:
34     default: ''
35     description: Role name on which the service is applied
36     type: string
37   RoleParameters:
38     default: {}
39     description: Parameters specific to the role
40     type: json
41
42 resources:
43
44   HAProxyBase:
45     type: ../../../puppet/services/pacemaker/haproxy.yaml
46     properties:
47       EndpointMap: {get_param: EndpointMap}
48       ServiceNetMap: {get_param: ServiceNetMap}
49       DefaultPasswords: {get_param: DefaultPasswords}
50       RoleName: {get_param: RoleName}
51       RoleParameters: {get_param: RoleParameters}
52
53 outputs:
54   role_data:
55     description: Role data for the HAproxy role.
56     value:
57       service_name: {get_attr: [HAProxyBase, role_data, service_name]}
58       config_settings:
59         map_merge:
60           - get_attr: [HAProxyBase, role_data, config_settings]
61           - tripleo::haproxy::haproxy_daemon: false
62             haproxy_docker: true
63             tripleo::profile::pacemaker::haproxy_bundle::haproxy_docker_image: &haproxy_image
64               list_join:
65                 - '/'
66                 - [ {get_param: DockerNamespace}, {get_param: DockerHAProxyImage} ]
67       step_config: ""
68       service_config_settings: {get_attr: [HAProxyBase, role_data, service_config_settings]}
69       # BEGIN DOCKER SETTINGS
70       puppet_config:
71         config_volume: haproxy
72         puppet_tags: haproxy_config
73         step_config:
74           list_join:
75             - "\n"
76             - - "exec {'wait-for-settle': command => '/bin/true' }"
77               - "class tripleo::firewall(){}; define tripleo::firewall::rule( $port = undef, $dport = undef, $sport = undef, $proto = undef, $action = undef, $state = undef, $source = undef, $iniface = undef, $chain = undef, $destination = undef, $extras = undef){}"
78               - "['pcmk_bundle', 'pcmk_resource', 'pcmk_property', 'pcmk_constraint', 'pcmk_resource_default'].each |String $val| { noop_resource($val) }"
79               - 'include ::tripleo::profile::pacemaker::haproxy_bundle'
80         config_image:
81           list_join:
82             - '/'
83             - [ {get_param: DockerNamespace}, {get_param: DockerHAProxyConfigImage} ]
84       kolla_config:
85         /var/lib/kolla/config_files/haproxy.json:
86           command: haproxy -f /etc/haproxy/haproxy.cfg
87       docker_config:
88         step_2:
89           haproxy_init_bundle:
90             start_order: 3
91             detach: false
92             net: host
93             user: root
94             privileged: true
95             command:
96               - '/bin/bash'
97               - '-c'
98               - str_replace:
99                   template:
100                     list_join:
101                       - '; '
102                       - - "cp -a /tmp/puppet-etc/* /etc/puppet; echo '{\"step\": 2}' > /etc/puppet/hieradata/docker.json"
103                         - "FACTER_uuid=docker puppet apply --tags file,file_line,concat,augeas,TAGS -v -e 'CONFIG'"
104                   params:
105                     TAGS: 'tripleo::firewall::rule,pacemaker::resource::bundle,pacemaker::property,pacemaker::resource::ip,pacemaker::resource::ocf,pacemaker::constraint::order,pacemaker::constraint::colocation'
106                     CONFIG:
107                       list_join:
108                         - ';'
109                         - - 'include ::tripleo::profile::base::pacemaker'
110                           - 'include ::tripleo::profile::pacemaker::haproxy_bundle'
111             image: *haproxy_image
112             volumes:
113               # puppet saves iptables rules in /etc/sysconfig
114               - /etc/sysconfig:/etc/sysconfig:rw
115               # saving rules require accessing /usr/libexec/iptables/iptables.init, just bind-mount
116               # the necessary bit and prevent systemd to try to reload the service in the container
117               - /usr/libexec/iptables:/usr/libexec/iptables:ro
118               - /usr/libexec/initscripts/legacy-actions:/usr/libexec/initscripts/legacy-actions:ro
119               - /etc/hosts:/etc/hosts:ro
120               - /etc/localtime:/etc/localtime:ro
121               - /etc/puppet:/tmp/puppet-etc:ro
122               - /usr/share/openstack-puppet/modules:/usr/share/openstack-puppet/modules:ro
123               - /etc/corosync/corosync.conf:/etc/corosync/corosync.conf:ro
124               - /dev/shm:/dev/shm:rw
125       metadata_settings:
126         get_attr: [HAProxyBase, role_data, metadata_settings]