Page MenuHomeDevCentral

D1089.id2781.diff
No OneTemporary

D1089.id2781.diff

diff --git a/_modules/jails.py b/_modules/jails.py
new file mode 100644
--- /dev/null
+++ b/_modules/jails.py
@@ -0,0 +1,30 @@
+# -*- coding: utf-8 -*-
+
+# -------------------------------------------------------------
+# Salt — Jails execution module
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# Created: 2017-10-21
+# Description: Functions related to FreeBSD jails
+# License: BSD-2-Clause
+# -------------------------------------------------------------
+
+
+def _get_jails(group):
+ all_jails = __pillar__.get('jails', {})
+
+ if group in all_jails:
+ return all_jails[group]
+
+ return []
+
+
+def list(group):
+ '''
+ A function to list the jails for the specified group.
+
+ CLI Example::
+
+ salt '*' jails.list ysul
+ '''
+ return " ".join(_get_jails(group))
diff --git a/pillar/top.sls b/pillar/paas-jails/jails.sls
copy from pillar/top.sls
copy to pillar/paas-jails/jails.sls
--- a/pillar/top.sls
+++ b/pillar/paas-jails/jails.sls
@@ -1,18 +1,12 @@
# -------------------------------------------------------------
-# Salt configuration for Nasqueron servers
+# Salt — Nodes
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Project: Nasqueron
-# Created: 2016-04-10
+# Created: 2017-10-20
# License: Trivial work, not eligible to copyright
# -------------------------------------------------------------
-base:
- '*':
- - core.hostnames
- - certificates.certificates
- - nodes.nodes
- eglide:
- - users.revokedusers
- - users.shellusers
- - users.shelladmins
- - users.shellgroups
+jails:
+ ysul:
+ - ftp
+ - mumble
diff --git a/pillar/top.sls b/pillar/top.sls
--- a/pillar/top.sls
+++ b/pillar/top.sls
@@ -16,3 +16,5 @@
- users.shellusers
- users.shelladmins
- users.shellgroups
+ ysul:
+ - paas-jails.jails
diff --git a/pillar/top.sls b/roles/paas-jails/init.sls
copy from pillar/top.sls
copy to roles/paas-jails/init.sls
--- a/pillar/top.sls
+++ b/roles/paas-jails/init.sls
@@ -1,18 +1,11 @@
# -------------------------------------------------------------
-# Salt configuration for Nasqueron servers
+# Salt — Jails
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Project: Nasqueron
-# Created: 2016-04-10
+# Notes: FreeBSD-only role
+# Created: 2017-10-21
# License: Trivial work, not eligible to copyright
# -------------------------------------------------------------
-base:
- '*':
- - core.hostnames
- - certificates.certificates
- - nodes.nodes
- eglide:
- - users.revokedusers
- - users.shellusers
- - users.shelladmins
- - users.shellgroups
+include:
+ - .jails
diff --git a/roles/paas-jails/jails/files/jail.rc b/roles/paas-jails/jails/files/jail.rc
new file mode 100644
--- /dev/null
+++ b/roles/paas-jails/jails/files/jail.rc
@@ -0,0 +1,29 @@
+# -------------------------------------------------------------
+# Jails - rc configuration
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# License: Trivial work, not eligible to copyright
+# Source file: roles/paas-jails/jails/files/jail.rc
+# -------------------------------------------------------------
+#
+# <auto-generated>
+# This file is managed by our rOPS SaltStack repository.
+#
+# Changes to this file may cause incorrect behavior
+# and will be lost if the state is redeployed.
+# </auto-generated>
+
+# -------------------------------------------------------------
+# Network
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+cloned_interfaces="lo1"
+
+# -------------------------------------------------------------
+# Enable the jails
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+ezjail_enable="YES"
+
+jail_enable="YES"
+jail_list="{{ jails }}"
diff --git a/roles/paas-jails/jails/init.sls b/roles/paas-jails/jails/init.sls
new file mode 100644
--- /dev/null
+++ b/roles/paas-jails/jails/init.sls
@@ -0,0 +1,28 @@
+# -------------------------------------------------------------
+# Salt — Jails
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# Notes: FreeBSD-only unit
+# Created: 2017-10-21
+# License: Trivial work, not eligible to copyright
+# -------------------------------------------------------------
+
+# -------------------------------------------------------------
+# Software to manage jails
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+jails_software:
+ pkg.installed:
+ - ezjail
+
+# -------------------------------------------------------------
+# Configuration
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+jails_rc:
+ file.managed:
+ - name: /etc/rc.conf.d/jail
+ - source: salt://roles/paas-jails/jails/files/jail.rc
+ - template: jinja
+ - context:
+ jails: {% salt['jails.list'](grains['id']) %}
diff --git a/top.sls b/top.sls
--- a/top.sls
+++ b/top.sls
@@ -18,6 +18,7 @@
'local':
- roles/saltmaster
'ysul.nasqueron.org':
+ - roles/paas-jails
- roles/webserver-legacy
- roles/webserver-varnish
'dwellers.nasqueron.org':

File Metadata

Mime Type
text/plain
Expires
Thu, Nov 28, 06:47 (22 h, 11 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2268627
Default Alt Text
D1089.id2781.diff (5 KB)

Event Timeline