mattandes.jenkins_casc
Ansible Role: Jenkins-CasC
This role sets up the Jenkins Configuration as Code plugin on an EL 7 system. It's best used after installing Jenkins with the geerlingguy.jenkins Ansible role.
Requirements
- You need root access
- Jenkins must be installed (you can use the geerlingguy.jenkins role for this)
- The Configuration as Code Plugins must be installed (also possible with geerlingguy.jenkins)
Role Variables
Here are the available variables along with their default values (see defaults/main.yml
):
jenkins_casc_config_file: "jenkins.yaml"
This specifies where the JCasC config file is located for the Jenkins server. By default, it uses
jenkins.yaml
found in this role’s files directory. You can also set it to a directory, which will copy all files in that directory to the server.jenkins_casc_config_template: ""
Use this variable to point to a Jinja template file to create the Jenkins CasC config file. This will override the
jenkins_casc_config_file
variable.jenkins_casc_jenkins_home: /var/lib/jenkins
This is the Jenkins home directory. It defaults to
/var/lib/jenkins
, which is standard for most distributions, and only needs to be changed if you have a custom setup. The role will create a folder namedcasc_configs
in this directory.
Dependencies
This role expects a user called jenkins
to exist on the system, along with a running service named jenkins
that it can restart. You can handle this by running the geerlingguy.jenkins role.
Example Playbook
- hosts: jenkins
become: yes
vars:
java_packages:
- java-1.8.0-openjdk
jenkins_plugins:
- configuration-as-code
- configuration-as-code-support
roles:
- role: geerlingguy.java
- role: geerlingguy.jenkins
- role: mattandes.jenkins-casc
License
MIT
Ansible Role to help configure Jenkins Configuration as Code Plugin
ansible-galaxy install mattandes.jenkins_casc