Merge pull request 'Add nginx role and playbook for App1 deployment' (#4) from feature/nginx-app1-deployment into main
Reviewed-on: #4
This commit is contained in:
37
playbooks/deploy-app1-nginx.yml
Normal file
37
playbooks/deploy-app1-nginx.yml
Normal file
@ -0,0 +1,37 @@
|
||||
---
|
||||
- name: Deploy Nginx on App1
|
||||
hosts: 192.168.0.110
|
||||
become: yes
|
||||
gather_facts: yes
|
||||
|
||||
roles:
|
||||
- role: nginx
|
||||
|
||||
tasks:
|
||||
- name: Verify Nginx installation
|
||||
uri:
|
||||
url: "http://{{ ansible_default_ipv4.address }}"
|
||||
status_code: 200
|
||||
timeout: 10
|
||||
register: nginx_check
|
||||
until: nginx_check.status == 200
|
||||
retries: 5
|
||||
delay: 5
|
||||
ignore_errors: yes
|
||||
|
||||
- name: Verify Nginx status endpoint
|
||||
uri:
|
||||
url: "http://{{ ansible_default_ipv4.address }}/status"
|
||||
status_code: 200
|
||||
timeout: 5
|
||||
register: status_check
|
||||
ignore_errors: yes
|
||||
|
||||
- name: Display deployment result
|
||||
debug:
|
||||
msg: |
|
||||
✅ Nginx successfully deployed on {{ inventory_hostname }}!
|
||||
🌐 Access at: http://{{ ansible_default_ipv4.address }}
|
||||
📊 Status page: http://{{ ansible_default_ipv4.address }}/status
|
||||
📈 Nginx metrics: http://{{ ansible_default_ipv4.address }}/nginx_status
|
||||
🖥️ Node metrics: http://{{ ansible_default_ipv4.address }}:9100/metrics
|
||||
Reference in New Issue
Block a user