Ansible + Cisco idempotence

亡梦爱人 提交于 2020-01-06 03:15:35

问题


So I'm doing some testing with Ansible to manage Cisco devices (specifically a 3750 in this case). I'm able to add my VLAN's and Loopbacks with no issue.

Just trying to get Ansible to stop registering a change in the task when the Loopback or VLAN exists.

Right now my play looks like this:

    - name: Set the IP for Loop 0
  ios_config:
    provider: "{{ connection }}"
    lines:
      - description AnsibleLoop0
      - ip address 8.8.8.8 255.255.255.0
    before:
      - interface Loopback0
    match: exact

Anytime this task is run, Ansible registers it like a change:

changed: [switch] => {"changed": true, "updates": ["interface Loopback0", "description AnsibleLoop0", "ip address 8.8.8.8 255.255.255.0"], "warnings": []}

I've tried different match types (line, exact) to no avail. Maybe I'm getting something wrong here.

I thought that if I had the play insert the lines exactly like how they would show up in a show run it wouldnt register it as a change?

Any help here would be appreciated!


回答1:


You could be experiencing this issue:

https://github.com/ansible/ansible/pull/24345

Are you saving the configuration changes each time to the Cisco device using save: "yes” in your playbook? I had the same problem and I was saving the config each time the playbook ran. Setting that to no just to test, after the first run reports changed=True sequential runs would report back changed=False by Ansible.



来源:https://stackoverflow.com/questions/45157181/ansible-cisco-idempotence

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!