Skip to content

mwakizaka/ansible_ci_trial

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

README

What is this repository for?

  • Trying ansible to automatically generate a jenkins master and its build agent.

Requirements

Controller(The machine where you run Ansible

  1. Internet connection
  2. ssh client(on the controll machine)
  3. Red Hat, Debian, CentOS, OS X, any of the BSDs, and so on.
  4. Python 2.6 or 2.7
  5. Ansible 2.3.1.0(It might be possible to use an older version of Ansible though)

Linux target (to which you run your Ansible script)

  1. ssh connection
  2. Python 2.4 or higher.

Windows target (to which you run your Ansible script)

  1. PowerShell 3.0 or higher (on the target machine)
  2. Configure Windows Remote Management(on the target machine)
  3. pip install pywinrm (on the controller machine)

How to run

1. Configure below

  • inventory/hosts
  • group_vars/all (optional)
  • roles/jenkins_master/defaults/main.yml (optional)
  • roles/jenkins_windows_nodes/defaults/main.yml (optional)

2. Configure Windows Machine

PS > mkdir C:\work
PS > cd C:\work
PS > Invoke-WebRequest -Uri https://raw.githubusercontent.com/ansible/ansible/devel/examples/scripts/ConfigureRemotingForAnsible.ps1 -OutFile ConfigureRemotingForAnsible.ps1
PS > .\ConfigureRemotingForAnsible.ps1

3. Set up Controller(Mac OS or Linux)

# curl -sL https://bootstrap.pypa.io/get-pip.py | python
# pip install pywinrm
  • If you have installed Vagrant, run below(In this case you need to take care of ssh keys to access the remote repository).
$ vagrant controller up
$ vagrant ssh controller

4. Connection check

  • When it comes to ping to Linux machines.
$ ansible -i inventory/hosts -m ping jenkins_master
  • In case of Windows machines.
$ ansible -i inventory/hosts -m win_ping build_agent01

5. Then, run playbook

$ ansible-playbook -i inventory/hosts sites.yml 
  • If you want to choose a specific target to be generated, run like below
$ ansible-playbook -l build_agent01 -i inventory/hosts sites.yml

Todo

  1. Nothing to do for a while.

Future Work(Not to do right now)

Use cases

  1. Discussion about use cases and operations
  2. Selecting Jenkins plugins and versions to install
  3. Capability to run on a no-internet environment
  4. Sample jobs for jenkins master and windows node

Quality concerns

  1. How to support idempotence(since some part of the tasks contain modules which do not support idempotence)
  2. Testing the generated CI Environment with automation tools such as serverspec
  3. Tackling security issues such as ssh key files

Improve functionality

  1. How to scale the # of build agents
  2. Making Linux build agents
  3. Global Tool Configuration of jenkins such as jdk home
  4. Configure the role based strategy(If possible)

Small enhancement

  1. How to manage large files such as jdk installer
  2. Find a better way to skip the initial setup step
  3. Ignores an error which occurs when the jenkins node 'build_agent01' is already created.
  4. How to handle pinning plugins

References

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published