90DaysOfDevOps/2022/Days/Configmgmt/ansible-scenario6/roles/nginx/templates/mysite.j2

14 lines
349 B
Plaintext
Raw Normal View History

#Dynamic Config for server {{ ansible_facts['nodename'] }}
upstream webservers {
{% for host in groups['webservers'] %}
server {{ hostvars[host]['ansible_facts']['nodename'] }}:{{ http_port }};
{% endfor %}
}
server {
listen 80;
location / {
proxy_pass http://webservers;
}
}