diff options
author | Christian Pointner <equinox@spreadspace.org> | 2020-01-17 23:24:10 +0100 |
---|---|---|
committer | Christian Pointner <equinox@spreadspace.org> | 2020-01-31 22:31:22 +0100 |
commit | db478d9fde9bc89b4ab3bca7ffc7540794e85f10 (patch) | |
tree | e168b3ccbbfa922cd86c356ee694a2e37e15df00 /roles/kubernetes/kubeadm/base/tasks/main.yml | |
parent | kubernetes: kubernetes_overlay_node_ip (diff) |
kubernetes: added haproxy for load balancing api servers
Diffstat (limited to 'roles/kubernetes/kubeadm/base/tasks/main.yml')
-rw-r--r-- | roles/kubernetes/kubeadm/base/tasks/main.yml | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/roles/kubernetes/kubeadm/base/tasks/main.yml b/roles/kubernetes/kubeadm/base/tasks/main.yml index 69a09811..8e913560 100644 --- a/roles/kubernetes/kubeadm/base/tasks/main.yml +++ b/roles/kubernetes/kubeadm/base/tasks/main.yml @@ -2,6 +2,8 @@ - name: install kubeadm and kubectl apt: name: + - haproxy + - hatop - "kubeadm{% if kubernetes.pkg_version is defined %}={{ kubernetes.pkg_version }}{% endif %}" - "kubectl{% if kubernetes.pkg_version is defined %}={{ kubernetes.pkg_version }}{% endif %}" state: present @@ -33,3 +35,26 @@ marker: "### {mark} ANSIBLE MANAGED BLOCK for kubeadm ###" content: | source <(kubeadm completion {{ item }}) + +- name: configure haproxy + template: + src: haproxy.cfg.j2 + dest: /etc/haproxy/haproxy.cfg + register: haproxy_config + +- name: (re)start haproxy + systemd: + name: haproxy + state: "{% if haproxy_config is changed %}restarted{% else %}started{% endif %}" + enabled: yes + +- name: add hatop config for shells + loop: + - zsh + - bash + blockinfile: + path: "/root/.{{ item }}rc" + create: yes + marker: "### {mark} ANSIBLE MANAGED BLOCK for hatop ###" + content: | + alias hatop="hatop -s /var/run/haproxy/admin.sock" |