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