Created
January 29, 2021 13:50
-
-
Save aminkhoshzahmat/68df617ef399650efa08f74f33da95cd to your computer and use it in GitHub Desktop.
Ansible: Install 2 nginx server and load balance with haproxy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- 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