Open samccann opened 2 years ago
Not sure how we proceed with this, but I figured it was worth listing here to help us work out what comes next. Things that come to mind:
Here's the output just in case :
TASK [debug] **************************************************************************************************
ok: [localhost] =>
all:
- usr
- usr/local
- usr/local/bin
- usr/local/bin/opt
- usr/local/bin/opt/etc
- usr/local/bin/opt/etc/var
- usr/local/bin/opt/etc/var/tmp
- usr/local/bin/opt/etc/var/tmp/sbin
- usr/local/bin/opt/etc/var/tmp/sbin/lib
- usr/local/bin/opt/etc/var/tmp/sbin/lib/blah
- usr/local/bin/opt/etc/var/tmp/sbin/lib/blah/something
- usr/local/bin/opt/etc/var/tmp/sbin/lib/blah/something/else
PLAY RECAP ****************************************************************************************************
localhost : ok=3 changed=0 unreachable=0
failed=0 skipped=0 rescued=0 ignored=0
FWIW - bcoca had the following feedback on this example: FYI, looping over set_fact is not recommended unless you specifically want static values, using map/select/reject filters is recommended in these cases, with examples in the complex data manipulation page https://docs.ansible.com/ansible/latest/user_guide/complex_data_manipulation.html
And briantist had the following feedback: in addition to what bcoca added, was going to say that referencing a variable within a variable's "definition" only really works in set_fact (because of how it's implemented), and causes infinite recursion in most other places, which can be confusing.
This came from an email in the ansible-projects mailing list over the summer, authored by Dick Visser. @acozine suggested it might make a good example.
The original query was:
The proposed example solution: