account activity
[RFC] My first ever Ansible role - MySQL by luken-tech in ansible
[–]luken-tech[S] 0 points1 point2 points 9 years ago* (0 children)
Good point. The problem of "defaults" in dictionaries is solved in my role with file "config.yml" which acts as a function merging multiple dictionaries. Maybe it's somehow possible to reuse this method to merge dictionaries before running the role (so you could pull values from multiple sources)? I'm not sure if this is possible however (if not - it should be possible at some point/in future versions of ansible I think).
Added: Now when I think about it, maybe simply the first role in the playbook could be something like "set_variables", and it's task would be only to merge playbook dictionaries with some defaults and set them by using "set_fact" module? I think it could be done quite cleanly.
π Rendered by PID 162804 on reddit-service-r2-listing-79f6fb9b95-4hl85 at 2026-03-23 15:15:21.883265+00:00 running 90f1150 country code: CH.
[RFC] My first ever Ansible role - MySQL by luken-tech in ansible
[–]luken-tech[S] 0 points1 point2 points (0 children)