diff --git a/tasks/main.yml b/tasks/main.yml index b7877a3..64dd533 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -5,9 +5,11 @@ - name: Enable Postfix service: name=postfix state=started enabled=yes -- name: Backup configuration - shell: cp /etc/postfix/main.cf /etc/postfix/main.cf.{{ postfix_backup_multiple | ternary("`date -Iseconds`", "backup") }} - when: postfix_backup or postfix_backup_multiple +- name: Backup configuration using copy + copy: + remote_src: yes + src: /etc/postfix/main.cf + dest: /etc/postfix/main.cf.{{ postfix_backup_multiple | ternary( lookup('pipe','date -Iseconds') , "backup") }} - name: Add header 1 to configuration file lineinfile: