diff --git a/defaults/main.yml b/defaults/main.yml index cc9a5d7..230f2c7 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -33,6 +33,8 @@ ckan_dcat_name: 'dcat dcat_json_interface' # Set this to true to install a cron job that regularly runs the harvesters ckan_harvester_run: False +ckan_harvester_cron_min: 0 +ckan_harvester_cron_hour: '*' ckan_pdfview: False ckan_ckanext_pdfview_url: ckanext-pdfview ckan_privatedatasets: False diff --git a/tasks/supervisor.yml b/tasks/supervisor.yml index d40b3db..367dc4c 100644 --- a/tasks/supervisor.yml +++ b/tasks/supervisor.yml @@ -8,8 +8,26 @@ 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=ckanext-harvest harvester run --config={{ 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 - cron: name="CKAN harvester" minute="0" job="{{ ckan_virtenv }}/bin/paster --plugin=ckanext-harvest harvester run --config={{ ckan_config_file }} > {{ ckan_logdir }}/harvester_run.log 2>&1" user={{ ckan_shell_user }} + ansible.builtin.cron: + name: "CKAN harvester" + minute: "{{ ckan_harvester_cron_min }}" + hour: "{{ ckan_harvester_cron_hour }}" + job: "{{ ckan_virtenv }}/bin/paster --plugin=ckanext-harvest harvester run --config={{ 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' ]