Skip to content

Instantly share code, notes, and snippets.

@privateip
Last active March 11, 2016 17:16
Show Gist options
  • Save privateip/b11dff211cbda60a0e99 to your computer and use it in GitHub Desktop.
Save privateip/b11dff211cbda60a0e99 to your computer and use it in GitHub Desktop.
simple change using --check
(ansible)[network]$ ansible-playbook change_hostname.yaml --check
PLAY [veos01] ******************************************************************
TASK [eos_config] **************************************************************
changed: [veos01]
TASK [debug] *******************************************************************
ok: [veos01] => {
"result": {
"changed": true,
"updates": [
"hostname foo"
]
}
}
PLAY RECAP *********************************************************************
veos01 : ok=2 changed=1 unreachable=0 failed=0
(ansible)[network]$
(ansible)[network]$
(ansible)[network]$
(ansible)[network]$ cat change_hostname.yaml
---
- hosts: veos01
gather_facts: no
connection: local
tasks:
- eos_config:
lines:
- hostname foo
provider: "{{ cli }}"
register: result
- debug: var=result
(ansible)[network]$ ansible-playbook change_hostname.yaml
PLAY [veos01] ******************************************************************
TASK [eos_config] **************************************************************
changed: [veos01]
TASK [debug] *******************************************************************
ok: [veos01] => {
"result": {
"changed": true,
"responses": [
""
],
"updates": [
"hostname foo"
]
}
}
PLAY RECAP *********************************************************************
veos01 : ok=2 changed=1 unreachable=0 failed=0
(ansible)[network]$ ansible-playbook change_hostname.yaml
PLAY [veos01] ******************************************************************
TASK [eos_config] **************************************************************
ok: [veos01]
TASK [debug] *******************************************************************
ok: [veos01] => {
"result": {
"changed": false,
"updates": []
}
}
PLAY RECAP *********************************************************************
veos01 : ok=2 changed=0 unreachable=0 failed=0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment