ansible-role-ckan/tasks/supervisor.yml

37 lines
1.6 KiB
YAML

---
- name: Install the supervisor daemon needed to automate the gather and fetch operations
apt: pkg={{ ckan_gather_fetch_pkgs }} state=present
tags: [ 'ckan', 'ckan_harvest' ]
- name: Install the gather and fetch supervisor configuration
template: src=ckan_harvesting.conf.j2 dest=/etc/supervisor/conf.d/ckan_harvesting.conf owner=root group=root mode=0644
notify: Reconfigure the supervisor daemon
tags: [ 'ckan', 'ckan_harvest' ]
- name: Remove the old harvester cron job
ansible.builtin.cron:
name: "CKAN harvester"
minute: "{{ ckan_harvester_cron_min }}"
job: "{{ ckan_virtenv }}/bin/paster --plugin{% raw %}={% endraw %}ckanext-harvest harvester run --config{% raw %}={% endraw %}{{ ckan_config_file }} > {{ ckan_logdir }}/harvester_run.log 2>&1"
user: "{{ ckan_shell_user }}"
state: absent
when: ckan_harvester_run
tags: [ 'ckan', 'ckan_harvest', 'ckan_harvest_cron' ]
- name: Install a cron job that run the harvesters
ansible.builtin.cron:
name: "CKAN harvester"
minute: "{{ ckan_harvester_cron_min }}"
hour: "{{ ckan_harvester_cron_hour }}"
job: "{{ ckan_virtenv }}/bin/paster --plugi{% raw %}n={% endraw %}ckanext-harvest harvester run --config{% raw %}={% endraw %}{{ ckan_config_file }} > {{ ckan_logdir }}/harvester_run.log 2>&1"
user: "{{ ckan_shell_user }}"
state: present
disabled: no
cron_file: ckan_harvesters
when: ckan_harvester_run
tags: [ 'ckan', 'ckan_harvest', 'ckan_harvest_cron' ]
- name: Ensure that supervisord is running and enabled
service: name=supervisor state=started enabled=yes
tags: [ 'ckan', 'ckan_harvest' ]