Skip to content

Commit

Permalink
Merge pull request #82 from agimenez/enhancement/etc-aliases
Browse files Browse the repository at this point in the history
Manage /etc/aliases with the template module
  • Loading branch information
tersmitten authored May 18, 2020
2 parents 27a1f70 + 15355de commit 6f33314
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
8 changes: 2 additions & 6 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,12 @@
- postfix-sasl-passwd

- name: configure aliases
lineinfile:
template:
src: etc/aliases.j2
dest: "{{ postfix_aliases_file }}"
regexp: '^{{ item.user | regex_escape }}.*'
line: '{{ item.user }}: {{ item.alias }}'
owner: root
group: root
mode: 0644
create: true
state: present
with_items: "{{ postfix_aliases }}"
notify:
- new aliases
- restart postfix
Expand Down
7 changes: 7 additions & 0 deletions templates/etc/aliases.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{{ ansible_managed | comment }}
# See man 5 aliases for format

postmaster: root
{% for alias in postfix_aliases %}
{{ alias.user }}: {{ alias.alias }}
{% endfor %}

0 comments on commit 6f33314

Please sign in to comment.