Page MenuHomeDevCentral

D3032.diff
No OneTemporary

D3032.diff

diff --git a/_modules/node.py b/_modules/node.py
--- a/_modules/node.py
+++ b/_modules/node.py
@@ -14,6 +14,15 @@
from salt._compat import ipaddress
+DEPLOY_ROLES = [
+ "devserver",
+ "salt-primary",
+ "viperserv",
+ "webserver-alkane",
+ "webserver-legacy",
+]
+
+
def _get_all_nodes():
return __pillar__.get("nodes", {})
@@ -176,6 +185,13 @@
return filtered_list
+def has_deployment(nodename=None):
+ """
+ A function to determine if this server does continuous delivery.
+ """
+ return any(role in DEPLOY_ROLES for role in get_list("roles", nodename))
+
+
def has_web_content(content, nodename=None):
return content in filter_by_role("web_content_sls", nodename)
diff --git a/roles/core/deploy/init.sls b/roles/core/deploy/init.sls
new file mode 100644
--- /dev/null
+++ b/roles/core/deploy/init.sls
@@ -0,0 +1,19 @@
+# -------------------------------------------------------------
+# Salt — Deploy user
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# License: Trivial work, not eligible to copyright
+# -------------------------------------------------------------
+
+{% if salt["node.has_deployment"]() %}
+
+# Deployment account
+deploy_account:
+ user.present:
+ - name: deploy
+ - fullname: Deployment and management of the Salt staging area
+ - uid: 9002
+ - gid: 3003
+ - home: /var/run/deploy
+
+{% endif %}
diff --git a/roles/core/init.sls b/roles/core/init.sls
--- a/roles/core/init.sls
+++ b/roles/core/init.sls
@@ -27,3 +27,6 @@
- .userland-home
- .userland-software
- .users
+
+ # Depends of users or groups
+ - .deploy
diff --git a/roles/salt-primary/account/init.sls b/roles/salt-primary/account/init.sls
--- a/roles/salt-primary/account/init.sls
+++ b/roles/salt-primary/account/init.sls
@@ -30,15 +30,6 @@
- onchanges:
- user: salt_account
-# Deployment account
-deploy_account:
- user.present:
- - name: deploy
- - fullname: Deployment and management of the Salt staging area
- - uid: 9002
- - gid: 3003
- - home: /var/run/deploy
-
# -------------------------------------------------------------
# Directories
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

File Metadata

Mime Type
text/plain
Expires
Tue, Nov 26, 18:15 (19 h, 46 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2264944
Default Alt Text
D3032.diff (2 KB)

Event Timeline