diff --git a/README.md b/README.md index fecb8fe791b51dacf16dd7e30dbdf9d30020c318..043759d8d8478b3717b485f467ddea0d51d78a58 100644 --- a/README.md +++ b/README.md @@ -312,7 +312,7 @@ State Configuration. According to this principle, before doing anything, Ansible should establish the current state of the managed server, compare it to the desired state expressed in the playbook, and then only perform the actions necessary to -bring the current state to the desired state. +bring the current state to the desired state. In other words, if the managed system is already in its desired state, nothing will be done (apart from some notable exception -- see below): that's called "idempotence". In its ouput, Ansible marks tasks where it had to perform some action as *changed* whereas tasks where the actual state already corresponded to the @@ -337,18 +337,20 @@ desired state as *ok*. `index.html` (by the way, what's the deployment path?) and repeat the previous question. 1. :question: What happened this time? + 1. Nothwitstanding the idempotence principle, there's task which is always marked as "changed". + 1. :question: Which one? Do you have an explanation? ### Task #6: Adding a handler for nginx restart ### **Goal:** improve the playbook by restarting nginx only when needed. -The current version of the playbook restarts nginx every time the playbook is +The current version of the playbook _uncondizonally_ restarts nginx every time the playbook is run, irrespective of the managed server's state. This goes indeed a bit too far. By putting the nginx restart command into a *handler*, instead of a task, its -execution can be made conditional. The rationale is that nginx is restarted +execution can be made _conditional_. The rationale is that nginx is restarted only if one of the tasks that affects nginx's configuration resulted in a change. @@ -358,15 +360,13 @@ the playbook so that the nginx restart becomes a handler and the tasks that potentially modify its configuration use *notify* to call the handler when needed. -Copy the modified playbook into the lab report. - ### Task 7: Add more managed servers ### **Goal:** add more managed servers that will be configured by the same playbook. - 1. Create another Cloud instance using the same parameters as before. + 1. Create another Cloud instance using the same parameters as before. :bulb: There's an easy way to do that with Terraform's `count` mechanism ;-) 2. Extend the `webservers` group in your inventory file to include this new managed host. 3. Re-run your web playbook. :question: What do you observe in Ansible's