-
Notifications
You must be signed in to change notification settings - Fork 49
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
dellos10_config does not process jinja2 templates from "src" #98
Comments
Im having the same issue here |
same issue, was working with the old ansible.builtin.dellos10 |
Could you please check if this helps?
between, is the roles working fine? |
No, sorry, I get the same error. |
same result for me. fatal: [PLAT-SW-1]: FAILED! => {"changed": false, "command": "templates/plat_system.j2", "msg": "plat_system.j2\r\n% Error: Unrecognized command.\r\n\u0007PLAT-SW-1(config)# ", "rc": -32603} roles (dellemc.os10.os10_system in this case) work fine though. |
@zordanda Could you please paste your directory structure? |
just some additional info, i have a role that extends the functionalities of dellemc.os10.os10_system. this is the structure of the role dir:
the directory where the playbook is located contains
|
@zordanda if you are creating a new role, then your playbook should look like this,
Roles: mysystemrole/tasks/main.yaml file should look as below, no need to mention, templates/plat_system.j2
if this doesn't work, if possible please share your code repo |
That exactly how my playbook looks like. And I removed the "templates/" part of the path from src in mysystemrole/tasks/main.yaml but I still get the same error. |
I tried copying the dellemc.os10.os10_system role from ~/.ansible/collections/ansible_collections/dellemc/os10/roles/os10_system to .ansible/roles/mysystem and using the original role in the playbook works, while using the renamed one does not. |
@zordanda I think we are missing the meta/main.yaml file |
Same when using the os10_config module directly in the playbook, with the template in the same folder as the playbook. playbook:
output:
however, it works if I include the "collections" in the playbook as follows:
output:
|
@zordanda We need to create a directory like this. not sure whether this help or not. https://github.com/ansible-collections/dellemc.os10/tree/master/roles/os10_system/meta |
I tried playing around with the different hints from this thread and can tell now that it works with the template when I set the "collections" and use the short name for the task like this: ---
- hosts: dellos10
gather_facts: False
connection: network_cli
collections:
- dellemc.os10
tasks:
- os10_config:
src: vlan.j2
tags:
- never
- os10_config Using the full path module name "dellemc.os10.os10_config" for the task breaks running the jinja template. |
@cultcom yes, that is also what I observed. @javeedf You are right, adding a meta/main.yaml file into the role folder with content: ---
collections:
- dellemc.os10 and then using the module with just os10_config in the task/main.yaml of the role (not the full dellemc.os10.os10_config) solved the problem. Thank you everyone for your help!!! |
if we are good, shall we close this issue? |
Well, to me it sounds more like a workaround than a solution? |
This is a documented way to use collections in playbooks and roles, as I just found out. However, It is true that it should be possible to use the FQCN. |
I am having the same problem using Ansible tower.
The roles are under playbooks/collections/ansible-collections/dellemc/os10/roles I have been debugging all day and can not get the "src" field to be evaluated other than literally in the os10_config part of these roles. There is another part in these roles, that is optional, that generate from the same jinja2 template using the "template" module and that works. But when it comes to os10_config it does not work. I am running out of ideas of what this can be. Any ideas? @javeedf I also defined collections in playbook and meta main.yaml
|
Hello everyone, I've been bitten by the same problem and done some research, here are my findings for everyone that came so far as to find this issue. As far as I can tell, it is related to this module using common networking code from ansible.netcommon. The But as far as I can tell the current version of It seems to me that For those writing their own roles it should probably be enough to use |
Well if that were true @lesinigo then why did @zorlanda and @cultcom get it to work?
Not a python expert but this method at least load a file. Not sure how that will work with a jinja2 template. As of now though none of the os10 config based roles work since they all seem to use a jinja2 template. |
I had the same question in mind and sincerely don't know the answer... my first thought was that I'm actually more concerned with the future of this code rather than the past because I have to decide what solution to adopt to manage some specific aspects of a OS10 deployment (the addition and removal of VLANs from some ports on systems that are also moving production traffic).
As far as I can tell from a quick look that's correct: |
@prasadapr can you take a look on that issue too? |
SUMMARY
I try to configure a switch with a given template and all what is sent to the switch is the literal name of the file pointed to as "src".
ISSUE TYPE
COMPONENT NAME
https://github.com/ansible-collections/dellemc.os10/blame/master/plugins/modules/os10_config.py#L221
ANSIBLE VERSION
COLLECTION VERSION
CONFIGURATION
OS / ENVIRONMENT
Controller:
No LSB modules are available.
Distributor ID: Linuxmint
Description: Linux Mint 20.2
Release: 20.2
Codename: uma
Switch:
Dell EMC Networking OS10 Enterprise
Copyright (c) 1999-2021 by Dell Inc. All Rights Reserved.
OS Version: 10.5.2.7
Build Version: 10.5.2.7.374
Build Time: 2021-07-28T04:48:16+0000
System Type: S5248F-ON
Architecture: x86_64
Up Time: 4 days 02:00:54
STEPS TO REPRODUCE
EXPECTED RESULTS
I expect the jinja2 template to be evaluated and sent as commands to the switch.
ACTUAL RESULTS
The literal filename configured as "src" is sent as a command to the switch.
The text was updated successfully, but these errors were encountered: