Skip to content

Spin up an AWS EC2 instance running Jenkins CI, using Ansible

Notifications You must be signed in to change notification settings

phips/aws-jenkins

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spin up Jenkins on AWS EC2 using Ansible

Introduction

This is an Ansible playbook to install and run the Jenkins CI system on an AWS EC2 instance.

Jenkins is started as its own service, and not proxied via a web server. That is left as an exercise for the reader :-)

Running

Naturally, you need Ansible installed on your host system before using this.

You will also need to export AWS_ACCESS_KEY and AWS_SECRET_KEY as environment varibles before running the playbook. These are your AWS access values.

Then run ansible-playbook ec2.yaml -e 'keypair=FOO' where FOO is the name of your AWS keypair.

Details

Note this play is written to ONLY run on an RPM based distro. You could always extend/alter it to work on a dpkg based distro. Additionally, it also makes some assumptions based on the AMI used - the Amazon Linux AMI already has a usable Java installed, so we don't need to handle that here.

The first part of the play, the ec2.yaml file, will spin up a single, t1.micro, Amazon Linux instance in eu-west-1. Variables to control these elements are defined at the top of the playbook, in the vars section. You can change these as required, either in the file or on the command line with --extra-vars passed to ansible-playbook.

If you have DNS in Route53 the play can also create a DNS entry. By default this is not set to run, but specify --extra-vars="set_dns=True dns_zone=ZONENAME" at runtime and an entry ci.ZONENAME will also be created.

NOTE: The first part of the play, 'ec2.yaml' will create a new EC2 instance every time it is run. This is the nature of the ec2 module.

About

Spin up an AWS EC2 instance running Jenkins CI, using Ansible

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages