Finished loadbalancer playbook with config

This commit is contained in:
2022-02-23 18:28:35 +01:00
parent 4cb905883c
commit 7fd3bb2c37
2 changed files with 22 additions and 27 deletions

View File

@@ -1,15 +1,13 @@
http {
upstream app {
{% for host in ip %}
server {{ host.ip }};
{% endfor %}
}
upstream app {
{% for host in groups['webserver'] %}
server {{ hostvars[host]['ipv4_address'] }}:80;
{% endfor %}
}
server {
listen 80;
server {
listen 80;
location / {
proxy_pass http://app;
}
location / {
proxy_pass http://app;
}
}
}