Skip to content

Instantly share code, notes, and snippets.

@cankush625
Created December 17, 2020 09:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save cankush625/6ff35f0339e31cb1aa4617ffb4a81cf7 to your computer and use it in GitHub Desktop.
Save cankush625/6ff35f0339e31cb1aa4617ffb4a81cf7 to your computer and use it in GitHub Desktop.
- hosts: localhost
vars:
- loadbalancer_port: 8080
tasks:
- name: Install HAProxy Software
package:
name: "haproxy"
state: present
register: haproxyinstall
- name: haproxy config
template:
dest: "/etc/haproxy/haproxy.cfg"
src: "/home/cankush/AnsibleAutomation-RH294/configureLoadBalancerHAProxy/haproxy.cfg.j2"
when: haproxyinstall.rc == 0
notify: haproxy restart
- name: start haproxy services
service:
name: "haproxy"
state: started
handlers:
- name: haproxy restart
service:
name: "haproxy"
state: restarted
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment