Hello @Inderpreet @Tej-Singh-Rana ,
I already posted here to check the task as it was getting failed.
Here is a new request to check my task as it was getting failed !!!
I was successfully able to curl from jump host.
Here is my solution
- hosts: backupserver
become: true
tasks:
- name: Install yum packages
yum:
name: epel-release
state: latest
- name: Install Apache(httpd)
yum:
name: httpd
state: latest
- name: Install Nginx
yum:
name: nginx
state: latest
notify:
- Restart services
- name: Configure httpd.conf port
lineinfile:
path: /etc/httpd/conf/httpd.conf
regexp: '^Listen '
insertafter: '^#Listen '
line: Listen 8086
- name: Copy Nginx conf -> default.conf to backup server
copy:
src: default.conf
dest: /etc/nginx/conf.d/
- name: Copy index.html to backup server
copy:
src: /home/index.html
dest: "{{ item }}"
with_items:
- /var/www/html/
- /usr/share/nginx/html/
- name: Start Services
systemd:
name: "{{ item }}"
state: started
enabled: yes
with_items :
- httpd
- nginx
handlers:
- name: Restart services
systemd:
name: "{{ item }}"
state: restarted
with_items:
- httpd
- nginx
default.conf
server {
listen 8093;
root /usr/share/nginx/html/;
index index.php index.html index.htm;
server_name _;
location / {
try_files $uri $uri/ /index.php;
}
location ~ \.php$ {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_pass http://127.0.0.1:8080;
}
location ~ /\.ht {
deny all;
}
}
- 2nd time I got another type of error -
PS: I properly configured ports in my configuration file. Below is the screenshot to check that I was able to curl from jump host.
The task is marked now as Expired !!!
Please let me know !!!
Thanks