/ansible-jenkins-showcase

ansible showcase for deploying a CD pipeline using jenkins

Primary LanguagePython

This is an example of how Ansible can be used in an infrastructure as code environment, where all your deployment and configuration data resides in one of more GIT repositories, and the whole environment could be rebuilt from scratch at any time.

The configuration for the different jenkins jobs, pipelines, views, as well as the complete zabbix setup (including the monitored items) are all set in group_vars/all.yaml at the root of this repository:

configuration

This repo contains a demo of how ansible can be used to deploy and configure Continous Delivery pipelines using a jenkins box.

It shows how different libraries can be used with ansible to deploy and update plugins, jobs, view, pipelines:

The following roles are used in this demo,

Simply run:

rake

vagrant_up

and then connect to http://jenkins:8080

you should see a fully deployed, configured jenkins with two pipelines and a series of jobs.

The second pipeline PIPELINE2 should be automatically initiated by an Ansible task, this pipeline executes a job jinja2_deploy_zabbix with provisions and configures a zabbix server using an Ansible playbook.

Then another job jinja2_zabbix_checks will populate the zabbix server with templates, hosts, and items. Upon completion the Zabbix server will be configured to monitor itself as well as the Jenkins box which provisioned the Zabbix Server.

Access to the zabbix box on http://zabbix/zabbix/ using username:admin password:zabbix

boxes_up

Some limited support available for linode and LXC, simply use:

rake default [linode|lxc]

My lxc conf looks like:

\>cat /etc/lxc/default.conf
lxc.network.type = veth
lxc.network.link = lxcbr0
lxc.network.flags = up
lxc.network.hwaddr = 00:16:3e:xx:xx:xx
lxc.autodev = true

and my dnsmasq file: >cat /etc/dnsmasq-lxcbr0.conf interface=lxcbr0 except-interface=lo bind-interfaces

domain=lxc
dhcp-range=10.0.3.2,10.0.3.100,12h

host-record=lxchost.lxc,10.0.3.1
local=/lxc/

for linode, you need to export your linode key:

export linode_key="XXXXXXXX"