From 386ea1103a8663a26ae0eb3dca3101c536afdfad Mon Sep 17 00:00:00 2001
From: Chris Coley <chris@codingallnight.com>
Date: Sat, 11 May 2019 03:35:11 -0700
Subject: [PATCH] Add better support for check_mode
---
handlers/main.yml | 2 ++
tasks/main.yml | 2 ++
2 files changed, 4 insertions(+)
diff --git a/handlers/main.yml b/handlers/main.yml
index 07ffa6c..26d9fbe 100644
--- a/handlers/main.yml
+++ b/handlers/main.yml
@@ -1,5 +1,6 @@
---
- name: make postfix sasl_passwd.db
+ when: not ansible_check_mode
environment:
LC_MESSAGES: 'C'
command: make sasl_passwd.db
@@ -10,6 +11,7 @@
changed_when: "result.stdout != \"make: 'sasl_passwd.db' is up to date.\""
- name: make postfix transport.db
+ when: not ansible_check_mode
environment:
LC_MESSAGES: 'C'
command: make transport.db
diff --git a/tasks/main.yml b/tasks/main.yml
index d7c8d2e..d729cb2 100644
--- a/tasks/main.yml
+++ b/tasks/main.yml
@@ -58,6 +58,7 @@
state: present
line: "# This file is managed by Ansible, changes will be overwritten\n"
regexp: '^# This file is managed by Ansible'
+ create: yes
- name: Merge the main_cf dictionaries
set_fact:
@@ -72,6 +73,7 @@
line: '{{ item.key }} = {{ item.value }}'
regexp: '^\s*{{ item.key }}\s*='
state: present
+ create: yes
with_dict: '{{ __postfix__main_cf_merged }}'
notify: ['reload postfix']
...
--
GitLab