opstree_devops.jenkins

Ansible Role: osm_jenkins

This is an Ansible role designed to install and set up a Jenkins server.

Version History

Date Version Description Changed By
June 19, 2015 v.1.0 Initial Draft Sudipt Sharma
June 6, 2020 v.1.1 Added support for managing global credentials Shivam Tomar

Key Features

  • The role checks the system requirements (like memory and CPU cores) of the remote host. If the requirements are met, it installs the latest version of Jenkins from the repository. You can specify a version through variables if needed.
  • It allows configuration of Jenkins global credentials as code. To use this, set the variable configuration_as_code="enabled".

Supported Operating Systems

  • CentOS 7
  • CentOS 6
  • Ubuntu (Bionic)
  • Ubuntu (Xenial)

Dependencies

  • Java (version 8 preferred)

Requirements

  • curl
  • libselinux-python
  • initscripts
  • apt-transport-https

Role Variables

Variables Default Values Description
memory 1000 Total memory (in MB) required on the host
core 1 Required number of CPU cores on the host
jenkins_admin_username admin Admin username for Jenkins
jenkins_admin_password admin Admin password for Jenkins
jenkins_connection_delay 5 Time to wait for Jenkins to start
jenkins_connection_retries 60 Number of retries if Jenkins fails to start
jenkins_home /var/lib/jenkins Home directory for Jenkins
jenkins_hostname localhost Hostname for Jenkins
jenkins_http_port 8080 Port number for Jenkins
jenkins_jar_location /opt/jenkins-cli.jar Path to the Jenkins jar file
jenkins_url_prefix "" URL prefix for Jenkins URL
jenkins_java_options "-Djenkins.install.runSetupWizard=false" Java options for Jenkins
jenkins_plugins ['git'] List of plugins to install in Jenkins
jenkins_plugins_state present State of Jenkins plugins
jenkins_plugin_updates_expiration 86400 Time (in seconds) to fetch update-center.json
jenkins_plugin_timeout 300 Connection timeout for Jenkins (in seconds)
jenkins_plugins_install_dependencies yes Whether to install plugin dependencies
jenkins_process_user jenkins Username running the Jenkins process
jenkins_process_group "{{ jenkins_process_user }}" Group name for Jenkins process
configuration_as_code "disabled" Set to "enabled" to manage global credentials

Inventory Example

Your inventory should look like this:

[jenkinshost]                 
192.168.1.198    ansible_user=ubuntu   
192.168.3.201    ansible_user=opstree 

Example Playbook

Here is an example playbook:

---
- hosts: jenkinshost
  become: yes
  roles:
    - jenkins

Run the playbook with:

ansible-playbook site.yml

After successfully installing Jenkins, visit the Jenkins URL to access the login page. login

Future Proposed Changes

References

Author Information

Informazioni sul progetto

Install and configure Jenkins.

Installa
ansible-galaxy install opstree_devops.jenkins
Licenza
Unknown
Download
239
Proprietario