From 3e13ceec5f0ab2ab6124135c0c137d90fc4094ef Mon Sep 17 00:00:00 2001 From: "Marco Emilio \"sphakka\" Poleggi" <marcoep@ieee.org> Date: Mon, 11 Nov 2024 11:10:53 +0100 Subject: [PATCH] More info for the KinD boilerplate Signed-off-by: Marco Emilio "sphakka" Poleggi <marcoep@ieee.org> --- README.md | 19 +++++++++---------- ansible/playbooks/kind-metallb.yml | 7 +++++++ 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 1c367d5..70a0824 100644 --- a/README.md +++ b/README.md @@ -345,17 +345,17 @@ using plain `http`): `http://<VM-DNS-name-or-IP-address>`. You should see the homepage showing "nginx, configured by Ansible". -### Task #5: Test Desired State Configuration principles ### +### Task #5: Test the desired state principle ### -**Goal:** test and verify that Ansible implements the principles of Desired -State Configuration. +**Goal:** test and verify that Ansible implements the principles of desired +state and idempotence. -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. 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". +According to the *desired state* principle, before doing anything, Ansible +should establish the current state of the managed server, compare it to the +goals expressed in the playbook, and then only perform the actions necessary +to 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](https://en.wikipedia.org/wiki/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 @@ -387,7 +387,6 @@ desired state as *ok*. on. - ### Task #6: Adding a handler for nginx restart ### **Goal:** improve the playbook by restarting nginx only when needed. diff --git a/ansible/playbooks/kind-metallb.yml b/ansible/playbooks/kind-metallb.yml index 951e35e..da54c4b 100644 --- a/ansible/playbooks/kind-metallb.yml +++ b/ansible/playbooks/kind-metallb.yml @@ -31,9 +31,16 @@ # "metallb-native.yml"), using a block here is recommended! # - Configuration tasks shall trigger their respective deployments. + # Optional *bonus* auxiliary task for the "rebuild all" + # Checks the existence of a KinD cluster + # - Capture output with "register" and use it as condition with + # "changed_when" + # - Should trigger the creation of the KinD cluster if no cluster is running (even + # if its config hasn't changed) # Optional *bonus* on-demand tasks: + # [** Mandatory for the groups of 3 **] # - Rebuild all: manually reprovision the cluster and redeploy the # application (tip: notify via a signal). This might require an extra # task that checks the existence of a KinD cluster. -- GitLab