Copied to Clipboard
The automation deploys this configuration, and Jenkins applies it on startup. No clicking through UI settings.
Architecture Overview
The automation deploys a complete Jenkins infrastructure on a single Android device:
┌─────────────────────────────────────┐
│ Android Phone (Termux) │
│ ┌────────────────────────────────┐ │
│ │ Jenkins Controller (Minimal) │ │
│ │ - Port 8080 (Web UI) │ │
│ │ - JCasC configured │ │
│ └──────────┬─────────────────────┘ │
│ │ SSH (localhost:8022) │
│ ┌──────────▼─────────────────────┐ │
│ │ Jenkins Agent (SSH) │ │
│ │ - Build tools installed │ │
│ │ - 2 executors │ │
│ └────────────────────────────────┘ │
└─────────────────────────────────────┘
The controller handles job orchestration while delegating builds to the agent. This mirrors production setups and teaches Jenkins best practices.
Quick Start Guide
Ready to try it yourself?
Prerequisites
On the Android device: * Android 7.0 or later * Termux app installed from F-Droid * At least 2GB free storage
On your laptop/PC: * Ansible 2.10+ * SSH client * Git
Installation
== 1. On the Android device (in Termux)
pkg install openssh python
sshd
passwd
whoami
ifconfig wlan0
== 2. On your laptop/PC
git clone https://github.com/gounthar/termux-jenkins-automation.git
cd termux-jenkins-automation
./scripts/run-setup.sh
== 3. Answer prompts:
== - IP address (from ifconfig)
== - SSH port (8022 default)
== - Username (from whoami)
== - Jenkins admin password
== - Authentication method (SSH key recommended)
== 4. Wait ~15 minutes
== 5. Access Jenkins:
== http://<phone-ip>:8080
That’s it! The script handles prerequisites checking, inventory configuration, and playbook execution.
Why This Matters
Environmental Impact
According to the UN, 53.6 million metric tons of e-waste were generated globally in 2019. A significant portion is functional smartphones replaced by newer models.
This project demonstrates: * Practical e-waste repurposing * Extending hardware lifecycle * Low-power CI/CD infrastructure * Educational value (learn Jenkins without cloud costs)
Technical Learning
Building this automation taught: * Infrastructure as Code principles * Service management best practices * Configuration as Code (JCasC) * Fresh installation testing methodology * Ansible role architecture * SSH security and key management
These lessons apply far beyond Android - they’re fundamental DevOps skills.
Cost-Effective CI/CD
For hobbyists, students, or small projects: * Cost: \0ドル (using existing hardware) * Power consumption: ~5W (vs. 200W+ for traditional server) * Noise: Silent * Space: Fits in a drawer
Perfect for learning, experimentation, or lightweight CI/CD pipelines.
Lessons for Production Jenkins
While this project targets Android devices, the patterns apply to any Jenkins deployment:
Infrastructure as Code: All configuration in version control
Service Management: Proper process supervision (systemd, runit, etc.)
Configuration as Code: JCasC for reproducible Jenkins configuration
Fresh Installation Testing: Never assume dependencies are present
Modular Roles: Break automation into focused, reusable components
Documentation: Comprehensive setup guides prevent "it works on my machine"
The termux-jenkins-automation repository demonstrates these principles in a constrained environment (no root, mobile platform, limited resources). If it works on Android, these patterns will definitely work on traditional servers.
What’s Next?
The automation is production-ready for single-device setups. Future enhancements could include:
Multi-device clustering: Coordinate multiple Android phones as a Jenkins cluster
Plugin automation: Automated plugin installation and updates via JCasC
Backup/restore workflows: Scheduled backups to cloud storage (S3, Google Drive)
Performance optimization: Memory tuning for constrained devices
Monitoring integration: Prometheus metrics export
Web UI for setup: Replace script prompts with web interface
Docker support: Run Jenkins in Termux using Docker (experimental)
The foundation is solid. The patterns are proven. The infrastructure is code.
Resources
Conclusion
From naive experiment to production-ready automation - that’s the Infrastructure as Code journey.
What started as "can I run Jenkins on an old phone?" became a comprehensive automation solution demonstrating:
✅ Infrastructure as Code principles
✅ Configuration as Code with JCasC
✅ Systematic testing methodologies
✅ Service management best practices
✅ Modular, reusable Ansible architecture
✅ Environmental sustainability
✅ Cost-effective learning platform
The final result? A 98% automated setup that deploys Jenkins in under 15 minutes on a device most people would throw away.
Whether you’re repurposing e-waste, building a home lab, learning Jenkins administration, or just enjoy a good technical challenge - this automation provides a reproducible path from bare Android device to functioning Jenkins infrastructure.
Every drawer has potential infrastructure gathering dust. Let’s put it to work.
Have questions or improvements? Open an issue or pull request on GitHub. I’d love to see what you build with this!