Skip to content
This repository was archived by the owner on Oct 8, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions roles/cron/cron_drupal7/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ drupal:
# If defer is set to true, the Ansible target must be declared with defer_target. If using a group, include the index. For example, _ce_www_dev[0]
defer_target: ""
drush_location: "{{ drush_bin }}" # you might specify another location, e.g. "{{ deploy_path }}/vendor/bin/drush"
cron_error_filter: "> /tmp/cron_output.txt 2>&1; rc=$?; if [ $rc -ne 0 ]; then mail -s \"Cron Error - $(hostname)\" sysadm@codeenigma.com < /tmp/cron_output.txt; elif grep -iE \"(error|fail|fatal|critical|exception)\" /tmp/cron_output.txt | grep -v -E '(\"rc\": -13|MODULE FAILURE)' | grep -q .; then mail -s \"Cron Error - $(hostname)\" sysadm@codeenigma.com < /tmp/cron_output.txt; fi"
cron_error_email: "{% if entry.cron_error_mailto is defined %}; if [ $rc -ne 0 ] || grep -iE \"(error|fail|fatal|critical|exception)\" /tmp/cron_output.txt | grep -v -E '(\"rc\": -13|MODULE FAILURE)' | grep -q .; then echo 'Command failed' | mail -s 'Cron Error - {{ inventory_hostname }}' {{ entry.cron_error_mailto }}; fi{% endif %}"
python_interpreter: "-e 'ansible_python_interpreter=/home/controller/ce-python/bin/python'"
10 changes: 7 additions & 3 deletions roles/cron/cron_drupal8/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,16 @@ drupal:
# month:
job: cron
# disabled: true
# mailto: "{{ drupal.cron_mailto | default('') }}" # Each cron can have it's own mailto and can be configured to use different e-mail addresses.
# file: "/etc/cron.d/{{ project_name }}_{{ build_type }}_job_name" # edit job_name and uncomment to create a file for cron - note, deploy user needs to be able to write to the location
# file_user: "{{ deploy_user }}" # if you drop a file you must also supply an owner, usually the deploy user - make sure the deploy user has perms!
# mailto: "{{ drupal.cron_mailto | default('') }}"
# file: "/etc/cron.d/{{ project_name }}_{{ build_type }}_job_name"
# file_user: "{{ deploy_user }}"

cron_mailto: ""
# If the sites are being deployed to an ASG, setting defer to true will create the crontab entry on the deploy server rather than all of the app servers.
defer: false
# If defer is set to true, the Ansible target must be declared with defer_target. If using a group, include the index. For example, _ce_www_dev[0]
defer_target: ""
drush_location: "{{ drush_bin }}" # you might specify another location, e.g. "{{ deploy_path }}/vendor/bin/drush"
cron_error_filter: "> /tmp/cron_output.txt 2>&1; rc=$?; if [ $rc -ne 0 ]; then mail -s \"Cron Error - $(hostname)\" sysadm@codeenigma.com < /tmp/cron_output.txt; elif grep -iE \"(error|fail|fatal|critical|exception)\" /tmp/cron_output.txt | grep -v -E '(\"rc\": -13|MODULE FAILURE)' | grep -q .; then mail -s \"Cron Error - $(hostname)\" sysadm@codeenigma.com < /tmp/cron_output.txt; fi"
cron_error_email: "{% if entry.cron_error_mailto is defined %}; if [ $rc -ne 0 ] || grep -iE \"(error|fail|fatal|critical|exception)\" /tmp/cron_output.txt | grep -v -E '(\"rc\": -13|MODULE FAILURE)' | grep -q .; then echo 'Command failed' | mail -s 'Cron Error - {{ inventory_hostname }}' {{ entry.cron_error_mailto }}; fi{% endif %}"
python_interpreter: "-e 'ansible_python_interpreter=/home/controller/ce-python/bin/python'"
2 changes: 1 addition & 1 deletion roles/cron/cron_drupal8/tasks/job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

- name: Define cron job command if deferred (ASG).
ansible.builtin.set_fact:
_cron_job_command: "cd {{ _ce_deploy_base_dir }} && {{ _ce_deploy_ansible_location }} {{ drupal.defer_target }} -m shell -a \"{{ _cron_job_command }}\" > /dev/null"
_cron_job_command: "cd {{ _ce_deploy_base_dir }} && {{ _ce_deploy_ansible_location }} {{ drupal.defer_target }} {{ drupal.python_interpreter }} -m shell -a '{{ _cron_job_command }} {{ drupal.cron_error_filter }} {{ drupal.cron_error_email | default('') }}'"
when:
- drupal.defer is defined
- drupal.defer
Expand Down