Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Ansible: Install 2 nginx server and load balance with haproxy
- name: ----- Add haproxy to host -----
lineinfile:
path: /etc/hosts
insertafter: EOF
line: '192.168.56.66 haproxy'
tags: haproxt
- name: ----- Install epel-release and enginx -----
yum:
name: ['epel-release', 'nginx']
state: present
tags: install_nginx
- name: ------ Edit index.html ------
copy:
content: '<h1>hello from {{ansible_hostname}}</h1>'
dest: /usr/share/nginx/html/index.html
tags: edit_index
- name: ------ enable and start nginx ------
service:
name: nginx
enabled: true
state: started
tags: start_nginx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment