Skip to content

Instantly share code, notes, and snippets.

@aminkhoshzahmat
Created January 29, 2021 13:50
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aminkhoshzahmat/68df617ef399650efa08f74f33da95cd to your computer and use it in GitHub Desktop.
Save aminkhoshzahmat/68df617ef399650efa08f74f33da95cd to your computer and use it in GitHub Desktop.
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