From bab7acb1adc823f3918d648c1a76fb163378c532 Mon Sep 17 00:00:00 2001 From: Sloane Hertel <19572925+s-hertel@users.noreply.github.com> Date: Thu, 13 May 2021 16:58:46 -0400 Subject: [PATCH] update cron test added in #74497 for /etc/crontab (#74689) --- test/integration/targets/cron/tasks/main.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/test/integration/targets/cron/tasks/main.yml b/test/integration/targets/cron/tasks/main.yml index 406d257caaa..32e345d32ce 100644 --- a/test/integration/targets/cron/tasks/main.yml +++ b/test/integration/targets/cron/tasks/main.yml @@ -215,7 +215,24 @@ - assert: that: not cron_file_stats.stat.exists +- name: System cron tab can not be managed + when: ansible_distribution != 'Alpine' + block: + - name: Add cron job + cron: + cron_file: "{{ system_crontab }}" + user: root + name: "integration test cron" + job: 'ls' + ignore_errors: yes + register: result + + - assert: + that: "result.msg == 'Will not manage /etc/crontab via cron_file, see documentation.'" + +# TODO: restrict other root crontab locations - name: System cron tab does not get removed + when: ansible_distribution == 'Alpine' block: - name: Add cron job cron: