darkwizard242.jenkinslts

Ansible Role: jenkinslts

This role installs the Long Term Support (LTS) version of Jenkins for systems based on Debian and EL (Enterprise Linux). It can also uninstall Jenkins if specified.

Requirements

You need Java for Jenkins to work. You can install Java using the darkwizard242.adoptopenjdk role.

Role Variables

Here are the variables you can customize, found in defaults/main.yml:

Variables List:

jenkinslts_user: jenkins
jenkinslts_group: jenkins
jenkinslts_group_desired_state: present
jenkinslts_user_home: "/var/lib/{{ jenkinslts_user }}"
jenkinslts_user_shell: /bin/false
jenkinslts_user_desired_state: present
jenkinslts_app_name: jenkins
jenkinslts_debian_gpg_key: https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key
jenkinslts_el_gpg_key: https://pkg.jenkins.io/redhat-stable/jenkins.io-2023.key
jenkinslts_repo_debian: deb https://pkg.jenkins.io/debian-stable binary/
jenkinslts_repo_debian_filename: "{{ jenkinslts_app_name }}"
jenkinslts_repo_el_name: jenkins
jenkinslts_repo_el_description: Jenkins
jenkinslts_repo_el: http://pkg.jenkins.io/redhat-stable
jenkinslts_repo_el_filename: "{{ jenkinslts_app_name }}"
jenkinslts_repo_el_gpgcheck: yes
jenkinslts_repo_desired_state: present
jenkinslts_desired_state: present
jenkinslts_default_debain_config_file: /etc/default/jenkins
jenkinslts_default_el_config_file: /etc/sysconfig/jenkins
jenkinslts_app_port: 8080
jenkinslts_app_heapsize_max: 256m
jenkinslts_service_name: jenkins
jenkinslts_service_desired_state: restarted
jenkinslts_service_desired_boot_enabled: yes
jenkinslts_app_check_status_code: 200
jenkinslts_app_check_status_code_retries: 10
jenkinslts_app_check_status_code_delay: 5
jenkinslts_app_admin_password_file: "{{ jenkinslts_user_home }}/secrets/initialAdminPassword"

Variables Table:

Variable Description
jenkinslts_group The group that the Jenkins user will belong to. Required only on Debian systems.
jenkinslts_group_desired_state present means create the group if it doesn't exist. Alternatively, set to absent.
jenkinslts_user The user that will own Jenkins.
jenkinslts_user_home Home directory for Jenkins user, default is /var/lib/jenkins.
jenkinslts_user_shell The shell for the Jenkins user, often set to /bin/false.
jenkinslts_user_desired_state present indicates the user will be created if it doesn't exist. Alternatively, set to absent.
jenkinslts_debian_gpg_key GPG key for Jenkins on Debian systems.
jenkinslts_el_gpg_key GPG key for Jenkins on EL systems.
jenkinslts_repo_debian Repository for Jenkins on Debian systems.
jenkinslts_repo_debian_filename Repository file that will be added for Jenkins on Debian systems.
jenkinslts_repo_el_name Repository name for Jenkins on EL systems.
jenkinslts_repo_el_description Description for Jenkins repo on EL systems.
jenkinslts_repo_el Base URL for Jenkins on EL systems.
jenkinslts_repo_el_gpgcheck Whether to perform a GPG check on EL systems.
jenkinslts_repo_desired_state present means create the repository file if it doesn't exist. Alternatively, set to absent (not recommended).
jenkinslts_app_name Name of the Jenkins application (usually jenkins).
jenkinslts_desired_state State of the Jenkins package; can be present, latest, or absent.
jenkinslts_default_debain_config_file Default configuration file for Jenkins on Debian systems.
jenkinslts_default_el_config_file Default configuration file for Jenkins on EL systems.
jenkinslts_app_port Port for Jenkins to use (default is 8080).
jenkinslts_app_heapsize_max Maximum Java heap size for Jenkins (default is 256 MB).
jenkinslts_service_name Service name for Jenkins.
jenkinslts_service_desired_state Desired state for the Jenkins service (running, stopped, etc.).
jenkinslts_service_desired_boot_enabled Whether the Jenkins service should start on boot.
jenkinslts_app_check_status_code HTTP status code to check Jenkins app status (default is 200).
jenkinslts_app_check_status_code_retries Number of retries for checking Jenkins app (default is 10).
jenkinslts_app_check_status_code_delay Delay between retries for checking Jenkins app (default is 5 seconds).
jenkinslts_app_admin_password_file File containing the default admin password for Jenkins UI.

Dependencies

Java is required for Jenkins.

You can install Java using the darkwizard242.adoptopenjdk role.

Example Playbook

To install Jenkins using this role in an Ansible playbook, use the following code:

- hosts: servers
  roles:
    - darkwizard242.jenkinslts

For installing Java alongside Jenkins, modify the playbook like this:

- hosts: servers
  roles:
    - darkwizard242.adoptopenjdk
    - darkwizard242.jenkinslts
  vars:
    adoptopenjdk_app_name: adoptopenjdk-11-hotspot
    adoptopenjdk_desired_state: present
    jenkinslts_desired_state: latest

To uninstall Jenkins, your playbook will look like this:

- hosts: servers
  roles:
    - darkwizard242.jenkinslts
  vars:
    jenkinslts_desired_state: absent

License

This role is licensed under MIT.

Author Information

This role was created by Ali Muhammad.

Informazioni sul progetto

Jenkins LTS version installation on Ubuntu xenial/bionic, Debian stretch and CentOS7.

Installa
ansible-galaxy install darkwizard242.jenkinslts
Licenza
mit
Download
4.9k
Proprietario
Senior DevOps/CloudOps Engineer. Dedicated to Automating everything I come across. Love to work on and learn new technologies/tools everyday!