geerlingguy / ansible-for-devops

Ansible for DevOps examples.
https://www.ansiblefordevops.com
MIT License
8.52k stars 3.47k forks source link

Chapter 3: CHANGED vs SUCCESS #549

Open cshintov opened 1 year ago

cshintov commented 1 year ago

In Make changes using Ansible modules section:

for the first command, when running fresh, I get only SUCCESS not CHANGED as said in the book.

$ ansible multi -b -m dnf -a "name=chrony state=present"
192.168.56.4 | SUCCESS => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/libexec/platform-python"
    },
    "changed": false,
    "msg": "Nothing to do",
    "rc": 0,
    "results": []
}
192.168.56.5 | SUCCESS => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/libexec/platform-python"
    },
    "changed": false,
    "msg": "Nothing to do",
    "rc": 0,
    "results": []
}
192.168.56.6 | SUCCESS => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/libexec/platform-python"
    },
    "changed": false,
    "msg": "Nothing to do",
    "rc": 0,
    "results": []
}

And for the second, when running fresh,

ansible multi -b -m service -a "name=chronyd state=started enabled=yes"
192.168.56.4 | SUCCESS => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/libexec/platform-python"
    },
    "changed": false,
    "enabled": true,
    "name": "chronyd",
    "state": "started",
    ...

Instead of "changed": true as said in the book, I get false!