GithubHelp home page GithubHelp logo

sandiegobrandon / ansible-role-jenkins-slave Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lean-delivery/ansible-role-jenkins-slave

0.0 1.0 0.0 80 KB

Ansible Role - Jenkins Slaves installation and configuration

License: Apache License 2.0

Python 100.00%

ansible-role-jenkins-slave's Introduction

jenkins-slave role

License Build Status Build Status Galaxy Ansible Ansible

This role sets up a new jenkins slave node and adds it to the jenkins master.

Requirements


  • Version of the ansible for installation: >=2.7
  • Supported OS
    • EL
      • 7
    • Amazon Linux 2
    • Ubuntu
      • xenial
      • bionic
    • Debian
      • stretch
    • Windows
      • 2016
      • 2019

Dependencies


Java 8 Build Status

Role Variables


  • required

    • master_username Jenkins master CLI user name. Default value is admin.
    • master_password Jenkins master CLI user password. Default value is admin.
    • master_host FQDN name or IP address of the jenkins master host. Default value is {{ ansible_host }}.
    • master_port Jenkins master http port. Default value is 8080.
  • general defaults

    • slave_agent_name Agent name of the slave node. Default value is agent.
    • slave_executors_num Number of executors of the slave node. Default value is 1.
    • slave_environments Dictionary of env variables to be set on slave. Default value is {}
    • slave_mode_exclusive Set usage of this node. If true, node will only build jobs with matching label expressions. Default value is false.
    • master_url Jenkins master host URL. Default value is http://{{ master_host }}:{{ master_port }}.
  • linux defaults

    • slave_linux_jenkins_cred_id Already exist credentials id on the jenkins master: Default value is ci_slave.
    • slave_linux_jenkins_username User name that is defined in slave_linux_jenkins_cred_id. A new user with this name to be created on the slave node. Default value is user.
    • slave_linux_jenkins_password Password for a new user on the slave node. Must match with the credentials password if its kind is 'Username with password'. Default value is 'password'.
    • slave_linux_jenkins_public_key Public key that to be added to authorized_keys slave user file. Private key is placed in the credentials on the jenkins master if its kind is 'SSH Username with private key'. Default value is "".
    • slave_linux_home Home path for deploying jenkins slave binaries. Default value is /opt/jenkins.
    • slave_linux_user_group Group for a new user on the slave node. Default value is user.
    • slave_linux_host Host where jenkins slave is installed to. Default value is "{{ ansible_host }}".
    • slave_linux_ssh_port SSH port of the slave node. Default value is 22.
    • slave_linux_selinux_ports Selinux ports of the slave node. Default value is "{{ master_port }},49187,{{ slave_linux_ssh_port }}".
    • slave_linux_labels List of labels for the slave node. Default value is ['linux'].
  • windows defaults

    • slave_windows_workdir Home path for deploying jenkins slave binaries. Default value is C:/Jenkins_Slave.
    • slave_windows_service Windows service name. Default value is jenkins-slave.
    • slave_windows_java_opts Additional options to pass to java. Default value is "".
    • slave_windows_labels List of labels for the slave node. Default value is ['windows'].
    • slave_windows_service_user The username to set the service to start as.
    • slave_windows_service_password The password of given username to set the service to start as.

Example Playbook

- name: "Install jenkins-slave on remote hosts using default 'Username with password' credentials"
  hosts: slave

  vars:
    master_host: master.example.com

  roles:
    - role: lean_delivery.jenkins_slave
- name: "Install jenkins-slave on remote hosts using created 'Username with password' 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 using created 'SSH Username with private key' 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:
Nck6x4HPrsdfkjhwhf98239hfoijhpowifnYXRXAW1GYGC3lsq7FpWjCeN8wT5QzRsblTh6HZKqh96K3Jj6kpob8ykjhsdkfjhskdfuhksdjfhksjdfhksfjhhkjhUHKUHDKFksjdfhkjshdfXPlx2xSUINDsH2IACLjIrxSAppxITzR7fHZyLmkjsdhfkuwhe98237982fhksdfhksdfhkuhCmcvH6fdVtozo42lXt4QgKytGtiuGAT+lN+uJ4LVGOq32WiEbYKbc7WE7N

  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:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.