diff --git a/jenkins/master/defaults/main.yml b/jenkins/master/defaults/main.yml new file mode 100644 index 0000000..c3cd118 --- /dev/null +++ b/jenkins/master/defaults/main.yml @@ -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 + + diff --git a/jenkins/master/handlers/main.yml b/jenkins/master/handlers/main.yml new file mode 100644 index 0000000..e69de29 diff --git a/jenkins/master/tasks/main.yml b/jenkins/master/tasks/main.yml new file mode 100644 index 0000000..d51ba0d --- /dev/null +++ b/jenkins/master/tasks/main.yml @@ -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 diff --git a/jenkins/slave/defaults/main.yml b/jenkins/slave/defaults/main.yml new file mode 100644 index 0000000..e69de29 diff --git a/jenkins/slave/handlers/main.yml b/jenkins/slave/handlers/main.yml new file mode 100644 index 0000000..e69de29 diff --git a/jenkins/slave/tasks/main.yml b/jenkins/slave/tasks/main.yml new file mode 100644 index 0000000..e69de29