TPeters
Flight Engineer
Flight Engineer
  • 5,329 Views

curl finds no route to host?

Jump to solution

I am doing the self-paced course RH294 . With two exercises (Ch.3 final Lab and Ch.4 lab exercise 2) I ran into this problem:

after installing and starting a web service, from the classroom web termicaI I cannot reach servera.lab.example.com with curl: "No route to host". This despite the fact that I can ping it, open a shell to it, and install the package on it with Ansible.

Anyone else have the same problem?

What might be the cause?

 

Labels (1)
2 Solutions

Accepted Solutions
TPeters
Flight Engineer
Flight Engineer
  • 3,698 Views

Apparently `lab finish` removes (a.o.) the /var/www/* , but does not remove the httpd-filesystem package, possibly because other packages depend on it So serverb is left in an inconsistent state.

I now managed to run the `lab grade data-review` successfully, so consider this issue solved.

 

View solution in original post

Travis
Moderator
Moderator
  • 3,992 Views

@Chetan_Tiwary_ -

I've seen errors when teaching the class and in most cases, students have not had the firewall running or the service wasn't running. Seeing the entire playbook is what is needed. 

The "curl" command connects on port 80 so if that is blocked by the firewall, you get no routte to host. So, it isn't a network glitch as you can do regular pings. Ansible is able to customize things as servera and the rest of the servers have port 22 open on the firewall for SSH. However, the Linux servers do not have port 80/tcp open.

I would venture a guess that if you would do a "firewall-cmd --add-service=http" or a "firewall-cmd --add-port=80/tcp" that the curl command would work. 

It looks like the lab environment wants you to use HTTPS, so it is important when testing with curl to use the port. It is also important to check the playbook to ensure firewalld opened the correct ports.

 

 

Travis Michette, RHCA XIII
https://rhtapps.redhat.com/verify?certId=111-134-086
SENIOR TECHNICAL INSTRUCTOR / CERTIFIED INSTRUCTOR AND EXAMINER
Red Hat Certification + Training

View solution in original post

26 Replies
pjentw
Mission Specialist
Mission Specialist
  • 4,088 Views

From what I can see, chapter 3 final lab (data review) uses serverb not servera and for exercise 2 of chapter 4 (control handlers) it doesn't open the firewall, as it is more about proving the function of the handlers rather than actually building another web server, so I don't think a response is expected and no curl test is asked for.

0 Kudos
Chetan_Tiwary_
Moderator
Moderator
  • 4,077 Views

Hello @TPeters !

Thanks for reaching out !

For ch3s07 - you need to open a firefox browser and try to reach to serverb webserver : use the web_user and web_pass credentials to login and see that it is working fine : 

Chetan_Tiwary__0-1690197851938.png

 

Tags (2)
0 Kudos
TPeters
Flight Engineer
Flight Engineer
  • 4,031 Views

Chetan (and pjentw), thank you for your response. Only now I find time to attend this again.

Indeed I ran it against serverb which is in the inventory, not servera. I did the curl myself because the lab-grade failed.

 I try to run the data-review again, but it now fails at another check:

%<---

[student@workstation ~]$ lab start data-review

Starting lab.

· Checking lab systems ............................................................................................................................................... SUCCESS
· Adding exercise content ............................................................................................................................................ SUCCESS
· Ensuring required packages are installed ........................................................................................................................... SUCCESS
· Setting up exercise ................................................................................................................................................ SUCCESS

--- >%

%<---

[student@workstation data-review]$ ansible-navigator run -m stdout --playbook-artifact-enable false playbook.yml --vault-id @prompt
Vault password (default):

PLAY [Data Review playbook] *****************************************************************************************************************************************************

TASK [Gathering Facts] **********************************************************************************************************************************************************
ok: [serverb.lab.example.com]

TASK [Install packages] *********************************************************************************************************************************************************
changed: [serverb.lab.example.com]

TASK [Copy httpd.conf] **********************************************************************************************************************************************************
changed: [serverb.lab.example.com]

TASK [Create secrets directory] *************************************************************************************************************************************************
changed: [serverb.lab.example.com]

TASK [Copy secrets file] ********************************************************************************************************************************************************
changed: [serverb.lab.example.com]

TASK [Copy .htaccess] ***********************************************************************************************************************************************************
fatal: [serverb.lab.example.com]: FAILED! => {"changed": false, "checksum": "9257441435578eaa12b97f0185b5fb26b558b622", "msg": "Destination directory /var/www/html does not exist"}

PLAY RECAP **********************************************************************************************************************************************************************
serverb.lab.example.com : ok=5 changed=4 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0

--->%

I cannot copy content from the serverb console, but I looked and indeed there is no /var/www/html directory even though `yum info httpd` says the httpd package has been installed.

This problem did not occur the first time I ran this main.yml .

 

0 Kudos
TPeters
Flight Engineer
Flight Engineer
  • 3,701 Views

Follow up:

I logged in on the serverb . From `rpm -q --whatprovides /var/www` I learned that it comes from the httpd-filesystem packakes. `yum info httpd-filesystem` says it was installed. `rpm install httpd-filesystem` says it has nothing to do. So I did `rpm reinstall httpd-filesysytem` and that created the /var/www/html/ .

To be continued.

 

TPeters
Flight Engineer
Flight Engineer
  • 3,699 Views

Apparently `lab finish` removes (a.o.) the /var/www/* , but does not remove the httpd-filesystem package, possibly because other packages depend on it So serverb is left in an inconsistent state.

I now managed to run the `lab grade data-review` successfully, so consider this issue solved.

 

Chetan_Tiwary_
Moderator
Moderator
  • 3,673 Views

Hello @TPeters !

I see that you have figured out the issue yourself - great !

Let me know if you need any help or you have a question / feedback on this.

0 Kudos
  • 3,372 Views
check the permissions on firewall and the files as well in the playbook
Rogier
Cadet
Cadet
  • 2,990 Views
Hello, i have run this chapter 3, s7. And successful completed the script and ran also successful. debug output: "serverb.lab.example.com(IP) has been customized by Ansible" but the grade from lab data-review. it saids reachable is fail. I have tested with curl and browser with web_pass / web_user with no problem. Am I something missed?
Chetan_Tiwary_
Moderator
Moderator
  • 2,989 Views

@Rogier Do you have a screenshot to check ?

0 Kudos
Join the discussion
You must log in to join this conversation.