forked from ISTI-ansible-roles/ansible-roles
library/roles/jenkins: Role to install jenkins 2.
This commit is contained in:
parent
e175b90a3e
commit
468d033b5d
|
@ -0,0 +1,15 @@
|
||||||
|
---
|
||||||
|
jenkins_install: False
|
||||||
|
jenkins_use_latest: False
|
||||||
|
jenkins_pkg_state: latest
|
||||||
|
jenkins_repo_key: 'https://pkg.jenkins.io/debian/jenkins-ci.org.key'
|
||||||
|
jenkins_stable_repo: 'deb http://pkg.jenkins.io/debian-stable binary/'
|
||||||
|
jenkins_latest_repo: 'deb http://pkg.jenkins.io/debian binary/'
|
||||||
|
jenkins_packages:
|
||||||
|
- jenkins
|
||||||
|
|
||||||
|
jenkins_package_requirements:
|
||||||
|
- curl
|
||||||
|
- python-svn
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,50 @@
|
||||||
|
---
|
||||||
|
- block:
|
||||||
|
- name: Jenkins package repository key
|
||||||
|
apt_key: url='{{ jenkins_repo_key }}'
|
||||||
|
|
||||||
|
- name: Install the jenkins stable repository
|
||||||
|
apt_repository: repo='{{ jenkins_stable_repo }}' update_cache=yes
|
||||||
|
when: not jenkins_use_latest
|
||||||
|
|
||||||
|
- name: Install the jenkins latest repository
|
||||||
|
apt_repository: repo='{{ jenkins_latest_repo }}' update_cache=yes
|
||||||
|
when: jenkins_use_latest
|
||||||
|
|
||||||
|
- name: Install jenkins
|
||||||
|
apt: pkg={{ item }} state={{ jenkins_pkg_state }} update_cache=yes cache_valid_time=3600
|
||||||
|
with_items: '{{ jenkins_packages }}'
|
||||||
|
|
||||||
|
- name: Install some jenkins requirements
|
||||||
|
apt: pkg={{ item }} state={{ jenkins_pkg_state }} update_cache=yes cache_valid_time=3600
|
||||||
|
with_items: '{{ jenkins_package_requirements }}'
|
||||||
|
|
||||||
|
- name: Ensure that jenkins is started and enabled
|
||||||
|
service: name=jenkins state=started enabled=yes
|
||||||
|
|
||||||
|
when: jenkins_install
|
||||||
|
tags: jenkins
|
||||||
|
|
||||||
|
- block:
|
||||||
|
- name: Ensure that jenkins is stoppend and disabled
|
||||||
|
service: name=jenkins state=stopped enabled=no
|
||||||
|
|
||||||
|
- name: Remove the jenkins requirements
|
||||||
|
apt: pkg={{ item }} state=absent
|
||||||
|
with_items: '{{ jenkins_package_requirements }}'
|
||||||
|
|
||||||
|
- name: Remove jenkins
|
||||||
|
apt: pkg={{ item }} state=absent
|
||||||
|
with_items: '{{ jenkins_packages }}'
|
||||||
|
|
||||||
|
- name: Remove the jenkins stable repository
|
||||||
|
apt_repository: repo='{{ jenkins_stable_repo }}' state=absent update_cache=yes
|
||||||
|
|
||||||
|
- name: Remove the jenkins latest repository
|
||||||
|
apt_repository: repo='{{ jenkins_latest_repo }}' state=absent update_cache=yes
|
||||||
|
|
||||||
|
- name: Remove the jenkins package repository key
|
||||||
|
apt_key: url='{{ jenkins_repo_key }}' state=absent
|
||||||
|
|
||||||
|
when: not jenkins_install
|
||||||
|
tags: jenkins
|
Loading…
Reference in New Issue