Comments (12)
Files identified in the description:
None
If these files are incorrect, please update the component name
section of the description or use the component bot command.
from ansible.
you have extra vars already to cover that scope
from ansible.
I thought I mentioned extra vars or perhaps I don't understand. I'm looking at this from the perspective of a collection author.
IIUC extra vars:
- Can't have a common default from a collection author
- Can't be dynamic unless the user invoking ansible calls a script
from ansible.
Extra vars can have a common default, either provided in the extra vars or in the playbook (just need to use the Jinja2 default
filter).
They also can be dynamic, for example, the extra vars could use lookup
plugins.
from ansible.
Closing as per above.
If you have further questions please stop by IRC or the mailing list:
- IRC: #ansible on irc.libera.chat
- mailing list: https://groups.google.com/forum/#!forum/ansible-project
See this page for a complete and up to date list of communication channels and their purposes:
from ansible.
Extra vars can have a common default, either provided in the extra vars or in the playbook (just need to use the Jinja2
default
filter).They also can be dynamic, for example, the extra vars could use
lookup
plugins.
extra vars are not provided by a collection author.
jinja2 default means repeating yourself frequently and not having a reasonable point to document vars
from ansible.
They also can be dynamic, for example, the extra vars could use
lookup
plugins.
Yes, I can write custom lookup plugins - that's what I'm doing for now.
from ansible.
It will probably be easier for playbooks to take variables once they can document it https://github.com/ansible/ansible/projects/48#card-90150512, but there isn't anything stopping a collection from using vars for these fields or providing a file to override the defaults optionally.
It could depend on the playbook/author. Sometimes strategy is hardcoded because the play isn't compatible with all options, and so overrides the strategy config value. It might not occur to me to use a variable with default for hosts
, because hardcoding a group name doesn't prevent configuration via inventory/--limit.
If you just want to use playbooks/vars/global.yml
as an extra vars file, no lookup is needed:
ansible-playbook ns.col.playbook -e @/path/to/playbooks/vars/global.yml
from ansible.
That's mostly from the perspective of a user, not a collection author.
There are things I can't offer in a role that I can do with a playbook, but the user experience will be worse than it was with the role.
from ansible.
like role vars? I'm not sure your use case is not covered, specially because you are very vague about it. There are many ways to supply variables already and you have not shown an example of something that would require a new method.
from ansible.
An example of what I'm working on is improving / replacing this hack to do graceful, rolling Kubernetes cluster node restarts:
lablabs/ansible-role-rke2/blob/main/tasks/main.yml#L70-L77. I'm not the original author, I believe this hack pattern came from an issue in here.
The include_tasks hack is very limited, a performance concern and spams the logs. There are also multiple scenarios for this (config change, software change, kernel change + reboot).
In a large cluster, different serial
patterns with a sane default (based on an arbitrary, configurable set of groups) would be ideal. For now, I'm using a lookup plugin for this - this could be optionally configured with extra vars, I just didn't find it as familiar and self-documenting as a vars / defaults file.
from ansible.
i'm not sure i understand the task, but it seems extremely contrived:
- name: Rolling restart when config files change
ansible.builtin.include_tasks: change_config.yml
with_items: "{{ groups[rke2_cluster_group_name] }}"
loop_control:
loop_var: _host_item
when:
- hostvars[_host_item].inventory_hostname == inventory_hostname
- rke2_restart_needed
Can just be rewritten as:
- name: Rolling restart when config files change
ansible.builtin.include_tasks: change_config.yml
when:
- rke2_cluster_group_name in group_names
- rke2_restart_needed
vars:
_host_item: '{{inventory_hostname}}'
I still don't see the issue with needing external/extra vars nor how 'serial' comes into play or anything else you mention as a reason for the new feature you espouse.
In any case I would suggest that you pose your specific problems in the forums/mailing lists/irc and then return here when there are no solutions to it using existing systems. This is not a good place to go back and forth on these kind of issues.
from ansible.
Related Issues (20)
- set_fact module does not substitute the first {{ itemย }} from the loop when appending to the same fact HOT 3
- Until not working with include _tasks and block HOT 2
- Ansible fails to override modules with the same name in different roles HOT 4
- Anisble fails for retires which is more than a minutes for windows server HOT 3
- ansible.builtin.systemd_service throws false warning about mount unit being an init script and triggers changed even when unit is already enabled HOT 3
- yaml tags for controlling variable merge behavior HOT 5
- Ansible does not respect ansible_connection: local in inventory file HOT 3
- request for additional 8.X version HOT 1
- local_action does not delegate to controller when remote is localhost HOT 5
- using "export ANSIBLE_INVENTORY" breaks command escalation HOT 5
- win_dns_client should support DNS suffix HOT 2
- Not quite correct output of ipsubnet HOT 3
- Unexpected behavior with handlers in loops HOT 2
- vmware_host ssl thumbprint HOT 1
- local documentation builds stopped working with F40 and antsibull-core HOT 7
- unable to set terminal parameters HOT 1
- Append list element works different between core 2.11.12 and 2.14.14 HOT 5
- Allow unarchive command to skip listing archive content / Allow user to provide tool as a parameter HOT 5
- Specify that .ini files in inventories defined as directories do not work by default HOT 1
- Add setting to fail on missing/empty role HOT 4
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.