meierw.jenkins_config
jenkins_config
==============
This Ansible role manages different settings and configurations in Jenkins.
Requirements
- A running Jenkins service and any plugins you want to set up.
- The ability to run jenkins_script against your Jenkins service.
Role Variables
IMPORTANT: Most of these variables will replace any existing Jenkins settings. Be careful not to lose your previous configurations.
jenkins_config_url: http://localhost:8080
jenkins_config_user: admin
jenkins_config_password: admin
This is the URL, username, and password for accessing Jenkins. It will be used to run jenkins_script
.
jenkins_config_csrf_enabled: null
Set the CSRF Protection state in Jenkins. It won't change unless one of the allowed values is given.
Allowed values:
true
false
jenkins_config_global_environment_variables: []
# Example:
# jenkins_config_global_environment_variables:
# - name: FOO
# value: bar
# - name: TOKEN
# value: xxxyyyzzz
Global Environment variables to set in Jenkins. It won't change if the list is empty.
jenkins_config_pipeline_durability: ''
Set the default Pipeline Speed/Durability Level in Jenkins. It won't change unless one of the allowed values is given.
Allowed values:
max_survivability
performance_optimized
survivable_nonatomic
jenkins_config_simple_theme_css_url: ''
# Example:
# jenkins_config_simple_theme_css_url: https://cdn.rawgit.com/afonsof/jenkins-material-theme/gh-pages/dist/material-indigo.css
URL for the CSS of the theme in Jenkins. It won't change if this value is empty.
jenkins_config_jenkins_url: ''
Jenkins URL to set in Jenkins settings. It won't change if this value is empty.
jenkins_config_system_admin_email: ''
Admin email address for the Jenkins system. It won't change if this value is empty.
jenkins_config_global_pipeline_libraries: []
# Example:
# 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. All fields must have a value. It won't change if the list is empty.
Required fields (cannot be empty):
name
scm_git_path
scm_credentials_id
jenkins_config_email_notification: null
# Example:
# 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
Email Notification settings for Jenkins. All fields must have a value. It won't change if jenkins_config_email_notification.smtp_server
is not set.
jenkins_config_credentials: []
# Example:
# 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 for Jenkins. All fields must have a value. It won't change if the list is empty.
Required fields (cannot be empty):
kind
id
Allowed kind
with extra required fields:
username_with_password
id
: stringusername
: stringpassword
: stringdescription
: string
ssh_username_with_private_key
id
: stringusername
: stringprivate_key
: stringpassphrase
: stringdescription
: string
jenkins_config_nodes: []
# Example:
# 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
# - name: FOO
# value: bar
# disable_deferred_wipeout: true # optional
Nodes to set in Jenkins. All fields must have a value. It won't change if the list is empty.
Required fields (cannot be empty):
name
num_of_executors
remote_root_directory
usage
launch_method
availability
Allowed usage
values:
normal
exclusive
Allowed launch_method
: type
and extra fields required:
via_command
command
: string
via_ssh
host
: stringport
: integercredentials_id
: string- Allowed
verification_strategy
:type
and extra fields needed:known_hosts_file
manually_provided_key
ssh_key
: string
manually_trusted_key
require_initial_manual_trust
: boolean
non_verifying
Allowed availability
: type
and extra fields required:
always
schedule
startup_schedule
: stringscheduled_uptime
: integerkeep_up_when_active
: boolean
demand
in_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