What is this repository for?
Trying ansible to automatically generate a jenkins master and its build agent.
Controller(The machine where you run Ansible
Internet connection
ssh client(on the controll machine)
Red Hat, Debian, CentOS, OS X, any of the BSDs, and so on.
Python 2.6 or 2.7
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)
ssh connection
Python 2.4 or higher.
Windows target (to which you run your Ansible script)
PowerShell 3.0 or higher (on the target machine)
Configure Windows Remote Management(on the target machine)
pip install pywinrm (on the controller machine)
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
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
$ 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
Nothing to do for a while.
Future Work(Not to do right now)
Discussion about use cases and operations
Selecting Jenkins plugins and versions to install
Capability to run on a no-internet environment
Sample jobs for jenkins master and windows node
How to support idempotence(since some part of the tasks contain modules which do not support idempotence)
Testing the generated CI Environment with automation tools such as serverspec
Tackling security issues such as ssh key files
How to scale the # of build agents
Making Linux build agents
Global Tool Configuration of jenkins such as jdk home
Configure the role based strategy(If possible)
How to manage large files such as jdk installer
Find a better way to skip the initial setup step
Ignores an error which occurs when the jenkins node 'build_agent01' is already created.
How to handle pinning plugins