ansible-network / resource_module_models Goto Github PK
View Code? Open in Web Editor NEWModels used for building and maintaining resource modules
License: GNU General Public License v3.0
Models used for building and maintaining resource modules
License: GNU General Public License v3.0
Could you please suggest, how do we support rpcs with input/output through NRMs ?
Can we define non-configurable attributes in the NRM model ?
if Yes, how do we achieve the same.
If No, is NRM scope is restricted only to configurable attributes ?
I was going to extend the config model for the Cisco IOS ios_static_routes model. I am following these instructions:
https://docs.ansible.com/ansible/latest/network/dev_guide/developing_resource_modules_network.html
However the resource module builder already fails with the existing model:
https://github.com/ansible-network/resource_module_models/blob/master/models/ios/static_route/ios_static_route.yaml
(venv) marehler@mac:~/github/resource_module_builder$ ansible-playbook -e rm_dest=~/Users/marehler/ansible_collections/Cisco/test \
-e structure=collection \
-e collection_org=cisco.ios \
-e collection_name=ios_static_routes \
-e model=~/Documents/Ansible/Modules/ios_static_routes/ios_static_route.yaml \
site.yml
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'
[DEPRECATION WARNING]: "include" is deprecated, use include_tasks/import_tasks instead. This feature will be removed in version 2.16. Deprecation
warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
PLAY [localhost] ************************************************************************************************************************************
TASK [init : Ensure 'rm_dest' variable is set (see README.md)] **************************************************************************************
ok: [localhost] => {
"changed": false
}
MSG:
All assertions passed
TASK [init : Ensure 'structure' variable is set and one of 'role' or 'collection' (see README.md)] **************************************************
ok: [localhost] => {
"changed": false
}
MSG:
All assertions passed
TASK [init : Ensure the 'model' variable is set] ****************************************************************************************************
ok: [localhost] => {
"changed": false
}
MSG:
All assertions passed
TASK [init : Include the model vars] ****************************************************************************************************************
fatal: [localhost]: FAILED! => {
"ansible_facts": {
"rm": {}
},
"ansible_included_var_files": [],
"changed": false,
"message": "We were unable to read either as JSON nor YAML, these are the errors we got from each:\nJSON: Expecting value: line 1 column 1 (char 0)\n\nSyntax Error while loading YAML.\n could not find expected ':'\n\nThe error appears to be in '/Users/marehler/Documents/Ansible/Modules/ios_static_routes/ios_static_route.yaml': line 4, 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 'metadata_version': '1.1',\n ^ here\nThis one looks easy to fix. It seems that there is a value started\nwith a quote, and the YAML parser is expecting to see the line ended\nwith the same kind of quote. For instance:\n\n when: \"ok\" in result.stdout\n\nCould be written as:\n\n when: '\"ok\" in result.stdout'\n\nOr equivalently:\n\n when: \"'ok' in result.stdout\"\n"
}
PLAY RECAP ******************************************************************************************************************************************
localhost : ok=3 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
Looking at some other Cisco IOS models, I recognized these have a different format and don't have the ANSIBLE_METADATA or DOCUMENTATION section. The resource module builder playbook fails for these models. Example:
<...>
TASK [init : Set the module documentation variable] *************************************************************************************************
fatal: [localhost]: FAILED! => {}
MSG:
The task includes an option with an undefined variable. The error was: 'dict object' has no attribute 'DOCUMENTATION'
The error appears to be in '/Users/marehler/github/resource_module_builder/roles/init/tasks/main.yml'
<...>
I am new to Ansible module development, kindly asking for clarification and help.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.