|
79 | 79 | if ($title == 'haproxy') and ($haproxy_package == 'haproxy') {
|
80 | 80 | } else {
|
81 | 81 | $initfile = "/etc/init.d/haproxy-${title}"
|
82 |
| - if $facts['os']['family'] == 'RedHat' and $facts['os']['release']['major'] == '6' { |
83 |
| - # init.d: |
84 |
| - file { $initfile: |
85 |
| - ensure => file, |
86 |
| - mode => '0744', |
87 |
| - owner => 'root', |
88 |
| - group => 'root', |
89 |
| - source => $haproxy_init_source, |
90 |
| - } |
91 |
| - File[$haproxy_link] -> File[$initfile] |
| 82 | +# systemd: |
| 83 | + if $haproxy_package == 'haproxy' { |
| 84 | + $wrapper = '/usr/sbin/haproxy-systemd-wrapper' |
92 | 85 | } else {
|
93 |
| - # systemd: |
94 |
| - if $haproxy_package == 'haproxy' { |
95 |
| - $wrapper = '/usr/sbin/haproxy-systemd-wrapper' |
96 |
| - } else { |
97 |
| - $wrapper = "/opt/${haproxy_package}/sbin/haproxy-systemd-wrapper" |
98 |
| - } |
| 86 | + $wrapper = "/opt/${haproxy_package}/sbin/haproxy-systemd-wrapper" |
| 87 | + } |
99 | 88 |
|
100 |
| - if $facts['os']['family'] == 'RedHat' { |
101 |
| - $unitfile = "/usr/lib/systemd/system/haproxy-${title}.service" |
102 |
| - } else { |
103 |
| - $unitfile = "/lib/systemd/system/haproxy-${title}.service" |
104 |
| - } |
| 89 | + if $facts['os']['family'] == 'RedHat' { |
| 90 | + $unitfile = "/usr/lib/systemd/system/haproxy-${title}.service" |
| 91 | + } else { |
| 92 | + $unitfile = "/lib/systemd/system/haproxy-${title}.service" |
| 93 | + } |
105 | 94 |
|
106 |
| - $parameters = { |
107 |
| - 'title' => $title, |
108 |
| - 'wrapper' => $wrapper, |
109 |
| - } |
110 |
| - file { $unitfile: |
111 |
| - ensure => file, |
112 |
| - mode => '0644', |
113 |
| - owner => 'root', |
114 |
| - group => 'root', |
115 |
| - content => epp($haproxy_unit_template, $parameters), |
116 |
| - notify => Exec['systemctl daemon-reload'], |
117 |
| - } |
118 |
| - if (!defined(Exec['systemctl daemon-reload'])) { |
119 |
| - exec { 'systemctl daemon-reload': |
120 |
| - command => 'systemctl daemon-reload', |
121 |
| - path => '/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin', |
122 |
| - refreshonly => true, |
123 |
| - before => Service["haproxy-${title}"], |
124 |
| - } |
125 |
| - } |
126 |
| - File[$haproxy_link] -> File[$unitfile] |
127 |
| - # Clean up in case the old init.d-style file is still around. |
128 |
| - file { $initfile: |
129 |
| - ensure => absent, |
130 |
| - before => Service["haproxy-${title}"], |
| 95 | + $parameters = { |
| 96 | + 'title' => $title, |
| 97 | + 'wrapper' => $wrapper, |
| 98 | + } |
| 99 | + file { $unitfile: |
| 100 | + ensure => file, |
| 101 | + mode => '0644', |
| 102 | + owner => 'root', |
| 103 | + group => 'root', |
| 104 | + content => epp($haproxy_unit_template, $parameters), |
| 105 | + notify => Exec['systemctl daemon-reload'], |
| 106 | + } |
| 107 | + if (!defined(Exec['systemctl daemon-reload'])) { |
| 108 | + exec { 'systemctl daemon-reload': |
| 109 | + command => 'systemctl daemon-reload', |
| 110 | + path => '/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin', |
| 111 | + refreshonly => true, |
| 112 | + before => Service["haproxy-${title}"], |
131 | 113 | }
|
132 | 114 | }
|
| 115 | + File[$haproxy_link] -> File[$unitfile] |
| 116 | + # Clean up in case the old init.d-style file is still around. |
| 117 | + file { $initfile: |
| 118 | + ensure => absent, |
| 119 | + before => Service["haproxy-${title}"], |
| 120 | + } |
133 | 121 | }
|
134 | 122 |
|
135 | 123 | Package[$haproxy_package] -> File[$bindir] -> File[$haproxy_link]
|
|
0 commit comments