Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Fix for with_ini when used with YAML parameters. #49481
Lookup ini is not working with current example in Ansible documentation.
Create a playbook test.yml with the following content:
- name: "test" hosts: localhost gather_facts: no tasks: - name: "Test ini lookup" debug: var=item with_ini: - .* - section: section1 - file: test.ini - re: true
You will need a file test.ini with the following content:
[section1] a=1 b=2 [section2] a=1 b=2 c=3
Launch this playbook (ansible-playbook test.yml).
What you get:
Thus this example was removed.
Dec 4, 2018
Yeah, it looks like the documentation is what's wrong. The params should be passed in the first term. More like this:
The documentation is what needs changing here, not code.
Your example will work like this:
The documentation should be updated with this form replacing the current format.
This lookup module has existed with its form of parameter parsing since Ansible-2.0. The incorrect documentation wsa only added last year. So changing the argument passing to match the incorrect documentation will break existing playbooks. If we were willing to break playbooks, we would convert the arguments to the new standard for passing arguments to lookup plugins rather than to the incorrect documentation:
This was referenced
Dec 5, 2018
@abadger You are right. I have added your sample to documentation. However, this patch fixes another example
which is 100%. Since ansible is flexible and community driven I believe all possible language constructions should work identically. Also this patch fixes unit tests/pep8 styling issues as well as closes this issue #34315