How I have managed configurations depends on the changes that I've made...
I have replaced files wholesale with entire new files in some cases,
sometimes using templates, sometimes not...
I have used "lineinfile" to edit configuration files when that approach
seemed more useful.
In some cases I've used modules that can talk to the service/file I needed
(crontab for example).
If I had to deal with a system that provided certain commands to manage the
configuration then I would consider writing a module for that particular
utility (look someone else might have already done that for you).
If it was only a single change then I would probably just use command to
insert the one change I needed...
In your case you could possibly use command (or shell) and with_items to
repetitively make changes based on a list you keep of the changes that you
want made... It looks like nsupdate takes input on standard in, or from
files, so you either create a file consisting of a sequence of lines and
then run that through nsupdate or use shell
- name: Update the named service
shell: echo {{ item.command }} | nsupdate
with_items: nsupdatecommands
and in your variables file something like this
nsupdatecommands:
- { command: 'update 1',
comment: 'This does something' }
- { command: 'update 2',
comment: 'This does something else' }
In this case the item.comment isn't actually used, it's there to make it
easier to annotate the list of commands... If you don't want it then you
can get rid of that. If you wanted more sub elements you could add them...
Of course, that's just me, but that gives you a fairly compact task and a
list of arguments that make the actual changes.
If you were to later write an nsupdate module then you could (with minor
formatting changes probably) keep the same command list and pass that into
the nsupdate module...
Adam
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.