diff --git a/tasks/main.yml b/tasks/main.yml index 2b1fd56..57002f4 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -106,13 +106,12 @@ when: __postfix_has_config_changed | d("") is search("True") block: - name: Backup configuration - shell: >- - set -euo pipefail; - cp /etc/postfix/main.cf - /etc/postfix/main.cf.{{ postfix_backup_multiple | - ternary("$(date -Iseconds)", "backup") }} + copy: + remote_src: yes + src: /etc/postfix/main.cf + dest: /etc/postfix/main.cf.{{ postfix_backup_multiple | + ternary(lookup('pipe', 'date -Iseconds'), "backup") }} when: postfix_backup or postfix_backup_multiple - changed_when: true - name: Ensure Last modified header is absent lineinfile: