meierw.jenkins_config
jenkins_config
Ansible role which manages various options/configurations in Jenkins.
Requirements
- A Jenkins service plus any plugin that you plan to configure.
 - The ability to execute jenkins_script against said Jenkins service.
 
Role Variables
IMPORTANT: When specified, most of these variables will overwrite previously set Jenkins options. Be mindful that you don't lose any setting, that you have previously set up.
jenkins_config_url: http://localhost:8080
jenkins_config_user: admin
jenkins_config_password: admin
The URL, username and password for authenticating with Jenkins. Will be used to execute jenkins_script.
jenkins_config_csrf_enabled: null
CSRF Protection state to set in Jenkins settings. Set doesn't happen, unless one of the supported values is specified.
Supported values:
truefalse
jenkins_config_global_environment_variables: []
# jenkins_config_global_environment_variables:
#   - name: FOO
#     value: bar
#   - name: TOKEN
#     value: xxxyyyzzz
Jenkins Global Environment variables to set in Jenkins settings. Set doesn't happen if list is empty.
jenkins_config_pipeline_durability: ''
Pipeline Default Speed/Durability Level to set in Jenkins settings. Set doesn't happen, unless one of the supported values is specified.
Supported values:
max_survivabilityperformance_optimizedsurvivable_nonatomic
jenkins_config_simple_theme_css_url: ''
# jenkins_config_simple_theme_css_url: https://cdn.rawgit.com/afonsof/jenkins-material-theme/gh-pages/dist/material-indigo.css
URL of theme CSS to set in Jenkins Simple Theme settings. Set doesn't happen, if this value is empty.
jenkins_config_jenkins_url: ''
Jenkins URL to set in Jenkins settings. Set doesn't happen, if this value is empty.
jenkins_config_system_admin_email: ''
System Admin e-mail address to set in Jenkins settings. Set doesn't happen, if this value is empty.
jenkins_config_global_pipeline_libraries: []
# jenkins_config_global_pipeline_libraries:
#   - name: global-pipeline-library
#     default_version: master
#     load_implicitly: false
#     allow_default_version_override: true
#     scm_git_path: '[email protected]:example/global-pipeline-library.git'
#     scm_credentials_id: jenkins-ssh
Global Pipeline Libraries to set in Jenkins settings. All fields should contain a non-null value (empty / 0 / etc. depending on type). Set doesn't happen if list is empty.
Mandatory fields (cannot be empty):
namescm_git_pathscm_credentials_id
jenkins_config_email_notification: null
# jenkins_config_email_notification:
#   smtp_server: smtp.gmail.com
#   default_user_email_suffix: @example.com
#   smtp_auth_username: example
#   smtp_auth_password: "{{ secret_smtp_password }}"
#   use_ssl: false
#   smtp_port: 465
#   reply_to_address: ''
#   charset: UTF-8
E-mail Notification values to set in Jenkins settings.
All fields should contain a non-null value (empty / 0 / etc. depending on type).
Set doesn't happen, if jenkins_config_email_notification.smtp_server is undefined.
jenkins_config_credentials: []
# jenkins_config_credentials:
#   - kind: ssh_username_with_private_key
#     id: jenkins-ssh
#     username: jenkins
#     private_key: "{{ secret_key }}"
#     passphrase: ''
#     description: Key added from Ansible
Credentials to set in the Global scope. All fields should contain a non-null value (empty / 0 / etc. depending on type). Set doesn't happen if list is empty.
Mandatory fields (cannot be empty):
kindid
Supported kind and extra fields needed for it:
username_with_passwordid: stringusername: stringpassword: stringdescription: string
ssh_username_with_private_keyid: stringusername: stringprivate_key: stringpassphrase: stringdescription: string
jenkins_config_nodes: []
# jenkins_config_nodes:
#   - name: slave0
#     description: Node added from Ansible
#     num_of_executors: 2
#     remote_root_directory: /var/lib/jenkins
#     labels: labels separated by spaces
#     usage: exclusive
#     launch_method:
#       type: via_ssh
#       host: slave0.example.com
#       port: 22
#       credentials_id: jenkins-ssh
#       verification_strategy:
#         type: manually_trusted_key
#         require_initial_manual_trust: true
#     availability:
#       type: always
#     environment_variables: # optional definition
#       - name: FOO
#         value: bar
#     disable_deferred_wipeout: true # optional definition
Nodes to set in Jenkins. All defined fields should contain a non-null value (empty / 0 / etc. depending on type). Set doesn't happen if list is empty.
Mandatory fields (cannot be empty):
namenum_of_executorsremote_root_directoryusagelaunch_methodavailability
Supported usage values:
normalexclusive
Supported launch_method : type and extra fields needed for it:
via_commandcommand: string
via_sshhost: stringport: integercredentials_id: string- Supported 
verification_strategy:typeand extra fields needed for it:known_hosts_filemanually_provided_keyssh_key: string
manually_trusted_keyrequire_initial_manual_trust: boolean
non_verifying
 
Supported availability : type and extra fields needed for it:
alwaysschedulestartup_schedule: stringscheduled_uptime: integerkeep_up_when_active: boolean
demandin_demand_delay: integeridle_delay: integer
Example Playbook
- hosts: servers
  roles:
    - { role: meierw.jenkins_config }
License
MIT
Author Information
- Author: Walter Meier
 
Manages various options/configurations in Jenkins.
ansible-galaxy install meierw.jenkins_config