1 heat_template_version: pike
4 OpenStack containerized HAproxy service for pacemaker
10 DockerHAProxyConfigImage:
11 description: The container image to use for the haproxy config_volume
15 description: Dictionary packing service data
19 description: Mapping of service_name -> network name. Typically set
20 via parameter_defaults in the resource registry. This
21 mapping overrides those in ServiceNetMapDefaults.
28 description: Mapping of service endpoint -> protocol. Typically set
29 via parameter_defaults in the resource registry.
31 DeployedSSLCertificatePath:
32 default: '/etc/pki/tls/private/overcloud_endpoint.pem'
34 The filepath of the certificate as it will be stored in the controller.
38 description: Role name on which the service is applied
42 description: Parameters specific to the role
48 type: ../../../puppet/services/pacemaker/haproxy.yaml
50 EndpointMap: {get_param: EndpointMap}
51 ServiceData: {get_param: ServiceData}
52 ServiceNetMap: {get_param: ServiceNetMap}
53 DefaultPasswords: {get_param: DefaultPasswords}
54 RoleName: {get_param: RoleName}
55 RoleParameters: {get_param: RoleParameters}
59 description: Role data for the HAproxy role.
61 service_name: {get_attr: [HAProxyBase, role_data, service_name]}
64 - get_attr: [HAProxyBase, role_data, config_settings]
65 - tripleo::haproxy::haproxy_daemon: false
67 tripleo::profile::pacemaker::haproxy_bundle::haproxy_docker_image: &haproxy_image {get_param: DockerHAProxyImage}
69 service_config_settings: {get_attr: [HAProxyBase, role_data, service_config_settings]}
70 # BEGIN DOCKER SETTINGS
72 config_volume: haproxy
73 puppet_tags: haproxy_config
77 - - "exec {'wait-for-settle': command => '/bin/true' }"
78 - "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){}"
79 - "['pcmk_bundle', 'pcmk_resource', 'pcmk_property', 'pcmk_constraint', 'pcmk_resource_default'].each |String $val| { noop_resource($val) }"
80 - 'include ::tripleo::profile::pacemaker::haproxy_bundle'
81 config_image: {get_param: DockerHAProxyConfigImage}
82 volumes: &deployed_cert_mount
85 - - {get_param: DeployedSSLCertificatePath}
86 - {get_param: DeployedSSLCertificatePath}
89 /var/lib/kolla/config_files/haproxy.json:
90 command: haproxy -f /etc/haproxy/haproxy.cfg
92 - source: "/var/lib/kolla/config_files/src/*"
95 preserve_properties: true
112 - - "cp -a /tmp/puppet-etc/* /etc/puppet; echo '{\"step\": 2}' > /etc/puppet/hieradata/docker.json"
113 - "FACTER_uuid=docker puppet apply --tags file,file_line,concat,augeas,TAGS -v -e 'CONFIG'"
115 TAGS: 'tripleo::firewall::rule,pacemaker::resource::bundle,pacemaker::property,pacemaker::resource::ip,pacemaker::resource::ocf,pacemaker::constraint::order,pacemaker::constraint::colocation'
119 - - 'include ::tripleo::profile::base::pacemaker'
120 - 'include ::tripleo::profile::pacemaker::haproxy_bundle'
121 image: *haproxy_image
124 - *deployed_cert_mount
126 # puppet saves iptables rules in /etc/sysconfig
127 - /etc/sysconfig:/etc/sysconfig:rw
128 # saving rules require accessing /usr/libexec/iptables/iptables.init, just bind-mount
129 # the necessary bit and prevent systemd to try to reload the service in the container
130 - /usr/libexec/iptables:/usr/libexec/iptables:ro
131 - /usr/libexec/initscripts/legacy-actions:/usr/libexec/initscripts/legacy-actions:ro
132 - /etc/hosts:/etc/hosts:ro
133 - /etc/localtime:/etc/localtime:ro
134 - /etc/puppet:/tmp/puppet-etc:ro
135 - /usr/share/openstack-puppet/modules:/usr/share/openstack-puppet/modules:ro
136 - /etc/corosync/corosync.conf:/etc/corosync/corosync.conf:ro
137 - /dev/shm:/dev/shm:rw
139 get_attr: [HAProxyBase, role_data, metadata_settings]
141 - name: get bootstrap nodeid
143 command: hiera -c /etc/puppet/hiera.yaml bootstrap_nodeid
144 register: bootstrap_node
145 - name: set is_bootstrap_node fact
147 set_fact: is_bootstrap_node={{bootstrap_node.stdout|lower == ansible_hostname|lower}}
148 - name: Disable the haproxy cluster resource.
151 resource: {get_attr: [HAProxyBase, role_data, service_name]}
153 wait_for_resource: true
154 when: is_bootstrap_node
155 - name: Delete the stopped haproxy cluster resource.
158 resource: {get_attr: [HAProxyBase, role_data, service_name]}
160 wait_for_resource: true
161 when: is_bootstrap_node