Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
configuration
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
configuration
Commits
8cd7d0c5
You need to sign in or sign up before continuing.
Commit
8cd7d0c5
authored
8 years ago
by
Arbab Nazar
Committed by
GitHub
8 years ago
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3231 from edx/arbab/jenkins_master-rewrite
use the YAML syntax for writing tasks
parents
c29f4b2d
c74a146b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
112 additions
and
76 deletions
+112
-76
playbooks/roles/jenkins_master/handlers/main.yml
+9
-3
playbooks/roles/jenkins_master/tasks/datadog.yml
+4
-2
playbooks/roles/jenkins_master/tasks/main.yml
+99
-71
No files found.
playbooks/roles/jenkins_master/handlers/main.yml
View file @
8cd7d0c5
---
---
-
name
:
restart Jenkins
-
name
:
restart Jenkins
service
:
name=jenkins state=restarted
service
:
name
:
jenkins
state
:
restarted
-
name
:
start nginx
-
name
:
start nginx
service
:
name=nginx state=started
service
:
name
:
nginx
state
:
started
-
name
:
reload nginx
-
name
:
reload nginx
service
:
name=nginx state=reloaded
service
:
name
:
nginx
state
:
reloaded
This diff is collapsed.
Click to expand it.
playbooks/roles/jenkins_master/tasks/datadog.yml
View file @
8cd7d0c5
-
name
:
enable jenkins datadog
-
name
:
Enable jenkins datadog
shell
:
cp /etc/dd-agent/conf.d/jenkins.yaml.example /etc/dd-agent/conf.d/jenkins.yaml creates=/etc/dd-agent/conf.d/jenkins.yaml
shell
:
cp /etc/dd-agent/conf.d/jenkins.yaml.example /etc/dd-agent/conf.d/jenkins.yaml
args
:
creates
:
/etc/dd-agent/conf.d/jenkins.yaml
notify
:
restart the datadog service
notify
:
restart the datadog service
This diff is collapsed.
Click to expand it.
playbooks/roles/jenkins_master/tasks/main.yml
View file @
8cd7d0c5
---
---
-
name
:
Install jenkins specific system packages
-
name
:
install jenkins specific system packages
apt
:
apt
:
pkg={{','.join(jenkins_debian_pkgs)}}
name
:
"
{{
item
}}"
state=present update_cache=yes
state
:
present
update_cache
:
yes
with_items
:
"
{{
jenkins_debian_pkgs
}}"
tags
:
tags
:
-
jenkins
-
jenkins
-
name
:
i
nstall jenkins extra system packages
-
name
:
I
nstall jenkins extra system packages
apt
:
apt
:
pkg={{ item }} state=present update_cache=yes
name
:
"
{{
item
}}"
with_items
:
JENKINS_EXTRA_PKGS
state
:
present
update_cache
:
yes
with_items
:
"
{{
JENKINS_EXTRA_PKGS
}}"
tags
:
tags
:
-
jenkins
-
jenkins
-
name
:
create jenkins group
-
name
:
Create jenkins group
group
:
name={{ jenkins_group }} state=present
group
:
name
:
"
{{
jenkins_group
}}"
state
:
present
-
name
:
add the jenkins user to the group
-
name
:
Add the jenkins user to the group
user
:
name={{ jenkins_user }} append=yes groups={{ jenkins_group }}
user
:
name
:
"
{{
jenkins_user
}}"
append
:
yes
groups
:
"
{{
jenkins_group
}}"
# Should be resolved in the next release, but until then we need to do this
# Should be resolved in the next release, but until then we need to do this
# https://issues.jenkins-ci.org/browse/JENKINS-20407
# https://issues.jenkins-ci.org/browse/JENKINS-20407
-
name
:
w
orkaround for JENKINS-20407
-
name
:
W
orkaround for JENKINS-20407
file
:
file
:
path
:
"
/var/run/jenkins"
path
:
"
/var/run/jenkins"
state
:
directory
state
:
directory
owner
:
"
{{
jenkins_user
}}"
owner
:
"
{{
jenkins_user
}}"
group
:
"
{{
jenkins_group
}}"
group
:
"
{{
jenkins_group
}}"
-
name
:
download Jenkins package
-
name
:
Install Jenkins package from the internet
get_url
:
url="{{ jenkins_deb_url }}" dest="/tmp/{{ jenkins_deb }}"
apt
:
deb
:
"
{{
jenkins_deb_url
}}"
-
name
:
install Jenkins package
shell
:
dpkg -i --force-depends "/tmp/{{ jenkins_deb }}"
-
name
:
stop Jenkins
-
name
:
Stop Jenkins
service
:
name=jenkins state=stopped
service
:
name
:
jenkins
state
:
stopped
-
name
:
s
et jvm args
-
name
:
S
et jvm args
lineinfile
:
lineinfile
:
backup
:
yes
backup
:
yes
dest
:
/etc/default/jenkins
dest
:
/etc/default/jenkins
...
@@ -50,7 +58,7 @@
...
@@ -50,7 +58,7 @@
-
java
-
java
-
jenkins
-
jenkins
-
name
:
s
et jenkins home
-
name
:
S
et jenkins home
lineinfile
:
lineinfile
:
backup
:
yes
backup
:
yes
dest
:
/etc/default/jenkins
dest
:
/etc/default/jenkins
...
@@ -63,28 +71,37 @@
...
@@ -63,28 +71,37 @@
-
jenkins
-
jenkins
# Move /var/lib/jenkins to Jenkins home (on the EBS)
# Move /var/lib/jenkins to Jenkins home (on the EBS)
-
name
:
move /var/lib/jenkins
-
name
:
Move /var/lib/jenkins
command
:
mv /var/lib/jenkins {{ jenkins_home }}
command
:
"
mv
/var/lib/jenkins
{{
jenkins_home
}}"
creates={{ jenkins_home }}
args
:
creates
:
"
{{
jenkins_home
}}"
-
name
:
set owner for Jenkins home
-
name
:
Set owner for Jenkins home
file
:
path={{ jenkins_home }} recurse=yes state=directory
file
:
owner={{ jenkins_user }} group={{ jenkins_group }}
path
:
"
{{
jenkins_home
}}"
recurse
:
yes
state
:
directory
owner
:
"
{{
jenkins_user
}}"
group
:
"
{{
jenkins_group
}}"
# Symlink /var/lib/jenkins to {{ COMMON_DATA_DIR }}/jenkins
# Symlink /var/lib/jenkins to {{ COMMON_DATA_DIR }}/jenkins
# since Jenkins will expect its files to be in /var/lib/jenkins
# since Jenkins will expect its files to be in /var/lib/jenkins
-
name
:
symlink /var/lib/jenkins
-
name
:
Symlink /var/lib/jenkins
file
:
src={{ jenkins_home }} dest=/var/lib/jenkins state=link
file
:
owner={{ jenkins_user }} group={{ jenkins_group }}
src
:
"
{{
jenkins_home
}}"
dest
:
/var/lib/jenkins
state
:
link
owner
:
"
{{
jenkins_user
}}"
group
:
"
{{
jenkins_group
}}"
notify
:
notify
:
-
restart Jenkins
-
restart Jenkins
# Using this instead of the user module because the user module
# Using this instead of the user module because the user module
# fails if the directory exists.
# fails if the directory exists.
-
name
:
s
et home directory for jenkins user
-
name
:
S
et home directory for jenkins user
shell
:
usermod -d {{ jenkins_home }} {{ jenkins_user }}
shell
:
"
usermod
-d
{{
jenkins_home
}}
{{
jenkins_user
}}"
-
name
:
m
ake plugins directory
-
name
:
M
ake plugins directory
file
:
file
:
path
:
"
{{
jenkins_home
}}/plugins"
path
:
"
{{
jenkins_home
}}/plugins"
state
:
directory
state
:
directory
...
@@ -94,25 +111,25 @@
...
@@ -94,25 +111,25 @@
# We first download the plugins to a temp directory and include
# We first download the plugins to a temp directory and include
# the version in the file name. That way, if we increment
# the version in the file name. That way, if we increment
# the version, the plugin will be updated in Jenkins
# the version, the plugin will be updated in Jenkins
-
name
:
d
ownload Jenkins plugins
-
name
:
D
ownload Jenkins plugins
get_url
:
get_url
:
url
:
http://updates.jenkins-ci.org/download/plugins/{{ item.name }}/{{ item.version }}/{{ item.name }}.hpi
url
:
"
http://updates.jenkins-ci.org/download/plugins/{{
item.name
}}/{{
item.version
}}/{{
item.name
}}.hpi"
dest
:
/tmp/{{ item.name }}_{{ item.version }}
dest
:
"
/tmp/{{
item.name
}}_{{
item.version
}}"
with_items
:
jenkins_plugins
with_items
:
"
{{
jenkins_plugins
}}"
register
:
jenkins_plugin_downloads
register
:
jenkins_plugin_downloads
-
name
:
i
nstall Jenkins plugins
-
name
:
I
nstall Jenkins plugins
command
:
"
cp
{{
item.dest
}}
{{
jenkins_home
}}/plugins/{{
item.item.name
}}.hpi"
command
:
"
cp
{{
item.dest
}}
{{
jenkins_home
}}/plugins/{{
item.item.name
}}.hpi"
with_items
:
jenkins_plugin_downloads.results
with_items
:
"
{{
jenkins_plugin_downloads.results
}}"
when
:
item.changed
when
:
item.changed
-
name
:
s
et Jenkins plugin permissions
-
name
:
S
et Jenkins plugin permissions
file
:
file
:
path
:
"
{{
jenkins_home
}}/plugins/{{
item.item.name
}}.hpi"
path
:
"
{{
jenkins_home
}}/plugins/{{
item.item.name
}}.hpi"
owner
:
"
{{
jenkins_user
}}"
owner
:
"
{{
jenkins_user
}}"
group
:
"
{{
jenkins_group
}}"
group
:
"
{{
jenkins_group
}}"
mode
:
"
644"
mode
:
"
0
644"
with_items
:
jenkins_plugin_downloads.results
with_items
:
"
{{
jenkins_plugin_downloads.results
}}"
when
:
item.changed
when
:
item.changed
notify
:
notify
:
-
restart Jenkins
-
restart Jenkins
...
@@ -121,52 +138,63 @@
...
@@ -121,52 +138,63 @@
# certain issues. If these changes get merged
# certain issues. If these changes get merged
# upstream, we may be able to use the regular plugin install process.
# upstream, we may be able to use the regular plugin install process.
# Until then, we compile and install the forks ourselves.
# Until then, we compile and install the forks ourselves.
-
name
:
checkout custom plugin repo
-
name
:
Checkout custom plugin repo
git_2_0_1
:
>
git_2_0_1
:
repo={{ item.repo_url }} dest=/tmp/{{ item.repo_name }} version={{ item.version }}
repo
:
"
{{
item.repo_url
}}"
accept_hostkey=yes
dest
:
"
/tmp/{{
item.repo_name
}}"
with_items
:
jenkins_custom_plugins
version
:
"
{{
item.version
}}"
accept_hostkey
:
yes
with_items
:
"
{{
jenkins_custom_plugins
}}"
register
:
jenkins_custom_plugins_checkout
register
:
jenkins_custom_plugins_checkout
-
name
:
compile custom plugins
-
name
:
Compile custom plugins
command
:
mvn -Dmaven.test.skip=true install chdir=/tmp/{{ item.item.repo_name }}
command
:
"
mvn
-Dmaven.test.skip=true
install"
with_items
:
jenkins_custom_plugins_checkout.results
args
:
chdir
:
"
/tmp/{{
item.item.repo_name
}}"
with_items
:
"
{{
jenkins_custom_plugins_checkout.results
}}"
when
:
item.changed
when
:
item.changed
-
name
:
i
nstall custom plugins
-
name
:
I
nstall custom plugins
command
:
mv /tmp/{{ item.item.repo_name }}/target/{{ item.item.package }}
command
:
mv /tmp/{{ item.item.repo_name }}/target/{{ item.item.package }}
{{ jenkins_home }}/plugins/{{ item.item.package }}
{{ jenkins_home }}/plugins/{{ item.item.package }}
with_items
:
jenkins_custom_plugins_checkout.results
with_items
:
"
{{
jenkins_custom_plugins_checkout.results
}}"
when
:
item.changed
when
:
item.changed
notify
:
notify
:
-
restart Jenkins
-
restart Jenkins
-
name
:
set custom plugin permissions
-
name
:
Set custom plugin permissions
file
:
path={{ jenkins_home }}/plugins/{{ item.item.package }}
file
:
owner={{ jenkins_user }} group={{ jenkins_group }} mode="700"
path
:
"
{{
jenkins_home
}}/plugins/{{
item.item.package
}}"
with_items
:
jenkins_custom_plugins_checkout.results
owner
:
"
{{
jenkins_user
}}"
group
:
"
{{
jenkins_group
}}"
mode
:
"
0700"
with_items
:
"
{{
jenkins_custom_plugins_checkout.results
}}"
when
:
item.changed
when
:
item.changed
# Plugins that are bundled with Jenkins are "pinned".
# Plugins that are bundled with Jenkins are "pinned".
# Jenkins will overwrite updated plugins with its built-in version
# Jenkins will overwrite updated plugins with its built-in version
# unless we create a ".pinned" file for the plugin.
# unless we create a ".pinned" file for the plugin.
# See https://issues.jenkins-ci.org/browse/JENKINS-13129
# See https://issues.jenkins-ci.org/browse/JENKINS-13129
-
name
:
create plugin pin files
-
name
:
Create plugin pin files
command
:
touch {{ jenkins_home }}/plugins/{{ item }}.jpi.pinned
command
:
"
touch
{{
jenkins_home
}}/plugins/{{
item
}}.jpi.pinned"
creates={{ jenkins_home }}/plugins/{{ item }}.jpi.pinned
args
:
with_items
:
jenkins_bundled_plugins
creates
:
"
{{
jenkins_home
}}/plugins/{{
item
}}.jpi.pinned"
with_items
:
"
{{
jenkins_bundled_plugins
}}"
-
name
:
s
etup nginix vhost
-
name
:
S
etup nginix vhost
template
:
template
:
src
=etc/nginx/sites-available/jenkins.j2
src
:
"
etc/nginx/sites-available/jenkins.j2"
dest
=/etc/nginx/sites-available/jenkins
dest
:
"
/etc/nginx/sites-available/jenkins"
-
name
:
e
nable jenkins vhost
-
name
:
E
nable jenkins vhost
file
:
file
:
src=/etc/nginx/sites-available/jenkins
src
:
"
/etc/nginx/sites-available/jenkins"
dest=/etc/nginx/sites-enabled/jenkins
dest
:
"
/etc/nginx/sites-enabled/jenkins"
state=link
state
:
link
notify
:
start nginx
notify
:
-
start nginx
-
include
:
datadog.yml
tags=datadog
-
include
:
datadog.yml
when
:
COMMON_ENABLE_DATADOG
when
:
COMMON_ENABLE_DATADOG
tags
:
-
datadog
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment