This Ansible playbook installs and configures Jenkins on a CentOS machine.
-
Clone this repository: git clone https://github.com/utrains/ansible-playbooks-roles.git
-
Edit the
vars.yml
file with your desired configuration. -
Run the playbook with the following command:
ansible-playbook main.yml
This playbook performs the following tasks:
- Downloads the Long Term Jenkins release.
- Imports the Jenkins key from URL.
- Performs a yum update.
- Installs Java.
- Installs Jenkins.
- Reloads the daemon to pick up config changes.
- Starts Jenkins.
- Starts the firewalld service.
- Allows incoming traffic on port 8080.
- Displays the contents of the Jenkins initial admin password.
The following variables can be set in the vars.yml
file:
jenkins_host
: The host where Jenkins will be installed.jenkins_remote_user
: The remote user to be used to connect to the host.jenkins_become_user
: The user to become after connecting to the host.jenkins_key_url
: The URL of the Jenkins key to import.