ansible-network/cisco_nxos

config_manager/load - nxos_config_checkpoint_filename is not defined

jacobsnapp opened this issue · 0 comments

Summary

The required fact nxos_config_checkpoint_filename is not defined.

The following code block expects nxos_config_checkpoint_filename to be defined.
https://github.com/ansible-network/cisco_nxos/blob/devel/includes/checkpoint/create.yaml#L13-L16

The nxos_checkpoint_filename fact is defined code block - but not reused in this repository.
https://github.com/ansible-network/cisco_nxos/blob/devel/tasks/config_manager/load.yaml#L49-L56

ERROR

TASK [ansible-network.cisco_nxos : remove old checkpoint file from device] ******************************************************************************************************************

task path: /home/vagrant/.ansible/roles/ansible-network.cisco_nxos/includes/checkpoint/create.yaml:13

fatal: [REDACTED]: FAILED! => {
    "msg": "The conditional check 'nxos_config_checkpoint_filename in nxos_dir_listing.stdout' failed. The error was: error while evaluating conditional (nxos_config_checkpoint_filename in nxos_dir_listing.stdout): Unable to look up a name or access an attribute in template string ({% if nxos_config_checkpoint_filename in nxos_dir_listing.stdout %} True {% else %} False {% endif %}).\nMake sure your variable name does not contain invalid characters like '-': coercing to Unicode: need string or buffer, AnsibleUndefined found\n\nThe error appears to be in '/home/vagrant/.ansible/roles/ansible-network.cisco_nxos/includes/checkpoint/create.yaml': line 13, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: remove old checkpoint file from device\n  ^ here\n"
}

FIX

The fix is to define nxos_config_checkpoint_filename when passing to the role but it would be nice if it handled by the role.

- name: test
  vars:
    function: config_manager/load
    config_manager_text: show version
    nxos_config_checkpoint_filename: chk_ansible
  import_role:
    name: ansible-network.cisco_nxos