Does anyone here a good tip for managing parts of xml files
(like lineinfile / blockinfile but xml-aware)?
I have several fairly complex apps to manage, each with their own role.
Ideally they'd each manage their own subset of the domain.xml,
which rules out a single domain.xml template.
My Plan B (make that 'H' by now) would be to have a master template
that pulled in 'sub-templates' via lookup_template() , but that sounds like
it'll get messy fast and involve hardcoding roles together.
Does everyone just template their XML? Are you crazy kids all using
YAML and JSON nowadays?
Dick - it is do-able. I have done this for the app servers in my current contract. I would have done it where you are now had there been sufficient interest, time or investment.
Firstly, start off with a set xml file for each type of application (messy but necessary)
Secondly, identify differences and use jinja2 to have blocks to manage those unique bits of the jb config so that you can eventually have 1 master xml file and then sub-xml (child) templates purely for the unique blocks.
However, you have to be very strict on future changes made to the domain.xml file via the cli or manual xml changes by admins. Your challenge will be to ensure all changes are pushed to you/other ansible-folk.
It works a treat, but considerable engineering/research/testing required.