Laureline's Wiki

Laureline's Wiki

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
heig:cld:lab07 [2017/05/15 16:48] – [Task 7: Add more managed servers] mikeheig:cld:lab07 [2017/05/15 17:06] – [Task 7: Add more managed servers] mike
Line 339: Line 339:
  
 **Re-run the web.yml playbook. What do you observe in Ansible's output?** **Re-run the web.yml playbook. What do you observe in Ansible's output?**
 +
 +We can see that everything goes as expected. No tasks has been trigerred for the first server (IP: 54.147.90.78) which was already up to date. For the newly added server 4 tasks were trigered and the nginx server restarted as expected.
  
 <code bash> <code bash>
Line 371: Line 373:
 54.147.90.78               : ok=5    changed=0    unreachable=0    failed=0 54.147.90.78               : ok=5    changed=0    unreachable=0    failed=0
 </code> </code>
- 
  
 **Test the new server by pointing your web browser to it.** **Test the new server by pointing your web browser to it.**
 +
 +{{ :heig:cld:cld07_t3.png?nolink |}}
  
 **What happens if a server is not reachable? Shut down the second instance and re-run the playbook.** **What happens if a server is not reachable? Shut down the second instance and re-run the playbook.**
 +
 +We can see that Ansible try to reach the server in vain so it change the status of the server to unreachable. We can also see that Ansible continue the other tasks on the available servers.
 +
 +<code bash>
 +Yoda:playbooks frederic$ ansible-playbook web.yml
 +
 +PLAY [Configure webserver with nginx] **********************************************************************************************************************************************************************
 +
 +TASK [Gathering Facts] *************************************************************************************************************************************************************************************
 +fatal: [52.206.206.57]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh: ssh: connect to host 52.206.206.57 port 22: Operation timed out\r\n", "unreachable": true}
 +ok: [54.147.90.78]
 +
 +TASK [install nginx] ***************************************************************************************************************************************************************************************
 +ok: [54.147.90.78]
 +
 +TASK [copy nginx config file] ******************************************************************************************************************************************************************************
 +ok: [54.147.90.78]
 +
 +TASK [enable configuration] ********************************************************************************************************************************************************************************
 +ok: [54.147.90.78]
 +
 +TASK [copy index.html] *************************************************************************************************************************************************************************************
 +ok: [54.147.90.78]
 + to retry, use: --limit @/Users/frederic/Desktop/CLD_Lab07/playbooks/web.retry
 +
 +PLAY RECAP *************************************************************************************************************************************************************************************************
 +52.206.206.57              : ok=0    changed=0    unreachable=1    failed=0   
 +54.147.90.78               : ok=5    changed=0    unreachable=0    failed=0
 +</code>