-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
root
committed
Feb 13, 2017
0 parents
commit aee977a
Showing
8 changed files
with
146 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
Copyright (c) 2017 Richard Clark <[email protected]) | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
|
||
Derived from the dhcpd-formula from Salt Stack Formulas under the following licence | ||
|
||
Copyright (c) 2013-2015 Salt Stack Formulas | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
tftpd | ||
===== | ||
|
||
Formula to install, configure and start tftpd. | ||
|
||
.. note:: | ||
|
||
See the full `Salt Formulas installation and usage instructions | ||
<http://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html>`_. | ||
|
||
Available states | ||
================ | ||
|
||
.. contents:: | ||
:local: | ||
|
||
``tftpd`` | ||
--------- | ||
|
||
Install and turn on tftpd. | ||
|
||
.. note:: | ||
|
||
To have more pythonic variables the dashes ('-') in their names | ||
are replaced with underscores ('_') so 'dynamic-bootp' becomes | ||
'dynamic_bootp' in pillar[tftpd]. | ||
|
||
``tftpd.config`` | ||
---------------- | ||
|
||
Manage configuration for tftpd. | ||
Includes tftpd state as well | ||
|
||
See ``pillar.example`` for pillar-data for a sample configuration. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
tftpd: | ||
user: tftp | ||
directory: /srv/tftp | ||
address: '0.0.0.0:69' | ||
options: '--secure' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{% from "tftpd/map.jinja" import tftpd, tftpd_settings with context %} | ||
include: | ||
- tftpd | ||
{% if tftpd.service_config is defined %} | ||
service_config: | ||
file.managed: | ||
- name: {{ tftpd.service_config }} | ||
- source: {{ 'salt://tftpd/files/service_config.' ~ salt['grains.get']('os_family') }} | ||
- makedirs: True | ||
- template: jinja | ||
- user: root | ||
{% if 'BSD' in salt['grains.get']('os') %} | ||
- group: wheel | ||
{% else %} | ||
- group: root | ||
{% endif %} | ||
- mode: 644 | ||
- watch_in: | ||
- service: tftpd | ||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# -*- coding: utf-8 -*- | ||
# vim: ft=yaml | ||
tftpd: | ||
user: tftp | ||
directory: /srv/tftp | ||
bind_address: '0.0.0.0:69' | ||
options: '--secure' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# default/tftpd | ||
# | ||
# SaltStack-generated default configuration for tftpd-hpa | ||
# | ||
# /etc/default/tftpd-hpa | ||
{% from "tftpd/map.jinja" import tftpd_settings with context %} | ||
|
||
TFTP_USERNAME="{{ tftpd_settings.user }}" | ||
TFTP_DIRECTORY="{{ tftpd_settings.directory }}" | ||
TFTP_ADDRESS="{{ tftpd_settings.bind_address }}" | ||
TFTP_OPTIONS="{{ tftpd_settings.options }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{% from "tftpd/map.jinja" import tftpd with context %} | ||
tftpd: | ||
pkg.installed: | ||
- name: {{ tftpd.server }} | ||
service.running: | ||
- name: {{ tftpd.service }} | ||
- enable: True | ||
- require: | ||
- pkg: tftpd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# -*- coding: utf-8 -*- | ||
# vim: ft=jinja | ||
|
||
{## Start with defaults from defaults.yaml ##} | ||
{% import_yaml "tftpd/defaults.yaml" as default_settings %} | ||
|
||
{% set tftpd = salt['grains.filter_by']({ | ||
'Debian': { | ||
'server': 'tftpd-hpa', | ||
'service': 'tftpd-hpa', | ||
'service_config': '/etc/default/tftpd-hpa', | ||
}, | ||
'RedHat': { | ||
'server': 'tftp-server', | ||
'service': 'tftpd', | ||
'config': '/etc/tftpd/tftpd.conf', | ||
}, | ||
}, merge=salt['pillar.get']('tftpd:lookup')) %} | ||
|
||
{## Merge in salt:lookup pillar ##} | ||
{% set tftpd_settings = salt['pillar.get']( | ||
'tftpd:config', | ||
default=default_settings.tftpd, | ||
merge=True) | ||
%} | ||
|