From 77a7cbf22850a9b8cae248b10a52833257c8b18f Mon Sep 17 00:00:00 2001 From: Noel McLoughin Date: Fri, 3 Nov 2017 16:59:12 +0000 Subject: [PATCH] Allow Skipping of service manipulation via pillar (+PR comments) --- apache/init.sls | 16 ++++++++++++++++ pillar.example | 3 +++ 2 files changed, 19 insertions(+) diff --git a/apache/init.sls b/apache/init.sls index 9731c5b..92c1d0e 100644 --- a/apache/init.sls +++ b/apache/init.sls @@ -10,6 +10,8 @@ apache: - name: {{ apache.user }} - gid: {{ apache.group }} - system: True + {# By default run apache service states (unless pillar is false) #} + {% if salt['pillar.get']('apache:manage_service_states', True) %} service.running: - name: {{ apache.service }} - enable: True @@ -25,3 +27,17 @@ apache-restart: module.wait: - name: service.restart - m_name: {{ apache.service }} + + {% else %} + +apache-reload: + test.show_notification: + - name: Skipping reload per user request + - text: Pillar manage_service_states is False + +apache-restart: + test.show_notification: + - name: Skipping restart per user request + - text: Pillar manage_service_states is False + + {% endif %} diff --git a/pillar.example b/pillar.example index 845a131..bd6b00f 100644 --- a/pillar.example +++ b/pillar.example @@ -1,6 +1,9 @@ # ``apache`` formula configuration: apache: + # By default apache restart/reload states run (false skips) + manage_service_states: True + # lookup section overrides ``map.jinja`` values lookup: server: apache2