Skip to content

Instantly share code, notes, and snippets.

@DevSecOpsGuy
Forked from cankush625/haproxy.yml
Created September 5, 2023 21:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DevSecOpsGuy/490dfcfc9097b5381cf3c255ac9fa201 to your computer and use it in GitHub Desktop.
Save DevSecOpsGuy/490dfcfc9097b5381cf3c255ac9fa201 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