Add loadbalancer task file
This commit is contained in:
parent
c541ea67b3
commit
2019ac846d
1 changed files with 32 additions and 0 deletions
32
tasks/load_balancer.yml
Normal file
32
tasks/load_balancer.yml
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
---
|
||||
- name: Install needed packages
|
||||
package:
|
||||
name: "{{ item }}"
|
||||
state: latest
|
||||
update_cache: yes
|
||||
with_items:
|
||||
- keepalived
|
||||
- curl
|
||||
notify: Restart keepalived
|
||||
- name: Install check_apiserver.sh script for keepalived
|
||||
template:
|
||||
src: etc/keepalived/check_apiserver.sh.j2
|
||||
dest: /etc/keepalived/check_apiserver.sh
|
||||
- name: Install keepalived config file
|
||||
template:
|
||||
src: etc/keepalived/keepalived.conf.j2
|
||||
dest: /etc/keepalived/keepalived.conf
|
||||
with_items:
|
||||
- { lbip: '{{ lbip_kubeapiserver }}', state: "MASTER", interface: '{{ lb_interface }}', auth_pass: '{{ lb_auth_pass }}' }
|
||||
when:
|
||||
- groups['Kube-masters'][0] == ansible_hostname
|
||||
notify: Restart keepalived
|
||||
- name: Install keepalived config file
|
||||
template:
|
||||
src: etc/keepalived/keepalived.conf.j2
|
||||
dest: /etc/keepalived/keepalived.conf
|
||||
with_items:
|
||||
- { lbip: '{{ lbip_kubeapiserver }}', state: "BACKUP", interface: '{{ lb_interface }}', auth_pass: '{{ lb_auth_pass }}' }
|
||||
when:
|
||||
- not groups['Kube-masters'][0] == ansible_hostname
|
||||
notify: Restart keepalived
|
||||
Loading…
Add table
Add a link
Reference in a new issue