Exercise 1: Non-Idempotent echo vs. an Idempotent Module, Run Twice — Possible Solution ==================================================================== Explanation: echo "some line" >> config_file is not idempotent because >> always APPENDS, unconditionally, regardless of whether "some line" is already present in the file. Running it once adds the line. Running the exact same command a second time doesn't check whether the line is already there -- it just appends it again, leaving the file with two copies of "some line" where there should only be one. The end result genuinely DIFFERS depending on how many times the command was run -- one run and two runs produce two different, distinguishable final states. An idempotent module like lineinfile, by contrast, is built to CHECK the file's current content before deciding whether to act. On the first run, it finds the line missing and adds it, reporting changed. On a second run against the exact same file, it checks again, finds the line is now already present, and does nothing at all, reporting ok instead of changed. The file's own final content is IDENTICAL whether the module ran once or ran fifty times -- exactly the definition of idempotency the chapter opens with: the same end result regardless of how many times the operation is applied. The core difference is that the non-idempotent shell command has no concept of "current state" at all -- it just blindly performs an action every time it's invoked -- while the idempotent module's whole design is built around first observing the current state and only acting if that state doesn't already match what's desired. WHY THIS WORKS AS AN ANSWER ------------------------------ This traces the mechanical reason each approach behaves differently on a second run -- unconditional action vs. check-then-act -- rather than simply restating that one is idempotent and one isn't, directly using the chapter's own echo/lineinfile contrast.