-
Notifications
You must be signed in to change notification settings - Fork 168
Description
Good Morning,
We have a mostly juniper fleet, with 100% ansible coverage on access switches and various degree of coverage on the Layer 3 gear. We are running version 1.4.2 of ansible-junos-stdlib.
Currently, we tipically run ansible in check_mode first, validate the diff that gets produced and if deemed acceptable, the neteng re-runs ansible without check_mode to deploy the change and commit it to running config.
I ran into a particularly troublesome issue for us with regards to check_mode after trying to upgrade to 2.0.2.
Upgrading the lib to 2.0.2 yields errors about check_mode not being supported by juniper_junos_config.
Updating our playbook to use the new module arguments does not change the result.
Only forcibly disabling check_mode for the task and applying some jinja2 magic to replicate the old check_mode behavior obtains the intended workflow but we don't see this as a viable alternative.
I was hoping to confirm if check_mode is intentionally unsupported or this might be a bug or maybe a misconfiguration on my part?
Thanks for any help or insight you might provide.
Please find the details of the issue attached here:
Our Current Setup that works as intended:
Ansible 2.3.1.0
ansible-junos-stdlib 1.4.2
My test environment:
Ansible 2.3.1.0
ansible-junos-stdlib 2.0.2
Command line used to launch ansible:
ansible-playbook -i prod.hosts site.yml -e user=myusername --check -f25 --ask-vault-pass --limit DEVICE
Relevant snippet of our current playbook (functional with 1.4.2):
playbook_snippet_1.4.2.txt
Output of the task:
TASK [Load the compiled configuration via "load replace"]
*************************************************************
changed: [DEVICE] => {"changed": true, "file": "PATH/compiled/DEVICE/device.conf"}
Upgrading ansible-junos-stdlib to 2.0.2 without changing the playbook or anything else yields:
TASK [Load the compiled configuration via "load replace"] *************************************************************
skipping: [DEVICE] => {"changed": false, "msg": "remote module (junos_install_config) does not support check mode", "skipped": true}
Revised playbook using 2.0.2. (non functional) - this uses "modern" module names and arguments however it does not change the end result:
playbook_snippet_2.0.2.txt
Output:
TASK [Load the compiled configuration via "load replace"] *************************************************************
skipping: [DEVICE] => {"changed": false, "msg": "remote module (juniper_junos_config) does not support check mode", "skipped": true}
I find this puzzling because this variable seems to suggest check_mode should work:
roles/Juniper.junos/library/juniper_junos_config.py:893: supports_check_mode=True
The only way i could get the same behavior as "real" check_mode is by doing this:
playbook_snipper_2.0.2_fake_check_mode.txt
With output:
TASK [Load the compiled configuration via "load replace"] *************************************************************
changed: [DEVICE] => {"changed": true, "failed": false, "file": "compiled/DEVICE/DEVICE.conf", "msg": "Configuration has been: opened, loaded, checked, diffed, closed."}