Code Monkey home page Code Monkey logo

ansible-jenkins-configuration-as-code's Introduction

CI

wcm_io_devops.jenkins_configuration_as_code

This role manages the installation, configuration and update of the Jenkins Configuration as Code Plugin aka JCasC.

Tasks:

  • Install JCasC plugin(s)
  • Configure the path for the JCasC plugin
  • Deployment of JCasC configuration files
  • Reloading of JCasC

Requirements

This role requires Ansible 2.7 or higher and a running Jenkins on the target instance.

Role Variables

Available variables are listed below, along with their default values.

jenkins_casc_admin_username: admin

Jenkins admin username.

jenkins_casc_admin_password: admin

Jenkins admin password.

jenkins_casc_owner: jenkins

Linux jenkins user.

jenkins_casc_group: "{{ jenkins_casc_owner }}"

Linux group of jenkins user.

jenkins_casc_jenkins_hostname: localhost

Hostname of the jenkins instance.

jenkins_casc_jenkins_port: 8080

HTTP port of the jenkins instance.

jenkins_casc_jenkins_url_prefix: ""

Url prefix of the jenkins instance, e.g. when running in tomcat.

jenkins_casc_jenkins_base_url: "http://{{ jenkins_casc_jenkins_hostname }}:{{ jenkins_casc_jenkins_port }}{{ jenkins_casc_jenkins_url_prefix }}"

The base url of the jenkins instance.

jenkins_casc_jenkins_home: "/var/lib/jenkins"

Path to the jenkins casc directory containing the yaml files for configuration.

jenkins_casc_config_path: "{{ jenkins_casc_jenkins_home }}/jcasc"

Path to the jenkins casc directory containing the yaml files for configuration.

jenkins_casc_config_path_configure: false

Enables / Disabling the configuration of the configuration path. When this value is set to true the JcasC path in the Jenkins instance is set to jenkins_casc_config_path. When the path differs from the previous set path the configuration is directly reloaded.

jenkins_casc_config_fileglobs: []

Config files/templates to upload. When the result of this step is changed the configuration will be reloaded.

jenkins_casc_config_unmanaged_delete: false

Controls if files that existing files in the 'jenkins_casc_config_path' are deleted when they are not included in the 'jenkins_casc_config_fileglobs'. Deletion will only be executed when at least one file was uploaded to the 'jenkins_casc_config_path'.

jenkins_casc_script_timeout: 60

The timeout for jenkins_script tasks in seconds.

jenkins_casc_plugins_present:
  - name: configuration-as-code
    version: "1.3"
  - name: configuration-as-code-support
    version: "1.3"

Plugins needed for configuration-as-code.

jenkins_casc_secrets_dir: /var/jenkins_secrets

Folder where the credentials will be stored on the master. Path will be configured in environment variable SECRETS.

jenkins_casc_secrets_unmanaged_delete: true

Controls if the role will delete existing but not defined credentials from jenkins_casc_secrets_dir. Deletion will only be executed when at least one secret was uploaded to the 'jenkins_casc_secrets_dir'.

jenkins_casc_secrets: []
# Example:
# - id: credential-id
#   value: credential-value

List of id/value credential pairs. The id can then be referenced in jcasc with ${id} as value reference.

Dependencies

This role depends on the wcm_io_devops.jenkins_plugins role to install/uninstall the plugins.

As transitive dependency this role uses the wcm_io_devops.jenkins_facts role to retrieve the list of installed plugins from the Jenkins instance.

Example Playbook

This playbook will set the JCasC configuration path to /var/lib/jenkins/jcasc-folder and will deploy all .yml and .yaml files found below file/jcasc/my-jenkins/ to this folder.

- name: "Deploy jcasc"
  hosts: jenkins
  vars:
    jenkins_casc_config_path_configure: true
    jenkins_casc_config_path: "/var/lib/jenkins/jcasc-folder"
    jenkins_casc_config_fileglobs:
        - file/jcasc/my-jenkins/*.yml
        - file/jcasc/my-jenkins/*.yaml
  roles:
    - wcm_io_devops.jenkins_configuration_as_code

License

Apache 2.0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.