lean_delivery.jenkins_slave

jenkins-slave Role

================== License pipeline status

This role helps you set up a new Jenkins slave node and connect it to the Jenkins master.

Requirements


  • You need to have Ansible version 2.8 or higher.
  • Supported Operating Systems:
    • EL (CentOS/RHEL):
      • 7
      • 8
    • Amazon Linux 2
    • Ubuntu:
      • xenial
      • bionic
    • Debian:
      • stretch
    • Windows:
      • 2016
      • 2019

Dependencies


Java 8 Build Status

Role Variables


  • Required Variables:

    • master_username: Jenkins master username. Default is admin.
    • master_password: Jenkins master user password. Default is admin.
    • master_host: The full domain name (FQDN) or IP of the Jenkins master. Default is {{ ansible_host }}.
    • master_port: Jenkins master HTTP port. Default is 8080.
  • General Defaults:

    • slave_agent_name: Name for the slave node. Default is agent.
    • slave_executors_num: Number of executors on the slave node. Default is 1.
    • slave_environments: Environment variables for the slave. Default is {}.
    • slave_mode_exclusive: If true, the node will only build jobs with matching labels. Default is false.
    • master_url: URL of the Jenkins master. Default is http://{{ master_host }}:{{ master_port }}.
  • Linux Defaults:

    • slave_linux_jenkins_cred_id: Existing Jenkins credentials ID. Default is ci_slave.
    • slave_linux_jenkins_username: Username for a new user on the slave. Default is user.
    • slave_linux_jenkins_password: Password for the new user. Default is password.
    • slave_linux_jenkins_public_key: Public key for SSH access. Default is "".
    • slave_linux_home: Path for Jenkins slave files. Default is /opt/jenkins.
    • slave_linux_user_group: User group for the new user. Default is user.
    • slave_linux_host: Host for the Jenkins slave. Default is {{ ansible_host }}.
    • slave_linux_ssh_port: SSH port for the slave. Default is 22.
    • slave_linux_selinux_ports: SELinux ports. Default is "{{ master_port }},49187,{{ slave_linux_ssh_port }}".
    • slave_linux_labels: Labels for the slave node. Default is ['linux'].
  • Windows Defaults:

    • slave_windows_workdir: Path for Jenkins slave files. Default is C:/Jenkins_Slave.
    • slave_windows_service: Windows service name. Default is jenkins-slave.
    • slave_windows_java_opts: Java options. Default is "".
    • slave_windows_labels: Labels for the slave node. Default is ['windows'].
    • slave_windows_service_user: Username for the service.
    • slave_windows_service_password: Password for the service user.

Example Playbook

- name: "Install Jenkins slave on remote hosts with default credentials"
  hosts: slave

  vars:
    master_host: master.example.com

  roles:
    - role: lean_delivery.jenkins_slave
- name: "Install Jenkins slave on remote hosts with new credentials"
  hosts: one_slave

  vars:
    master_host: master.example.com
    slave_linux_jenkins_cred_id: new_cred
    slave_linux_jenkins_username: new_user
    slave_linux_jenkins_password: new_password
    slave_agent_name: new_linux_slave

  roles:
    - role: lean_delivery.jenkins_slave
- name: "Install Jenkins slave with SSH credentials"
  hosts: many_slaves

  vars:
    master_host: master.example.com
    slave_linux_jenkins_cred_id: new_cred
    slave_linux_jenkins_username: new_user
    slave_linux_jenkins_public_key: your_public_key_here

  roles:
    - role: lean_delivery.jenkins_slave

Inventory Example

[master]
master.example.com

[one_slave]
slave.example.com

[many_slaves]
slave1.example.com slave_agent_name=slave1
slave2.example.com slave_agent_name=slave2

License


Apache License

Author Information


Authors:

Informazioni sul progetto

Ansible Role - Jenkins Slaves installation and configuration

Installa
ansible-galaxy install lean_delivery.jenkins_slave
Licenza
apache-2.0
Download
14.8k
Proprietario
Simplify by using!