weareinteractive.cron
is an Ansible role which:
- installs cron
- adds cron tasks
- configures service
Note:
Since Ansible Galaxy supports organization now, this role has moved from
franklinkim.cron
toweareinteractive.cron
!
Using ansible-galaxy
:
$ ansible-galaxy install weareinteractive.cron
Using requirements.yml
:
- src: weareinteractive.cron
Using git
:
$ git clone https://github.com/weareinteractive/ansible-cron.git weareinteractive.cron
- Ansible >= 2.0
Here is a list of all the default variables for this role, which are also available in defaults/main.yml
.
---
# cron_tasks:
# - name: ...
# cron_file: ...
# day: ...
# hour: ...
# job: ...
# minute: ...
# month: ...
# special_time: ...
# state: ...
# user: ...
# weekday: ...
#
# list of cron entries (@see http://docs.ansible.com/cron_module.html)
cron_tasks: []
# start on boot
cron_service_enabled: yes
# current state: started, stopped
cron_service_state: started
#
# refer to the `cronvar Ansible module documentation <https://docs.ansible.com/ansible/cronvar_module.html>`_ for details.
#
# cron_vars:
# - name: 'PATH'
# value: '/usr/bin:/bin:/usr/local/bin'
# user: 'root'
#
cron_vars: []
These are the handlers that are defined in handlers/main.yml
.
---
# For more information about handlers see:
# http://www.ansibleworks.com/docs/playbooks.html#handlers-running-operations-on-change
#
- name: restart cron
service:
name: "{{ cron_service_name }}"
state: restarted
when: cron_service_state != 'stopped'
This is an example playbook:
---
- hosts: all
become: yes
roles:
- weareinteractive.cron
vars:
cron_tasks:
- name: checking dirs
special_time: daily
job: "ls -alh > /dev/null"
$ git clone https://github.com/weareinteractive/ansible-cron.git
$ cd ansible-cron
$ make test
In lieu of a formal style guide, take care to maintain the existing coding style. Add unit tests and examples for any new or changed functionality.
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
Note: To update the README.md
file please install and run ansible-role
:
$ gem install ansible-role
$ ansible-role docgen
Copyright (c) We Are Interactive under the MIT license.