Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iosxr_config Loop path not found #14

Open
sean-m-sullivan opened this issue Apr 27, 2020 · 1 comment
Open

iosxr_config Loop path not found #14

sean-m-sullivan opened this issue Apr 27, 2020 · 1 comment
Assignees
Milestone

Comments

@sean-m-sullivan
Copy link
Contributor

sean-m-sullivan commented Apr 27, 2020

SUMMARY

when looping on ioxr_config using the until loop, it does not reuse the template, complains that the path to the file is not found.

This is supposed to loop through on the device until it is unlocked if it is temporarily locked by another user/task. Testing done while turning the lock on, while task runs and the releasing the lock.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

iosxr_config

ANSIBLE VERSION
ansible 2.9.6
  config file = /home/ssulliva/ansible.cfg
  configured module search path = [u'/home/ssulliva/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.5 (default, Sep 26 2019, 13:23:47) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]
CONFIGURATION
Standard
OS / ENVIRONMENT

Tower 3.6.3 also tested cli with same version of ansible
Red Hat Enterprise Linux Server release 7.7 (Maipo)

STEPS TO REPRODUCE

use this template and commands to apply template to the router.

Template
{% for ntp in ntp_desired_state -%}
{{ ntp }}
{% endfor -%}
{% for no_ntp in ntp_to_delete -%}
no {{ no_ntp }}
{% endfor -%}

- name: Adjust NTP server
  iosxr_config:
    src: ../templates/ntp.j2
    comment: "Tower {{ tower_job_template_name }} Job {{ tower_job_id }}" # 60 caracter limitation on Cisco Side
    label: "Tower_JobID_{{ tower_job_id }}" # 30 caracter limitation on Cisco Side
  ignore_errors: yes
  register: ntp_adjust
  until: ntp_adjust is success
  retries: 10
  delay: 10
EXPECTED RESULTS

Slightly altered results, used lines instead of the config file. However expect similar results back when run

{
    "commands": [
        "ntp server vrf management 172.16.11.57"
    ],
    "_ansible_no_log": false,
    "changed": true,
    "attempts": 1,
    "invocation": {
        "module_args": {
            "comment": "Tower Basic Config on Tors Job 49239",
            "exclusive": false,
            "backup_options": null,
            "force": false,
            "after": null,
            "replace": "line",
            "host": null,
            "password": null,
            "port": null,
            "before": null,
            "src": null,
            "ssh_keyfile": null,
            "admin": false,
            "backup": false,
            "lines": [
                "ntp server vrf management 172.16.11.58",
                "ntp server vrf management 172.16.11.57",
                "\n"
            ],
            "label": "Tower_JobID_49239",
            "username": null,
            "parents": null,
            "timeout": null,
            "provider": null,
            "config": null,
            "match": "line"
        }
    },
    "diff": {
        "prepared": "Building configuration...\n!! IOS XR Configuration version = 6.3.2\n   ntp\n+   server vrf management 172.16.11.57\n   !\nend"
    }
}
ACTUAL RESULTS

Module cannot find path after first attempt

{
    "retries": 4,
    "attempts": 2,
    "_ansible_no_log": false,
    "msg": "path specified in src not found",
    "changed": false
}
@metabsd
Copy link

metabsd commented Apr 27, 2020

A dirty way to workaround this

- name: Adjust NTP server
  iosxr_config:
    lines: >
      {%- for ntp in ntp_desired_state -%}
        {{ ntp }},
      {%- endfor -%}
      {%- for no_ntp in ntp_to_delete -%}
        no {{ no_ntp }},
      {%- endfor -%}

@rohitthakur2590 rohitthakur2590 self-assigned this Apr 28, 2020
@Qalthos Qalthos added this to the February'21 milestone Jan 13, 2021
@Ruchip16 Ruchip16 assigned Ruchip16 and unassigned rohitthakur2590 Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants