I have an ansible playbook in which I try to add xml elements to an xml file (tomcat-users.xml) as follows
- name: Update Scheme Option in tomcat-users.xml add role user elements
become: yes
become_user: tomcat
xml:
file: /opt/tomcat8/conf/tomcat-users.xml
xpath: /tomcat-users
pretty_print: true
add_children:
- role:
rolename: "manager-gui"
- user:
username: "tomcat"
password: "tomcat"
roles: "manager-gui"
When I run the playbook, it finishes indicating OK for the step but when I check/Open the xml file, nothing has been added.
Is there any somthing wrong with the syntax? Thanks
Thanks but still on my side is not going through, I created a yml file where only there is the code above, ran the ansible-playbook with "-vvv", I get OK but in the details it seems that it has changed nothing
ok: [192.168.1.41] => {
"actions": {
"namespaces": {},
"state": "present",
"xpath": "/tomcat-users"
},
"changed": false,
"invocation": {
"module_args": {
"add_children": [
{
"role": {
"rolename": "manager-gui"
}
},
{
"user": {
"password": "tomcat",
"roles": "manager-gui",
"username": "tomcat"
}
}
],
"attribute": null,
"backup": false,
"content": null,
"count": false,
"file": "/opt/tomcat8/conf/tomcat-users.xml",
"input_type": "yaml",
"insertafter": false,
"insertbefore": false,
"namespaces": {},
"path": "/opt/tomcat8/conf/tomcat-users.xml",
"pretty_print": true,
"print_match": false,
"set_children": null,
"state": "present",
"strip_cdata_tags": false,
"value": null,
"xmlstring": null,
"xpath": "/tomcat-users"
}
}
}