First commit
0 parents
Showing
4 changed files
with
248 additions
and
0 deletions
ansible.cfg
0 → 100644
deploy-nginx-web-server-proxy.yml
0 → 100644
| 1 | --- | ||
| 2 | - hosts: all | ||
| 3 | collections: | ||
| 4 | - nginxinc.nginx_core | ||
| 5 | tasks: | ||
| 6 | - name: Install NGINX | ||
| 7 | ansible.builtin.include_role: | ||
| 8 | name: nginx | ||
| 9 | |||
| 10 | - name: Configure NGINX | ||
| 11 | ansible.builtin.include_role: | ||
| 12 | name: nginx_config | ||
| 13 | vars: | ||
| 14 | nginx_config_http_template_enable: true | ||
| 15 | nginx_config_http_template: | ||
| 16 | - template_file: http/default.conf.j2 | ||
| 17 | deployment_location: /etc/nginx/conf.d/default.conf | ||
| 18 | config: | ||
| 19 | upstreams: | ||
| 20 | - name: upstr | ||
| 21 | least_conn: true | ||
| 22 | servers: | ||
| 23 | - address: 0.0.0.0:8081 | ||
| 24 | - address: 0.0.0.0:8082 | ||
| 25 | servers: | ||
| 26 | - core: | ||
| 27 | listen: | ||
| 28 | - port: 80 | ||
| 29 | server_name: localhost | ||
| 30 | log: | ||
| 31 | access: | ||
| 32 | - path: /var/log/nginx/access.log | ||
| 33 | format: main | ||
| 34 | locations: | ||
| 35 | - location: / | ||
| 36 | proxy: | ||
| 37 | pass: http://upstr/ | ||
| 38 | set_header: | ||
| 39 | field: Host | ||
| 40 | value: $host | ||
| 41 | - core: | ||
| 42 | listen: | ||
| 43 | - port: 8081 | ||
| 44 | server_name: localhost | ||
| 45 | log: | ||
| 46 | access: | ||
| 47 | - path: /var/log/nginx/access.log | ||
| 48 | format: main | ||
| 49 | locations: | ||
| 50 | - location: / | ||
| 51 | core: | ||
| 52 | root: /usr/share/nginx/html | ||
| 53 | index: server_one.html | ||
| 54 | sub_filter: | ||
| 55 | sub_filters: | ||
| 56 | - string: server_hostname | ||
| 57 | replacement: $hostname | ||
| 58 | - string: server_address | ||
| 59 | replacement: $server_addr:$server_port | ||
| 60 | - string: server_url | ||
| 61 | replacement: $request_uri | ||
| 62 | - string: remote_addr | ||
| 63 | replacement: '$remote_addr:$remote_port' | ||
| 64 | - string: server_date | ||
| 65 | replacement: $time_local | ||
| 66 | - string: client_browser | ||
| 67 | replacement: $http_user_agent | ||
| 68 | - string: request_id | ||
| 69 | replacement: $request_id | ||
| 70 | - string: nginx_version | ||
| 71 | replacement: $nginx_version | ||
| 72 | - string: document_root | ||
| 73 | replacement: $document_root | ||
| 74 | - string: proxied_for_ip | ||
| 75 | replacement: $http_x_forwarded_for | ||
| 76 | once: false | ||
| 77 | - core: | ||
| 78 | listen: | ||
| 79 | - port: 8082 | ||
| 80 | server_name: localhost | ||
| 81 | log: | ||
| 82 | access: | ||
| 83 | - path: /var/log/nginx/access.log | ||
| 84 | format: main | ||
| 85 | locations: | ||
| 86 | - location: / | ||
| 87 | core: | ||
| 88 | root: /usr/share/nginx/html | ||
| 89 | index: server_two.html | ||
| 90 | sub_filter: | ||
| 91 | sub_filters: | ||
| 92 | - string: server_hostname | ||
| 93 | replacement: $hostname | ||
| 94 | - string: server_address | ||
| 95 | replacement: $server_addr:$server_port | ||
| 96 | - string: server_url | ||
| 97 | replacement: $request_uri | ||
| 98 | - string: remote_addr | ||
| 99 | replacement: '$remote_addr:$remote_port' | ||
| 100 | - string: server_date | ||
| 101 | replacement: $time_local | ||
| 102 | - string: client_browser | ||
| 103 | replacement: $http_user_agent | ||
| 104 | - string: request_id | ||
| 105 | replacement: $request_id | ||
| 106 | - string: nginx_version | ||
| 107 | replacement: $nginx_version | ||
| 108 | - string: document_root | ||
| 109 | replacement: $document_root | ||
| 110 | - string: proxied_for_ip | ||
| 111 | replacement: $http_x_forwarded_for | ||
| 112 | once: false | ||
| 113 | |||
| 114 | nginx_config_html_demo_template_enable: true | ||
| 115 | nginx_config_html_demo_template: | ||
| 116 | - template_file: www/index.html.j2 | ||
| 117 | deployment_location: /usr/share/nginx/html/server_one.html | ||
| 118 | web_server_name: Ansible NGINX collection - Server one | ||
| 119 | - template_file: www/index.html.j2 | ||
| 120 | deployment_location: /usr/share/nginx/html/server_two.html | ||
| 121 | web_server_name: Ansible NGINX collection - Server two |
inventory-test.ini
0 → 100644
vue-deploy-nginx-proxy.yml
0 → 100644
| 1 | --- | ||
| 2 | - hosts: glb | ||
| 3 | collections: | ||
| 4 | - nginxinc.nginx_core | ||
| 5 | tasks: | ||
| 6 | - name: Install NGINX | ||
| 7 | ansible.builtin.include_role: | ||
| 8 | name: nginx | ||
| 9 | |||
| 10 | - name: Configure NGINX | ||
| 11 | ansible.builtin.include_role: | ||
| 12 | name: nginx_config | ||
| 13 | vars: | ||
| 14 | nginx_config_http_template_enable: true | ||
| 15 | nginx_config_http_template: | ||
| 16 | - template_file: http/default.conf.j2 | ||
| 17 | deployment_location: /etc/nginx/conf.d/default.conf | ||
| 18 | config: | ||
| 19 | upstreams: | ||
| 20 | - name: jbosseap_test | ||
| 21 | least_conn: true | ||
| 22 | servers: | ||
| 23 | - address: tlbi01.vue.gov.py:80 | ||
| 24 | servers: | ||
| 25 | - core: | ||
| 26 | listen: | ||
| 27 | - port: 80 | ||
| 28 | server_name: vueapp.test.vue.gov.py | ||
| 29 | log: | ||
| 30 | access: | ||
| 31 | - path: /var/log/nginx/access.log | ||
| 32 | format: main | ||
| 33 | locations: | ||
| 34 | - location: / | ||
| 35 | proxy: | ||
| 36 | pass: http://jbosseap_test/ | ||
| 37 | set_header: | ||
| 38 | field: Host | ||
| 39 | value: $host | ||
| 40 | # - core: | ||
| 41 | # listen: | ||
| 42 | # - port: 8081 | ||
| 43 | # server_name: localhost | ||
| 44 | # log: | ||
| 45 | # access: | ||
| 46 | # - path: /var/log/nginx/access.log | ||
| 47 | # format: main | ||
| 48 | # locations: | ||
| 49 | # - location: / | ||
| 50 | # core: | ||
| 51 | # root: /usr/share/nginx/html | ||
| 52 | # index: server_one.html | ||
| 53 | # sub_filter: | ||
| 54 | # sub_filters: | ||
| 55 | # - string: server_hostname | ||
| 56 | # replacement: $hostname | ||
| 57 | # - string: server_address | ||
| 58 | # replacement: $server_addr:$server_port | ||
| 59 | # - string: server_url | ||
| 60 | # replacement: $request_uri | ||
| 61 | # - string: remote_addr | ||
| 62 | # replacement: '$remote_addr:$remote_port' | ||
| 63 | # - string: server_date | ||
| 64 | # replacement: $time_local | ||
| 65 | # - string: client_browser | ||
| 66 | # replacement: $http_user_agent | ||
| 67 | # - string: request_id | ||
| 68 | # replacement: $request_id | ||
| 69 | # - string: nginx_version | ||
| 70 | # replacement: $nginx_version | ||
| 71 | # - string: document_root | ||
| 72 | # replacement: $document_root | ||
| 73 | # - string: proxied_for_ip | ||
| 74 | # replacement: $http_x_forwarded_for | ||
| 75 | # once: false | ||
| 76 | # - core: | ||
| 77 | # listen: | ||
| 78 | # - port: 8082 | ||
| 79 | # server_name: localhost | ||
| 80 | # log: | ||
| 81 | # access: | ||
| 82 | # - path: /var/log/nginx/access.log | ||
| 83 | # format: main | ||
| 84 | # locations: | ||
| 85 | # - location: / | ||
| 86 | # core: | ||
| 87 | # root: /usr/share/nginx/html | ||
| 88 | # index: server_two.html | ||
| 89 | # sub_filter: | ||
| 90 | # sub_filters: | ||
| 91 | # - string: server_hostname | ||
| 92 | # replacement: $hostname | ||
| 93 | # - string: server_address | ||
| 94 | # replacement: $server_addr:$server_port | ||
| 95 | # - string: server_url | ||
| 96 | # replacement: $request_uri | ||
| 97 | # - string: remote_addr | ||
| 98 | # replacement: '$remote_addr:$remote_port' | ||
| 99 | # - string: server_date | ||
| 100 | # replacement: $time_local | ||
| 101 | # - string: client_browser | ||
| 102 | # replacement: $http_user_agent | ||
| 103 | # - string: request_id | ||
| 104 | # replacement: $request_id | ||
| 105 | # - string: nginx_version | ||
| 106 | # replacement: $nginx_version | ||
| 107 | # - string: document_root | ||
| 108 | # replacement: $document_root | ||
| 109 | # - string: proxied_for_ip | ||
| 110 | # replacement: $http_x_forwarded_for | ||
| 111 | # once: false | ||
| 112 | |||
| 113 | nginx_config_html_demo_template_enable: false | ||
| 114 | nginx_config_html_demo_template: | ||
| 115 | - template_file: www/index.html.j2 | ||
| 116 | deployment_location: /usr/share/nginx/html/server_one.html | ||
| 117 | web_server_name: Ansible NGINX collection - Server one | ||
| 118 | - template_file: www/index.html.j2 | ||
| 119 | deployment_location: /usr/share/nginx/html/server_two.html | ||
| 120 | web_server_name: Ansible NGINX collection - Server two |
-
Please register or sign in to post a comment