Automated Jenkins Server & Toolchain Provisioning
This creates billable resources. Run it in a dev environment and destroy it when you finish. Set a budget alarm first.
Success criteria
0 of 3
What you are building#
What are Ansible Roles and Playbooks?#
An Ansible Role is an enterprise structural convention that organizes playbooks into modular, reusable directories containing tasks, handlers, templates, variables, and defaults. Rather than writing one unmaintainable 1,000-line playbook, Ansible Roles break host provisioning into 8 specialized micro-packages:
java: Installs OpenJDK 17 (mandatory runtime for Jenkins LTS 2.555+).git: Installs Git CLI version control for automated code checkouts.docker: Installs Docker CE Engine,docker-compose-plugin, enables systemd daemon, and attachesjenkinsuser todockersocket group.jenkins: Registers official Jenkins GPG repository key, installs Jenkins LTS daemon, and enables systemd service on Port 8080.awscli: Installs AWS CLI v2 binary for Amazon ECR and EKS API interaction.kubectl: Installskubectlv1.34 binary matching EKS control plane version.helm: Installs Helm 3 binary for Kubernetes application package management.cloudwatch: Installs Amazon CloudWatch Unified Agent daemon to stream host metrics and logs to AWS CloudWatch.
ANSIBLE ROLE ORCHESTRATION PIPELINE
+-----------------------------------------------------------------------------------+
| MAIN PLAYBOOK (playbooks/site.yml) |
+-----------------------------------------------------------------------------------+
| | | | | |
v v v v v v
+-----------+ +-----------+ +-----------+ +-----------+ +-----------+ +----------+
| OpenJDK 17| | Git CLI | | Docker CE | | Jenkins | | AWS CLI | | kubectl |
| Role | | Role | | Daemon | | LTS Role | | v2 Role | | v1.34 |
+-----------+ +-----------+ +-----------+ +-----------+ +-----------+ +----------+Steps#
Step 1: Execute Toolchain Installation Playbook#
cd 02-Configuration-Management-Ansible/Lab08-Jenkins-Server-Automation
ansible-playbook -i ../Lab07-Ansible-Inventory-Setup/inventory/hosts.ini playbooks/site.ymlStep 2: Execute Post-Installation Verification Playbook#
ansible-playbook -i ../Lab07-Ansible-Inventory-Setup/inventory/hosts.ini playbooks/verify.ymlVerify it worked#
ansible-playbook -i ../Lab07-Ansible-Inventory-Setup/inventory/hosts.ini playbooks/verify.ymlExpected Output:
PLAY [Verify Toolchain Installations] ******************************************
TASK [verify : Check Docker Version] *******************************************
ok: [jenkins_host] => {
"msg": "Docker version 26.1.3, build b72abbf installed successfully"
}
TASK [verify : Check Jenkins Daemon Status] ************************************
ok: [jenkins_host] => {
"msg": "Jenkins service is active (running) on port 8080"
}
PLAY RECAP *********************************************************************
jenkins_host : ok=8 changed=0 unreachable=0 failed=0Clean up#
Run this even if you did not finish. Everything above is destroyable, and an account full of half-built experiments is how a surprise bill starts.
Destructive — This removes real resources. Check which environment you are in first.
terraform destroy -auto-approve
aws ec2 describe-instances --filters Name=instance-state-name,Values=running --query 'Reservations[].Instances[].InstanceId'Cost of this lab: Free tier — one t3.micro for Jenkins. Note that Jenkins wants more memory than a micro provides for real builds; a t3.small is ~$15/month.