Git initial commit
This commit is contained in:
commit
163d189f0f
9
LICENSE
Executable file
9
LICENSE
Executable file
@ -0,0 +1,9 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) <year> <copyright holders>
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
3
README.md
Executable file
3
README.md
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
# cloud-jenkins
|
||||||
|
|
||||||
|
Ansible role to setup Jenkins on a node.
|
||||||
25
defaults/main.yml
Executable file
25
defaults/main.yml
Executable file
@ -0,0 +1,25 @@
|
|||||||
|
---
|
||||||
|
cloud_apps: /opt
|
||||||
|
cloud_storage: /opt/storage
|
||||||
|
cloud_stage: prod
|
||||||
|
cloud_update: false
|
||||||
|
|
||||||
|
|
||||||
|
java_home: "{{ cloud_apps }}/java_jdk/java"
|
||||||
|
|
||||||
|
www_group: www-data
|
||||||
|
|
||||||
|
|
||||||
|
jenkins_version: 2.332.3
|
||||||
|
|
||||||
|
jenkins_source: https://get.jenkins.io
|
||||||
|
jenkins_download: "war{% if jenkins_stream_stable | default('true') | bool %}-stable{% endif %}/{{ jenkins_version }}"
|
||||||
|
jenkins_file: "jenkins.war"
|
||||||
|
|
||||||
|
jenkins_port: 8080
|
||||||
|
|
||||||
|
jenkins_log: false
|
||||||
|
|
||||||
|
jenkins_data_location: "{{ cloud_storage }}/jenkins-data"
|
||||||
|
|
||||||
|
jenkins_java_home: "{{ java_home }}"
|
||||||
5
handlers/main.yml
Executable file
5
handlers/main.yml
Executable file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
- name: restart jenkins
|
||||||
|
systemd:
|
||||||
|
name: jenkins
|
||||||
|
state: restarted
|
||||||
17
meta/main.yml
Executable file
17
meta/main.yml
Executable file
@ -0,0 +1,17 @@
|
|||||||
|
---
|
||||||
|
galaxy_info:
|
||||||
|
role_name: jenkins
|
||||||
|
namespace: hahn-cloud
|
||||||
|
author: Lars Hahn
|
||||||
|
company: OpenDevChain
|
||||||
|
license: MIT
|
||||||
|
description: Role to setup Jenkins
|
||||||
|
min_ansible_version: 2.7
|
||||||
|
platforms:
|
||||||
|
- name: Debian
|
||||||
|
versions:
|
||||||
|
- 11
|
||||||
|
galaxy_tags:
|
||||||
|
- jenkins
|
||||||
|
dependencies:
|
||||||
|
- java
|
||||||
72
tasks/main.yml
Executable file
72
tasks/main.yml
Executable file
@ -0,0 +1,72 @@
|
|||||||
|
---
|
||||||
|
- name: setup jenkins group
|
||||||
|
group:
|
||||||
|
name: "{{ jenkins_usr }}"
|
||||||
|
state: "present"
|
||||||
|
|
||||||
|
- name: setup jenkins user
|
||||||
|
user:
|
||||||
|
name: "{{ jenkins_usr }}"
|
||||||
|
group: "{{ jenkins_grp }}"
|
||||||
|
groups:
|
||||||
|
- "{{ jenkins_grp }}"
|
||||||
|
comment: Virtual Jenkins User
|
||||||
|
shell: /bin/bash
|
||||||
|
state: present
|
||||||
|
system: yes
|
||||||
|
|
||||||
|
- name: setup jenkins webroot
|
||||||
|
file:
|
||||||
|
state: directory
|
||||||
|
path: "{{ jenkins_web }}"
|
||||||
|
owner: "{{ www_group }}"
|
||||||
|
group: "{{ jenkins_grp }}"
|
||||||
|
mode: 0770
|
||||||
|
|
||||||
|
- name: setup jenkins directories
|
||||||
|
file:
|
||||||
|
state: directory
|
||||||
|
path: "{{ item }}"
|
||||||
|
owner: "{{ jenkins_usr }}"
|
||||||
|
group: "{{ jenkins_grp }}"
|
||||||
|
mode: 0750
|
||||||
|
loop:
|
||||||
|
- "{{ jenkins_inst }}"
|
||||||
|
- "{{ jenkins_home }}"
|
||||||
|
|
||||||
|
- name: download jenkins war
|
||||||
|
get_url:
|
||||||
|
url: "{{ jenkins_source }}/{{ jenkins_download }}/{{ jenkins_file }}"
|
||||||
|
dest: "{{ jenkins_inst }}/{{ jenkins_file }}"
|
||||||
|
owner: "{{ jenkins_grp }}"
|
||||||
|
group: "{{ jenkins_usr }}"
|
||||||
|
|
||||||
|
- name: link installation dir
|
||||||
|
file:
|
||||||
|
state: link
|
||||||
|
src: "{{ jenkins_inst }}"
|
||||||
|
dest: "{{ jenkins_link }}"
|
||||||
|
owner: "{{ jenkins_usr }}"
|
||||||
|
group: "{{ jenkins_grp }}"
|
||||||
|
|
||||||
|
- name: template jenkins conf
|
||||||
|
template:
|
||||||
|
src: opt/jenkins/inst/jenkins.conf.j2
|
||||||
|
dest: "{{ jenkins_inst }}/jenkins.conf"
|
||||||
|
owner: "{{ jenkins_usr }}"
|
||||||
|
group: "{{ jenkins_grp }}"
|
||||||
|
mode: 0750
|
||||||
|
notify: restart jenkins
|
||||||
|
|
||||||
|
- name: setup jenkins systemd unit
|
||||||
|
template:
|
||||||
|
src: etc/systemd/system/jenkins.service.j2
|
||||||
|
dest: /etc/systemd/system/jenkins.service
|
||||||
|
notify: restart jenkins
|
||||||
|
|
||||||
|
- name: enable jenkins systemd unit
|
||||||
|
systemd:
|
||||||
|
name: jenkins
|
||||||
|
enabled: yes
|
||||||
|
daemon_reload: yes
|
||||||
|
state: started
|
||||||
16
templates/etc/systemd/system/jenkins.service.j2
Executable file
16
templates/etc/systemd/system/jenkins.service.j2
Executable file
@ -0,0 +1,16 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Jenkins
|
||||||
|
After=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
User={{ jenkins_usr }}
|
||||||
|
Group={{ jenkins_grp }}
|
||||||
|
EnvironmentFile={{ jenkins_link }}/jenkins.conf
|
||||||
|
ExecStart={{ jenkins_java_home }}/bin/java ${JAVA_ARGS} -jar ${JENKINS_WAR} ${JENKINS_ARGS}
|
||||||
|
WorkingDirectory={{ jenkins_home }}
|
||||||
|
Restart=always
|
||||||
|
RestartSec=10
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
74
templates/opt/jenkins/inst/jenkins.conf.j2
Executable file
74
templates/opt/jenkins/inst/jenkins.conf.j2
Executable file
@ -0,0 +1,74 @@
|
|||||||
|
# defaults for Jenkins automation server
|
||||||
|
|
||||||
|
# arguments to pass to java
|
||||||
|
|
||||||
|
# Allow graphs etc. to work even when an X server is present
|
||||||
|
JAVA_HOME={{ jenkins_java_home }}
|
||||||
|
JAVA_ARGS="-Djava.awt.headless=true -Xmx512m"
|
||||||
|
|
||||||
|
# make jenkins listen on IPv4 address
|
||||||
|
#JAVA_ARGS="-Djava.net.preferIPv4Stack=true"
|
||||||
|
|
||||||
|
PIDFILE=/var/run/jenkins.pid
|
||||||
|
|
||||||
|
# user and group to be invoked as (default to jenkins)
|
||||||
|
JENKINS_USER={{ jenkins_usr }}
|
||||||
|
JENKINS_GROUP={{ jenkins_grp }}
|
||||||
|
|
||||||
|
# location of the jenkins war file
|
||||||
|
JENKINS_WAR={{ jenkins_link }}/{{ jenkins_file }}
|
||||||
|
|
||||||
|
# jenkins home location
|
||||||
|
JENKINS_HOME={{ jenkins_home }}
|
||||||
|
|
||||||
|
# set this to false if you don't want Jenkins to run by itself
|
||||||
|
# in this set up, you are expected to provide a servlet container
|
||||||
|
# to host jenkins.
|
||||||
|
RUN_STANDALONE=true
|
||||||
|
|
||||||
|
# log location. this may be a syslog facility.priority
|
||||||
|
JENKINS_LOG=/var/log/jenkins.log
|
||||||
|
#JENKINS_LOG=daemon.info
|
||||||
|
|
||||||
|
# Whether to enable web access logging or not.
|
||||||
|
# Set to "yes" to enable logging to /var/log/$NAME/access_log
|
||||||
|
JENKINS_ENABLE_ACCESS_LOG="{% if jenkins_log | default('false') %}no{% else %}yes{% endif %}"
|
||||||
|
|
||||||
|
# OS LIMITS SETUP
|
||||||
|
# comment this out to observe /etc/security/limits.conf
|
||||||
|
# this is on by default because http://github.com/jenkinsci/jenkins/commit/2fb288474e980d0e7ff9c4a3b768874835a3e92e
|
||||||
|
# reported that Ubuntu's PAM configuration doesn't include pam_limits.so, and as a result the # of file
|
||||||
|
# descriptors are forced to 1024 regardless of /etc/security/limits.conf
|
||||||
|
MAXOPENFILES=8192
|
||||||
|
|
||||||
|
# set the umask to control permission bits of files that Jenkins creates.
|
||||||
|
# 027 makes files read-only for group and inaccessible for others, which some security sensitive users
|
||||||
|
# might consider benefitial, especially if Jenkins runs in a box that's used for multiple purposes.
|
||||||
|
# Beware that 027 permission would interfere with sudo scripts that run on the master (JENKINS-25065.)
|
||||||
|
#
|
||||||
|
# Note also that the particularly sensitive part of $JENKINS_HOME (such as credentials) are always
|
||||||
|
# written without 'others' access. So the umask values only affect job configuration, build records,
|
||||||
|
# that sort of things.
|
||||||
|
#
|
||||||
|
# If commented out, the value from the OS is inherited, which is normally 022 (as of Ubuntu 12.04,
|
||||||
|
# by default umask comes from pam_umask(8) and /etc/login.defs
|
||||||
|
|
||||||
|
# UMASK=027
|
||||||
|
|
||||||
|
|
||||||
|
HTTP_PORT={{ jenkins_port }}
|
||||||
|
|
||||||
|
# servlet context, important if you want to use apache proxying
|
||||||
|
PREFIX=/
|
||||||
|
|
||||||
|
# arguments to pass to jenkins.
|
||||||
|
# --javahome=$JAVA_HOME
|
||||||
|
# --httpListenAddress=$HTTP_HOST (default 0.0.0.0)
|
||||||
|
# --httpPort=$HTTP_PORT (default 8080; disable with -1)
|
||||||
|
# --httpsPort=$HTTP_PORT
|
||||||
|
# --argumentsRealm.passwd.$ADMIN_USER=[password]
|
||||||
|
# --argumentsRealm.roles.$ADMIN_USER=admin
|
||||||
|
# --webroot=~/.jenkins/war
|
||||||
|
# --prefix=$PREFIX
|
||||||
|
|
||||||
|
JENKINS_ARGS="--webroot={{ jenkins_web }} --httpPort={{ jenkins_port }}"
|
||||||
8
vars/main.yml
Executable file
8
vars/main.yml
Executable file
@ -0,0 +1,8 @@
|
|||||||
|
---
|
||||||
|
jenkins_inst: "{{ cloud_apps }}/jenkins/jenkins_{{ jenkins_version }}"
|
||||||
|
jenkins_link: "{{ cloud_apps }}/jenkins/inst"
|
||||||
|
jenkins_home: "{{ jenkins_data_location }}"
|
||||||
|
jenkins_web: "{{ cloud_apps }}/jenkins/web"
|
||||||
|
|
||||||
|
jenkins_usr: jenkins
|
||||||
|
jenkins_grp: "{{ jenkins_usr }}"
|
||||||
Loading…
Reference in New Issue
Block a user