Page MenuHomeDevCentral

D1727.diff
No OneTemporary

D1727.diff

diff --git a/pillar/paas/docker.sls b/pillar/paas/docker.sls
--- a/pillar/paas/docker.sls
+++ b/pillar/paas/docker.sls
@@ -100,17 +100,17 @@
jenkins:
jenkins_cd:
+ realm: cd
host: cd.nasqueron.org
- network: cd
app_port: 38080
jnlp_port: 50000
jenkins_slave:
# Slaves for CD
apsile:
- network: cd
+ realm: cd
elapsi:
- network: cd
+ realm: cd
# Infrastructure and development services
diff --git a/pillar/saas/jenkins.sls b/pillar/saas/jenkins.sls
new file mode 100644
--- /dev/null
+++ b/pillar/saas/jenkins.sls
@@ -0,0 +1,16 @@
+# -------------------------------------------------------------
+# Salt — Jenkins instances
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# Created: 2018-09-11
+# License: Trivial work, not eligible to copyright
+# -------------------------------------------------------------
+
+# -------------------------------------------------------------
+# Jenkins realms
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+jenkins_realms:
+ cd:
+ ssh_key: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICiWLxPzS8X6NraVwsK95gFGe1pIuz+K0n7aw81nabcf jenkins-master-equatower-cd
+ network: cd
diff --git a/pillar/top.sls b/pillar/top.sls
--- a/pillar/top.sls
+++ b/pillar/top.sls
@@ -21,6 +21,7 @@
- shellserver.quassel
equatower:
- paas.docker
+ - saas.jenkins
- saas.phpbb
ysul:
- devserver.repos
diff --git a/roles/paas-docker/containers/files/jenkins_slave/authorized_keys b/roles/paas-docker/containers/files/jenkins_slave/authorized_keys
deleted file mode 100644
--- a/roles/paas-docker/containers/files/jenkins_slave/authorized_keys
+++ /dev/null
@@ -1 +0,0 @@
-ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICiWLxPzS8X6NraVwsK95gFGe1pIuz+K0n7aw81nabcf jenkins-master-equatower-cd
diff --git a/roles/paas-docker/containers/jenkins.sls b/roles/paas-docker/containers/jenkins.sls
--- a/roles/paas-docker/containers/jenkins.sls
+++ b/roles/paas-docker/containers/jenkins.sls
@@ -11,11 +11,14 @@
{% for instance, container in containers['jenkins'].items() %}
+{% set realm = pillar['jenkins_realms'][container['realm']] %}
+{% set home = "/srv/jenkins/" + container['realm'] + "/jenkins_home" %}
+
# -------------------------------------------------------------
# Home directory
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-/srv/{{ instance }}/jenkins_home:
+{{ home }}:
file.directory:
- user: 1000
- group: 1000
@@ -24,12 +27,12 @@
{% if has_selinux %}
selinux_context_jenkins_home:
selinux.fcontext_policy_present:
- - name: /srv/{{ instance }}/jenkins_home
+ - name: {{ home }}
- sel_type: svirt_sandbox_file_t
selinux_context_jenkins_home_applied:
selinux.fcontext_policy_applied:
- - name: /srv/{{ instance }}/jenkins_home
+ - name: {{ home }}
{% endif %}
# -------------------------------------------------------------
@@ -41,9 +44,9 @@
- detach: True
- interactive: True
- image: jenkinsci/jenkins
- - binds: /srv/{{ instance }}/jenkins_home:/var/jenkins_home
+ - binds: {{ home }}:/var/jenkins_home
- networks:
- - {{ container['network'] }}
+ - {{ realm['network'] }}
- ports:
- 8080
- 50000
diff --git a/roles/paas-docker/containers/jenkins_slave.sls b/roles/paas-docker/containers/jenkins_slave.sls
--- a/roles/paas-docker/containers/jenkins_slave.sls
+++ b/roles/paas-docker/containers/jenkins_slave.sls
@@ -9,35 +9,40 @@
{% set has_selinux = salt['grains.get']('selinux:enabled', False) %}
{% set containers = pillar['docker_containers'][grains['id']] %}
+{% for instance, container in containers['jenkins_slave'].items() %}
+
+{% set realm = pillar['jenkins_realms'][container['realm']] %}
+{% set home = "/srv/jenkins/" + container['realm'] + "/slaves_homes/" + instance %}
+
# -------------------------------------------------------------
# Home directory
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-/srv/jenkins/slave_home:
+{{ home }}:
file.directory:
- user: 431
- group: 433
- makedirs: True
{% if has_selinux %}
-selinux_context_jenkins_slave_home:
+selinux_context_jenkins_slave_{{ instance }}_home:
selinux.fcontext_policy_present:
- - name: /srv/jenkins/slave_home
+ - name: {{ home }}
- sel_type: svirt_sandbox_file_t
-selinux_context_jenkins_slave_home_applied:
+selinux_context_jenkins_slave_{{ instance }}_home_applied:
selinux.fcontext_policy_applied:
- - name: /srv/jenkins/slave_home
+ - name: {{ home }}
{% endif %}
-/srv/jenkins/slave_home/.ssh:
+{{ home }}/.ssh:
file.directory:
- user: 431
- group: 433
-/srv/jenkins/slave_home/.ssh/authorized_keys:
+{{ home }}/.ssh/authorized_keys:
file.managed:
- - source: salt://roles/paas-docker/containers/files/jenkins_slave/authorized_keys
+ - contents: {{ realm['ssh_key'] }}
- user: 431
- group: 433
@@ -45,13 +50,13 @@
# Container
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-{% for instance, container in containers['jenkins_slave'].items() %}
{{ instance }}:
docker_container.running:
- detach: True
- interactive: True
- image: nasqueron/jenkins-slave-php
- - binds: /srv/jenkins/slave_home:/home/app
+ - binds: {{ home }}:/home/app
- networks:
- - {{ container['network'] }}
+ - {{ realm['network'] }}
+
{% endfor %}

File Metadata

Mime Type
text/plain
Expires
Mon, Nov 25, 13:25 (21 h, 20 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2262554
Default Alt Text
D1727.diff (5 KB)

Event Timeline