Skip to content

Commit

Permalink
Processed feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
Thulium-Drake committed Jun 17, 2024
1 parent d3c43f6 commit 8994341
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 11 deletions.
9 changes: 0 additions & 9 deletions handlers/main.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
---
- name: Run postmap
command: postmap /etc/postfix/{{ file['name'] }}
when: file['postmap'] | default(false) | bool
no_log: true
loop: "{{ postfix_files }}"
loop_control:
loop_var: file
changed_when: false

- name: Check postfix
command: postfix check
when: postfix_check
Expand Down
15 changes: 13 additions & 2 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,16 +108,27 @@
dest: /etc/postfix/{{ file['name'] }}
owner: root
group: root
mode: '0644'
mode: '0640'
loop: "{{ postfix_files }}"
register: __postfix_postmap_files
no_log: true
loop_control:
loop_var: file
notify:
- Run postmap
- Check postfix
- Restart postfix

- name: Postmap files
command: postmap /etc/postfix/{{ file['name'] }}
when:
- file['changed'] | bool
- file['file']['postmap'] is defined
- file['file']['postmap'] | bool
no_log: true
loop: "{{ __postfix_postmap_files['results'] }}"
loop_control:
loop_var: file

- name: Apply changes
when: __postfix_has_config_changed | d("") is search("True")
block:
Expand Down
8 changes: 8 additions & 0 deletions tests/tests_set_file.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,11 @@
- name: Assert file is present
assert:
that: test_file.stat.exists

- name: Clean up test files
file:
path: "{{ item }}"
state: absent
loop:
- /etc/postfix/test
- /etc/postfix/test.db

0 comments on commit 8994341

Please sign in to comment.