Comments (9)
From reading the docs https://docs.ansible.com/ansible/latest/galaxy/user_guide.html#dependencies both methods
meta/main.yml
andmeta/requirements.yml
should work exactly the same. Where can I find information about the different behavior?
thats not correct, if you check a few paragraphs below (https://docs.ansible.com/ansible/latest/galaxy/user_guide.html#using-meta-main-yml), it states:
Dependencies installed that way, depending on other factors described below, will also be executed **before** this role is executed during play execution
whereas if you define dependency in meta/requirements.yml they are not executed automatically, just installed, so that they can be executed at a controlled point in the role.
the main difference here i think is meta/main.yml dependencies are an ansible-core feature:
https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_reuse_roles.html#using-role-dependencies
whereas the meta/requirements.yml is "just" instructions for ansible-galaxy to make sure those dependencies listed there are installed if the role is pulled in through a playbooks requirements.yml via ansible-galaxy.
and galaxy happens to also understand the ansible-core meta/main.yml dependencies to make sure those roles are installed aswell.
the differing part is probably that the requirements.yml is only parsed by galaxy and ansible itself has no idea about it or its contents
from ansible-doctor.
I'm a bit confused by what exactly you try to achieve.
i would try to create a custom template to get requirement roles documented in the readme.md aswell
ansible-doctor does not parse any requirements.yml file, It's intended to be used for roles or collections. According to the docs, both don't include requirements.yml files. To link and document dependencies of roles you can add it to the meta file as described in the ansible roles docs. Dependencies from the meta file will be detected and documented automatically.
another question revolves around dictionary variables, and how to properly get doctor to detect them and document them.
currently its just this
Not sure if I understand this question. The type of an Ansible variable doesn't matter for ansible-doctor
. It will detect the variable, document the default and all additional information added by annotations. It's not possible to add annotations or additional information to the keys of a dict variable. But you could add an example annotation:
# @var apache2_listen_ports:example: >
# apache2_listen_ports:
# # Description of the http key
# http: 80
# # Description of the https key
# https: 443
# @end
The result looks like this:
from ansible-doctor.
thank you for the answer, ansible-galaxy is picking up requirements.yml defined requirements from roles automatically and installs them aswell when you place a requirement.yml into the meta directory, its diffrent from dependencies since they are not rolled out automatically with that aproach, but can be delegated to within your roles flow of tasks with ansible.builtin.include_role:
.
that way you have more control over the roles and their execution.
for example i have an apache and a php role, the apache role has a variable that en- or disables the apache2_mod_php component, and also delegates further php setup to the php role if enabled, from within the apache role like so:
- name: ensure php is setup and installed as needed
ansible.builtin.include_role:
name: php
vars:
php_implementation:
apache: true
cli: false
fpm: false
for that to work i either need to put both roles into the requirements.yml of my playbooks, or, and that is what i am doing, put the php role into the requirements.yml of my apache role, and only tell my playbook it needs apache
from ansible-doctor.
for the variable section, i would love if it would be possible to have doctor resolve nested / sublayers of dictionary variables.
basically instead of detecting apache2_listen_ports
as the only var in that block maybe detect something like apache2_listen_ports.http
and apache2_listen_ports.https
in this case
from ansible-doctor.
From reading the docs https://docs.ansible.com/ansible/latest/galaxy/user_guide.html#dependencies both methods meta/main.yml
and meta/requirements.yml
should work exactly the same. Where can I find information about the different behavior?
from ansible-doctor.
for the variable section, i would love if it would be possible to have doctor resolve nested / sublayers of dictionary variables.
Sorry, this is IMO a bit out of scope.
from ansible-doctor.
Thanks for the details, I think I understand your use case. Would you like to contribute the meta/requirements.yml
parsing feature?
from ansible-doctor.
i am open to looking into contributing that feature, just gonna need some time to slice off my general schedules to poke around ;)
ill get back to you in the next 1-2 weeks i think :)
from ansible-doctor.
No worries 🙂 if you have any question just let me know.
from ansible-doctor.
Related Issues (20)
- Shareable templates
- recursive execution based on .ansibledoctor.yml HOT 2
- How to create tables? HOT 1
- Description uses a new line for each word character HOT 2
- Improve the CONTRIBUTING.md documentation HOT 1
- conflict between ansible-doctor and ansible-lint HOT 1
- Var options "type" and "deprecated" aren't available in standard template HOT 6
- Code blocks in Meta descriptions get modified HOT 3
- Can not open template dir HOT 3
- Support Ansible collections HOT 3
- Module tags are showing under Discoved tags in Readme.md file HOT 6
- Pre-commit hook is not working fine. HOT 4
- Ansible-doctor command is failing to generate README.md file in case of empty defaults folder in version 3.1.2
- Support current ansible versions HOT 1
- Make `ansible-core` optional dependency and use latest by default
- deprication of safe_load in ruamel-yaml HOT 3
- Configurable output file HOT 1
- Tag skipping not working
- List for tag description? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ansible-doctor.