-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrong insertion of yml object #101
Comments
This is what you were looking for: - xml:
file: /tmp/test155.new.xml
xpath: /List
pretty_print: yes
add_children:
- Item:
_Id: id002
_:
- Label: Demo 2
- Active: "0" You can do it like this as an easier alternative: - xml:
file: /tmp/test155.new.xml
xpath: /List
input_type: xml
pretty_print: yes
add_children:
- "<Item id='id002'><Label>Demo 2</Label><Active>0</Active></Item>" If you are happy with the examples, please close this issue. |
The xml module is upstream now (and ships with Ansible v2.4). Please close this issue, and if needed, open a new issue at: https://github.com/ansible/ansible/issues |
Understood. Nice to see this module shipped within Ansible ! |
Hello, Would be nice to include this examples in the official module documentation shipped with ansible. I reached this solution because I have the same problem and the solution seems not to be documented. Thanks. |
@juanvalino If we would include all the examples, it's like looking for the needle in the haystack :-( If you look at the xml module integration tests, you can see what I mean. Feel free to propose a PR with the change to the documentation you would prefer. You can click on "Edit on GitHub" to edit the documentation and make a PR. Thanks in advance ! |
Hello, I am having troubles inserting a complete block in an xml file.
Let's consider I have this simplified XML :
I want to add another Item into it, as List child. So the XML should become :
So I used different web XML2YML services to convert the addtionnal XML block to a YML object, all of them giving me the same result.
My playbook task is therefore looking like this :
But the result is not the one expected :
When trying to insert a "bigger" object, with several childs an sub-childs, which is what I definitely need, I get this error :
TypeError: Argument must be string or unicode.
As the blocks I need to insert have several levels of subchilds, for around 20~30 lines, I would like to avoid using
add_children
each time to create each child one by one.The text was updated successfully, but these errors were encountered: