Add haproxy
This commit is contained in:
parent
4cd211da63
commit
bb1c9f29eb
14 changed files with 135 additions and 5 deletions
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
include:
|
include:
|
||||||
- directories
|
- directories
|
||||||
- system.base
|
|
||||||
|
|
||||||
apps_generate-motd_git:
|
apps_generate-motd_git:
|
||||||
git.latest:
|
git.latest:
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
include:
|
include:
|
||||||
- directories
|
- directories
|
||||||
- system.base
|
|
||||||
|
|
||||||
apps_noveriablcgen_git:
|
apps_noveriablcgen_git:
|
||||||
git.latest:
|
git.latest:
|
||||||
|
|
56
haproxy/files/haproxy_rcscript.initd.jinja
Normal file
56
haproxy/files/haproxy_rcscript.initd.jinja
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
#!/sbin/openrc-run
|
||||||
|
# Copyright 1999-2011 Gentoo Foundation
|
||||||
|
# Distributed under the terms of the GNU General Public License v2
|
||||||
|
# $Header: /var/cvsroot/gentoo-x86/net-proxy/haproxy/files/haproxy.initd-r1,v 1.2 2011/12/04 10:32:32 swegener Exp $
|
||||||
|
|
||||||
|
# This is file is managed by salt (state: {{ sls }})
|
||||||
|
|
||||||
|
extra_commands="checkconfig"
|
||||||
|
extra_started_commands="reload"
|
||||||
|
command=/usr/sbin/haproxy
|
||||||
|
|
||||||
|
CONF=${HAPROXY_CONF:-/etc/haproxy/${SVCNAME}.cfg}
|
||||||
|
CONF_DIR=${HAPROXY_CONF_DIR:-{{ conf_dir }}}
|
||||||
|
PIDFILE=/var/run/${SVCNAME}.pid
|
||||||
|
|
||||||
|
depend() {
|
||||||
|
need net
|
||||||
|
after firewall
|
||||||
|
use dns logger
|
||||||
|
}
|
||||||
|
|
||||||
|
checkconfig() {
|
||||||
|
if [ ! -f "${CONF}" ] && [ ! -d "${CONF}" ]; then
|
||||||
|
eerror "${CONF} does not exist!"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
ebegin "Checking ${CONF}"
|
||||||
|
$command -q -c -f "${CONF}"
|
||||||
|
eend $?
|
||||||
|
}
|
||||||
|
|
||||||
|
start() {
|
||||||
|
ebegin "Starting ${SVCNAME}"
|
||||||
|
start-stop-daemon --pidfile "${PIDFILE}" --exec $command \
|
||||||
|
--start -- -D -p "${PIDFILE}" -f "${CONF}" -f "${CONF_DIR}"
|
||||||
|
eend $?
|
||||||
|
}
|
||||||
|
|
||||||
|
stop() {
|
||||||
|
ebegin "Stopping ${SVCNAME}"
|
||||||
|
|
||||||
|
if [ "${RC_CMD}" = "restart" ]; then
|
||||||
|
checkconfig || return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
start-stop-daemon --stop --pidfile "${PIDFILE}"
|
||||||
|
eend $?
|
||||||
|
}
|
||||||
|
|
||||||
|
reload() {
|
||||||
|
ebegin "Reloading ${SVCNAME}"
|
||||||
|
checkconfig || { eerror "Reloading failed, please fix your ${CONF} first"; return 1; }
|
||||||
|
$command -D -p "${PIDFILE}" -f "${CONF}" -f "${CONF_DIR}" -sf $(cat "${PIDFILE}")
|
||||||
|
eend $?
|
||||||
|
}
|
3
haproxy/init.sls
Normal file
3
haproxy/init.sls
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
include:
|
||||||
|
- .pkg
|
||||||
|
- .service
|
5
haproxy/map.jinja
Normal file
5
haproxy/map.jinja
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
{% set dir = '/etc/haproxy' %}
|
||||||
|
|
||||||
|
{% set haproxy = {
|
||||||
|
'conf_dir': '%s/conf.d' % dir,
|
||||||
|
}%}
|
30
haproxy/pkg.sls
Normal file
30
haproxy/pkg.sls
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
{% from tpldir+"/map.jinja" import haproxy with context %}
|
||||||
|
|
||||||
|
haproxy_pkg_pkgs:
|
||||||
|
pkg.installed:
|
||||||
|
- pkgs:
|
||||||
|
- haproxy
|
||||||
|
|
||||||
|
haproxy_pkg_conf_dir:
|
||||||
|
file.directory:
|
||||||
|
- name: /etc/haproxy/conf.d
|
||||||
|
- user: root
|
||||||
|
- group: root
|
||||||
|
- file_mode: '0644'
|
||||||
|
- dir_mode: '0755'
|
||||||
|
- require:
|
||||||
|
- haproxy_pkg_pkgs
|
||||||
|
|
||||||
|
haproxy_pkg_rc_script:
|
||||||
|
file.managed:
|
||||||
|
- name: /etc/init.d/haproxy
|
||||||
|
- source: salt://{{ tpldir }}/files/haproxy_rcscript.initd
|
||||||
|
- template: jinja
|
||||||
|
- context:
|
||||||
|
sls: {{ sls }}
|
||||||
|
conf_dir: {{ haproxy.conf_dir }}
|
||||||
|
- user: root
|
||||||
|
- group: root
|
||||||
|
- mode: '0755'
|
||||||
|
- require:
|
||||||
|
- haproxy_pkg_conf_dir
|
9
haproxy/service.sls
Normal file
9
haproxy/service.sls
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
include:
|
||||||
|
- .pkg
|
||||||
|
|
||||||
|
haproxy_service_running:
|
||||||
|
service.running:
|
||||||
|
- name: haproxy
|
||||||
|
- enable: True
|
||||||
|
- require:
|
||||||
|
- haproxy_pkg_rc_script
|
5
network/files/network_loopback
Normal file
5
network/files/network_loopback
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
auto lo
|
||||||
|
iface lo inet loopback
|
||||||
|
iface lo inet static
|
||||||
|
address 127.0.0.2/24
|
||||||
|
broadcast 0.0.0.0
|
|
@ -12,6 +12,26 @@ network_interfaces:
|
||||||
- require:
|
- require:
|
||||||
- system_base_pkgs
|
- system_base_pkgs
|
||||||
|
|
||||||
|
network_interfaces_dir:
|
||||||
|
file.directory:
|
||||||
|
- name: /etc/network/interfaces.d
|
||||||
|
- user: root
|
||||||
|
- group: root
|
||||||
|
- dir_mode: '0755'
|
||||||
|
- file_mode: '0644'
|
||||||
|
- require:
|
||||||
|
- system_base_pkgs
|
||||||
|
|
||||||
|
network_loopback_interfaces:
|
||||||
|
file.managed:
|
||||||
|
- name: /etc/network/interfaces.d/loopback
|
||||||
|
- source: salt://{{ tpldir }}/files/network_loopback
|
||||||
|
- user: root
|
||||||
|
- group: root
|
||||||
|
- mode: '0644'
|
||||||
|
- require:
|
||||||
|
- network_interfaces_dir
|
||||||
|
|
||||||
network_service_reload:
|
network_service_reload:
|
||||||
service.running:
|
service.running:
|
||||||
- name: networking
|
- name: networking
|
||||||
|
@ -19,3 +39,4 @@ network_service_reload:
|
||||||
- reload: True
|
- reload: True
|
||||||
- watch:
|
- watch:
|
||||||
- network_interfaces
|
- network_interfaces
|
||||||
|
- network_loopback_interfaces
|
||||||
|
|
|
@ -11,6 +11,6 @@ server {
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
|
|
||||||
client_max_body_size 50M;
|
client_max_body_size 50M;
|
||||||
proxy_http_version 1.1
|
proxy_http_version 1.1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
4
podman/apps/certpod/init.sls
Normal file
4
podman/apps/certpod/init.sls
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
{% from "map.jinja" import noveria with context %}
|
||||||
|
|
||||||
|
include:
|
||||||
|
- directories
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
include:
|
include:
|
||||||
- directories
|
- directories
|
||||||
- system.base
|
|
||||||
|
|
||||||
podman_apps_pms-cli_git:
|
podman_apps_pms-cli_git:
|
||||||
git.latest:
|
git.latest:
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
include:
|
include:
|
||||||
- directories
|
- directories
|
||||||
- system.base
|
|
||||||
|
|
||||||
podman_apps_poddoc_git:
|
podman_apps_poddoc_git:
|
||||||
git.latest:
|
git.latest:
|
||||||
|
|
1
top.sls
1
top.sls
|
@ -5,3 +5,4 @@ base:
|
||||||
- network
|
- network
|
||||||
- apps
|
- apps
|
||||||
- openssh
|
- openssh
|
||||||
|
- haproxy
|
||||||
|
|
Loading…
Reference in a new issue