I've got a playbook for preparing new Drupal websites. It doesn't
itself go through the full installation (which is interactive), but
preps what is needed to complete the installation - installing drupal
code, setting up Apache2, creating database user and the database
itself, etc.
One of the things I'm doing is prepping a cron job that can be completed
and enabled after the manual part of the configuration is done. I'm
doing this:
- name: Create cron job
cron:
name: Drupal cron job
disabled: true
minute: "*/15"
job: curl --silent --compressed url
user: "{{ username }}"
The idea is that the 'url' in the job will be manually replaced by the
required url (obtainable from the Drupal Status Report screen, and
containing many, many random characters), and enabled.
Of course, if I run this playbook again, the job is going to be changed
back to 'curl --silent --compressed url', and of course, I don't want
that, but I do want to be able to re-run this playbook against a site,
to apply appropriate changes.
The cron module, unlike some other Ansible modules, doesn't seem to have
a way to say "Don't replace this cron job if it is already in the
crontab, even if it's changed" (as opposed to, say, template, which has
a 'force: no' which will keep you from overwriting an already existing
file). Having the name parameter will keep it from adding multiple
copies of a cron job, but it doesn't prevent a modified version from
being overwritten.
Am I missing something? Is there a not-too-hacky way to do what I want
to do here?
Ben