Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
ansible generate staggered number (something like puppet's fqdn_rand)
- name: get staggered minute for cronjob
shell: expr $((16#`echo "{{inventory_hostname}}" | md5sum | cut -c -4`)) % 30
args:
executable: /bin/bash
register: cron_staggered_minute
changed_when: false
always_run: yes
- name: cronjob
cron:
name: "job1"
user: root
job: "/usr/local/bin/job1"
hour: "0"
minute: "{{ cronjob_staggered_minute.stdout }}"
state: present
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.