Commit 2c0c6229 by Michael Roytman

add lifecycle tags to jenkins_master and tools_jenkins tasks

parent 73f1aa1f
......@@ -3,13 +3,22 @@
service:
name: jenkins
state: restarted
tags:
- manage
- manage:start
- name: start nginx
service:
name: nginx
state: started
tags:
- manage
- manage:start
- name: reload nginx
service:
name: nginx
state: reloaded
tags:
- manage
- manage:start
......@@ -7,6 +7,8 @@
with_items: "{{ jenkins_debian_pkgs }}"
tags:
- jenkins
- install
- install:system-requirements
- name: Install jenkins extra system packages
apt:
......@@ -16,17 +18,25 @@
with_items: "{{ JENKINS_EXTRA_PKGS }}"
tags:
- jenkins
- install
- install:system-requirements
- name: Create jenkins group
group:
name: "{{ jenkins_group }}"
state: present
tags:
- install
- install:system-requirements
- name: Add the jenkins user to the group
user:
name: "{{ jenkins_user }}"
append: yes
groups: "{{ jenkins_group }}"
tags:
- install
- install:system-requirements
# Should be resolved in the next release, but until then we need to do this
# https://issues.jenkins-ci.org/browse/JENKINS-20407
......@@ -36,19 +46,31 @@
state: directory
owner: "{{ jenkins_user }}"
group: "{{ jenkins_group }}"
tags:
- install
- install:system-requirements
# TODO in Ansible 2.1 we can do apt: deb="{{ jenkins_deb_url }}"
- name: download Jenkins package
get_url: url="{{ jenkins_deb_url }}" dest="/tmp/{{ jenkins_deb }}"
tags:
- install
- install:app-requirements
- name: install Jenkins package
apt:
deb: "/tmp/{{ jenkins_deb }}"
tags:
- install
- install:app-requirements
- name: Stop Jenkins
service:
name: jenkins
state: stopped
tags:
- manage
- manage:stop
- name: Set jvm args
lineinfile:
......@@ -61,6 +83,8 @@
tags:
- java
- jenkins
- install
- install:app-configuration
- name: Set jenkins home
lineinfile:
......@@ -73,12 +97,17 @@
tags:
- java
- jenkins
- install
- install:app-configuration
# Move /var/lib/jenkins to Jenkins home (on the EBS)
- name: Move /var/lib/jenkins
command: "mv /var/lib/jenkins {{ jenkins_home }}"
args:
creates: "{{ jenkins_home }}"
tags:
- install
- install:base
- name: Set owner for Jenkins home
file:
......@@ -87,6 +116,9 @@
state: directory
owner: "{{ jenkins_user }}"
group: "{{ jenkins_group }}"
tags:
- install
- install:app-requirements
# Symlink /var/lib/jenkins to {{ COMMON_DATA_DIR }}/jenkins
# since Jenkins will expect its files to be in /var/lib/jenkins
......@@ -99,11 +131,17 @@
group: "{{ jenkins_group }}"
notify:
- restart Jenkins
tags:
- install
- install:base
# Using this instead of the user module because the user module
# fails if the directory exists.
- name: Set home directory for jenkins user
shell: "usermod -d {{ jenkins_home }} {{ jenkins_user }}"
tags:
- install
- install:base
- name: Make plugins directory
file:
......@@ -111,6 +149,9 @@
state: directory
owner: "{{ jenkins_user }}"
group: "{{ jenkins_group }}"
tags:
- install
- install:base
# We first download the plugins to a temp directory and include
# the version in the file name. That way, if we increment
......@@ -121,11 +162,17 @@
dest: "/tmp/{{ item.name }}_{{ item.version }}"
with_items: "{{ jenkins_plugins }}"
register: jenkins_plugin_downloads
tags:
- install
- install:base
- name: Install Jenkins plugins
command: "cp {{ item.dest }} {{ jenkins_home }}/plugins/{{ item.item.name }}.hpi"
with_items: "{{ jenkins_plugin_downloads.results }}"
when: item.changed
tags:
- install
- install:base
- name: Set Jenkins plugin permissions
file:
......@@ -137,6 +184,9 @@
when: item.changed
notify:
- restart Jenkins
tags:
- install
- install:base
# We had to fork some plugins to workaround
# certain issues. If these changes get merged
......@@ -150,6 +200,9 @@
accept_hostkey: yes
with_items: "{{ jenkins_custom_plugins }}"
register: jenkins_custom_plugins_checkout
tags:
- install
- install:base
- name: Compile custom plugins
command: "mvn -Dmaven.test.skip=true install"
......@@ -157,6 +210,9 @@
chdir: "/tmp/{{ item.item.repo_name }}"
with_items: "{{ jenkins_custom_plugins_checkout.results }}"
when: item.changed
tags:
- install
- install:base
- name: Install custom plugins
command: mv /tmp/{{ item.item.repo_name }}/target/{{ item.item.package }}
......@@ -165,6 +221,9 @@
when: item.changed
notify:
- restart Jenkins
tags:
- install
- install:base
- name: Set custom plugin permissions
file:
......@@ -174,6 +233,9 @@
mode: "0700"
with_items: "{{ jenkins_custom_plugins_checkout.results }}"
when: item.changed
tags:
- install
- install:base
# Plugins that are bundled with Jenkins are "pinned".
# Jenkins will overwrite updated plugins with its built-in version
......@@ -184,11 +246,17 @@
args:
creates: "{{ jenkins_home }}/plugins/{{ item }}.jpi.pinned"
with_items: "{{ jenkins_bundled_plugins }}"
tags:
- install
- install:base
- name: Setup nginix vhost
template:
src: "etc/nginx/sites-available/jenkins.j2"
dest: "/etc/nginx/sites-available/jenkins"
tags:
- install
- install:vhosts
- name: Enable jenkins vhost
file:
......@@ -197,8 +265,13 @@
state: link
notify:
- start nginx
tags:
- install
- install:vhosts
- include: datadog.yml
when: COMMON_ENABLE_DATADOG
tags:
- datadog
- install
- install:base
......@@ -2,4 +2,7 @@
- name: restart Jenkins
service:
name: jenkins
state: restarted
\ No newline at end of file
state: restarted
tags:
- manage
- manage:start
......@@ -3,6 +3,9 @@
shell: "ls {{ jenkins_home }}/plugins/*.hpi"
register: hpi_files
ignore_errors: true
tags:
- install
- install:app-configuration
- name: Set the permission on hpi files
file:
......@@ -14,11 +17,17 @@
when: hpi_files
notify:
- restart Jenkins
tags:
- install
- install:app-configuration
- name: Get the list of jpi files
shell: "ls {{ jenkins_home }}/plugins/*.jpi"
register: jpi_files
ignore_errors: true
tags:
- install
- install:app-configuration
- name: Set the permission on jpi files
file:
......@@ -30,6 +39,9 @@
when: jpi_files
notify:
- restart Jenkins
tags:
- install
- install:app-configuration
# The deadsnakes PPA is required to install python3.5 on Precise and Trusty.
# Xenial comes with python3.5 installed.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment