From b1f832d800c423d4694a29778cab6bcaeffec053 Mon Sep 17 00:00:00 2001 From: Forrest Alvarez Date: Wed, 22 Jan 2014 06:12:13 +0000 Subject: [PATCH 1/3] Added a map.jinja file, and updated the init to support it. --- dhcpd/init.sls | 7 +++---- dhcpd/map.jinja | 8 ++++++++ 2 files changed, 11 insertions(+), 4 deletions(-) create mode 100644 dhcpd/map.jinja diff --git a/dhcpd/init.sls b/dhcpd/init.sls index 76f9e5e..f042d24 100644 --- a/dhcpd/init.sls +++ b/dhcpd/init.sls @@ -1,9 +1,8 @@ +{% from "dhcpd/map.jinja" import dhcpd with context %} + dhcpd: pkg.installed: - {% if grains['os_family'] == 'Debian' %} - - name: isc-dhcp-server - {% else %} - - name: dhcp + - name: {{ dhcpd.server }} service.running: - enable: True - require: diff --git a/dhcpd/map.jinja b/dhcpd/map.jinja new file mode 100644 index 0000000..5b60c9f --- /dev/null +++ b/dhcpd/map.jinja @@ -0,0 +1,8 @@ +{% set dhcpd = salt['grains.filter_by']({ + 'Debian': { + 'server': 'isc-dhcp-server', + }, + 'RedHat': { + 'server': 'dhcp', + }, +}, merge=salt['pillar.get']('dhcpd:lookup')) %} From 4e696072aa4ea33852cc0ef450a2c4b3acc46f7f Mon Sep 17 00:00:00 2001 From: Forrest Alvarez Date: Wed, 22 Jan 2014 06:20:53 +0000 Subject: [PATCH 2/3] Updated the map with some proper service names, modified the init to reflect this, brought the readme up to standards. --- README.rst | 16 +++++++++++++--- dhcpd/init.sls | 1 + dhcpd/map.jinja | 2 ++ 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/README.rst b/README.rst index 663ad18..4ee9378 100644 --- a/README.rst +++ b/README.rst @@ -1,7 +1,17 @@ dhcpd ===== -dhcpd ------ +Formulas to install and start dhcpd. -Install and turn on a basic dhcpd daemon +.. note:: + + See the full `Salt Formulas installation and usage instructions + `_. + +Available states +================ + +``dhcpd`` +--------- + +Install and turn on a basic dhcpd daemon. diff --git a/dhcpd/init.sls b/dhcpd/init.sls index f042d24..4f02739 100644 --- a/dhcpd/init.sls +++ b/dhcpd/init.sls @@ -4,6 +4,7 @@ dhcpd: pkg.installed: - name: {{ dhcpd.server }} service.running: + - name: {{ dhcpd.service }} - enable: True - require: - pkg: dhcpd diff --git a/dhcpd/map.jinja b/dhcpd/map.jinja index 5b60c9f..e207317 100644 --- a/dhcpd/map.jinja +++ b/dhcpd/map.jinja @@ -1,8 +1,10 @@ {% set dhcpd = salt['grains.filter_by']({ 'Debian': { 'server': 'isc-dhcp-server', + 'service': 'isc-dhcp-server', }, 'RedHat': { 'server': 'dhcp', + 'service' 'dhcpd', }, }, merge=salt['pillar.get']('dhcpd:lookup')) %} From 410bd1e58d4a17414fb4eb5143604b70c7f73796 Mon Sep 17 00:00:00 2001 From: Forrest Alvarez Date: Wed, 22 Jan 2014 06:25:28 +0000 Subject: [PATCH 3/3] Missed a colon in my map --- dhcpd/map.jinja | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dhcpd/map.jinja b/dhcpd/map.jinja index e207317..d2a042b 100644 --- a/dhcpd/map.jinja +++ b/dhcpd/map.jinja @@ -5,6 +5,6 @@ }, 'RedHat': { 'server': 'dhcp', - 'service' 'dhcpd', + 'service': 'dhcpd', }, }, merge=salt['pillar.get']('dhcpd:lookup')) %}