ansible-junos-stdlib icon indicating copy to clipboard operation
ansible-junos-stdlib copied to clipboard

Juniper_Junos_Config - Retrieve is not flagging a change as "true"

Open feene opened this issue 6 years ago • 5 comments

Issue Type

  • Bug Report

Module Name

juniper_junos_config:

Juniper.Junos role and Python libraries version

ansible 2.5.1
  config file = /home/*****/aja/ansible.cfg
  configured module search path = [u'/home/*******/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.15rc1 (default, Apr 15 2018, 21:51:34) [GCC 7.3.0]

ansible==2.5.1
apache-libcloud==2.2.1
asn1crypto==0.24.0
certifi==2018.1.18
chardet==3.0.4
cryptography==2.1.4
enum34==1.1.6
httplib2==0.9.2
idna==2.6
ipaddress==1.0.17
Jinja2==2.10
jmespath==0.9.3
junos-eznc==2.1.7
jxmlease==1.0.1
keyring==10.6.0
keyrings.alt==3.0
lockfile==0.12.2
lxml==4.2.1
MarkupSafe==1.0
ncclient==0.5.3
netaddr==0.7.19
paramiko==2.0.0
pyasn1==0.4.2
pycrypto==2.6.1
pygobject==3.26.1
pykerberos==1.1.14
pyOpenSSL==17.5.0
pyserial==3.4
pyxdg==0.25
PyYAML==3.12
requests==2.18.4
scp==0.11.0
SecretStorage==2.3.1
simplejson==3.13.2
six==1.11.0
urllib3==1.22
xmltodict==0.11.0

OS / Environment

vMX 17.3

Summary

Config Retrieve is does not appear to be comparing the current local file to the newly retrieved config. ok: [vmx2] => { "config_results": { "changed": false, Its always false even when a file does not exist.

Using Juniper's Ansible Day One as a guide. Pages 166.

Steps to reproduce

---
---
- name: Backup Device Config
  hosts:
    - all
  roles:
    - Juniper.junos
  connection: local
  gather_facts: no

  vars:
    temp_conf_file: "{{inventory_hostname}}.conf"
    conf_file: "{{ temp_conf_file }}_{{ hostvars.localhost.timestamp}}.conf"

  tasks:
    - name: save device configuration in temp file
      juniper_junos_config:
        retrieve: 'committed'
        host: "{{ ansible_host }}"
        dest: "{{ temp_conf_file }}"
        format: text
      register: config_results

    - debug: var=config_results

    - name: copy temp file to timestampd config file if different
      copy:
        src: "{{ temp_conf_file }}"
        dest: "{{ temp_conf_fie }}.changed"
      when: config_results.changed


Expected results

To have a Change in the file

Actual results

        "    name-server {", 
        "        5.7.11.11;", 
        "        5.7.11.12;", 
        "        5.7.11.13;", 

Config File Had different DNS Servers but still provided a "false" on changed.


feene avatar May 15 '18 20:05 feene

@feene Thanks for reporting. Will look into this.

vnitinv avatar May 16 '18 06:05 vnitinv

Has any progress been made on this? I am going through the day-one book and I am running into the same problem. config_results.changed is always False. Even if I manually change the configuration on the switch, or edit the previously saved config.

DCAuto avatar Aug 21 '18 14:08 DCAuto

Has any progress been made on this?

saiqard avatar Mar 27 '20 13:03 saiqard