diff --git a/roles/users/tasks/main.yml b/roles/users/tasks/main.yml index 38349e8..48c5ad0 100644 --- a/roles/users/tasks/main.yml +++ b/roles/users/tasks/main.yml @@ -39,3 +39,13 @@ append: yes when: item.sudo == true with_items: "{{ users }}" + +- name: Set system email alias + lineinfile: + path: /etc/aliases + state: present + regexp: "^{{ item.logname }}:" + line: "{{ item.logname }}: {{ item.email }}" + notify: Update aliases + when: item.email is defined + with_items: "{{ users }}"