mircomasa.jenkins_slave

jenkins-slave Role

======================== License Pipeline Status Galaxy Ansible

This role sets up a new Jenkins slave node and connects it to the Jenkins master.

Requirements


  • Ansible version: >=2.8
  • Supported Operating Systems
    • EL (Enterprise Linux)
      • 7
      • 8
    • Amazon Linux 2
    • Ubuntu
      • xenial
      • bionic
    • Debian
      • stretch
    • Windows
      • 2016
      • 2019

Dependencies


Java 8 Build Status

Role Variables


  • Required

    • master_username: Jenkins master CLI username. Default is admin.
    • master_password: Jenkins master CLI password. Default is admin.
    • master_host: Fully Qualified Domain Name or IP of Jenkins master. Default is {{ ansible_host }}.
    • master_port: Jenkins master HTTP port. Default is 8080.
  • General Defaults

    • slave_agent_name: Name of the slave node. Default is agent.
    • slave_executors_num: Number of executors on the slave. Default is 1.
    • slave_environments: Environment variables for the slave. Default is {}.
    • slave_mode_exclusive: If true, the node only builds jobs matching specific 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 credentials ID on the Jenkins master. Default is ci_slave.
    • slave_linux_jenkins_username: Username defined in slave_linux_jenkins_cred_id. Default is user.
    • slave_linux_jenkins_password: Password for the new user. Default is password.
    • slave_linux_jenkins_public_key: Public key for the slave user. Default is "".
    • slave_linux_home: Path for Jenkins slave binaries. Default is /opt/jenkins.
    • slave_linux_user_group: 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. 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 binaries. Default is C:/Jenkins_Slave.
    • slave_windows_service: Windows service name. Default is jenkins-slave.
    • slave_windows_java_opts: Additional 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 username.

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 custom 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 on remote hosts 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: | 
      Nck6x4HPr... (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 mircomasa.jenkins_slave
Licenza
apache-2.0
Download
3.5k
Proprietario