Quantcast
Channel: DevOps tips & tricks
Viewing all articles
Browse latest Browse all 181

Install Jenkins via Ansible

$
0
0

HOWTO 


  • Install Jenkins using Galaxy role  https://training.galaxyproject.org/training-material/topics/admin/tutorials/jenkins/tutorial.html
  • Configure nodes  https://www.howtoforge.com/tutorial/ubuntu-jenkins-master-slave/



 Clone repository repo with plapybook

https://github.com/dveselka/devops-ansible/tree/master/jenkins

[dave@dave ~]$ git clone https://github.com/dveselka/devops-ansible

Install Ansible Galaxy roles
[dave@dave ~]$ cd devops-ansible/
[dave@dave devops-ansible]$ cd jenkins/
[dave@dave jenkins]$ ls
create_jenkins.yml dev_vars.yml README.md requirements.yml
[dave@dave jenkins]$ ansible-galaxy install -p roles -r requirements.yml
- downloading role 'java', owned by geerlingguy
- downloading role from https://github.com/geerlingguy/ansible-role-java/archive/1.10.0.tar.gz
- extracting geerlingguy.java to /home/dave/devops-ansible/jenkins/roles/geerlingguy.java
- geerlingguy.java (1.10.0) was installed successfully
- downloading role 'jenkins', owned by geerlingguy
- downloading role from https://github.com/geerlingguy/ansible-role-jenkins/archive/4.3.0.tar.gz
- extracting geerlingguy.jenkins to /home/dave/devops-ansible/jenkins/roles/geerlingguy.jenkins
- geerlingguy.jenkins (4.3.0) was installed successfully


Check Java version
[dave@dave jenkins]$ java -version
java version "11.0.9" 2020-10-20 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.9+7-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.9+7-LTS, mixed mode)



Run Ansible playbook
[dave@dave jenkins]$ ansible-playbook -K  create_jenkins.yml 
BECOME password:
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'

PLAY [Install Jenkins on localhost] *****************************************************************************************************************************************************************************

TASK [Gathering Facts] ******************************************************************************************************************************************************************************************
ok: [localhost]

TASK [geerlingguy.java : Include OS-specific variables for Fedora or FreeBSD.] **********************************************************************************************************************************
ok: [localhost]

TASK [geerlingguy.java : Include version-specific variables for CentOS/RHEL.] ***********************************************************************************************************************************
skipping: [localhost]

TASK [geerlingguy.java : Include version-specific variables for Ubuntu.] ****************************************************************************************************************************************
skipping: [localhost]

TASK [geerlingguy.java : Include version-specific variables for Debian.] ****************************************************************************************************************************************
skipping: [localhost]

TASK [geerlingguy.java : Define java_packages.] *****************************************************************************************************************************************************************
ok: [localhost]

TASK [geerlingguy.java : include_tasks] *************************************************************************************************************************************************************************
included: /home/dave/devops-ansible/jenkins/roles/geerlingguy.java/tasks/setup-RedHat.yml for localhost

TASK [geerlingguy.java : Ensure Java is installed.] *************************************************************************************************************************************************************
ok: [localhost]

TASK [geerlingguy.java : include_tasks] *************************************************************************************************************************************************************************
skipping: [localhost]

TASK [geerlingguy.java : include_tasks] *************************************************************************************************************************************************************************
skipping: [localhost]

TASK [geerlingguy.java : Set JAVA_HOME if configured.] **********************************************************************************************************************************************************
changed: [localhost]

TASK [geerlingguy.jenkins : Include OS-Specific variables] ******************************************************************************************************************************************************
ok: [localhost]

TASK [geerlingguy.jenkins : Define jenkins_repo_url] ************************************************************************************************************************************************************
ok: [localhost]

TASK [geerlingguy.jenkins : Define jenkins_repo_key_url] ********************************************************************************************************************************************************
ok: [localhost]

TASK [geerlingguy.jenkins : Define jenkins_pkg_url] *************************************************************************************************************************************************************
ok: [localhost]

TASK [geerlingguy.jenkins : include_tasks] **********************************************************************************************************************************************************************
included: /home/dave/devops-ansible/jenkins/roles/geerlingguy.jenkins/tasks/setup-RedHat.yml for localhost

TASK [geerlingguy.jenkins : Ensure dependencies are installed.] *************************************************************************************************************************************************
ok: [localhost]

TASK [geerlingguy.jenkins : Ensure Jenkins repo is installed.] **************************************************************************************************************************************************
changed: [localhost]

TASK [geerlingguy.jenkins : Add Jenkins repo GPG key.] **********************************************************************************************************************************************************
changed: [localhost]

TASK [geerlingguy.jenkins : Download specific Jenkins version.] *************************************************************************************************************************************************
skipping: [localhost]

TASK [geerlingguy.jenkins : Check if we downloaded a specific version of Jenkins.] ******************************************************************************************************************************
skipping: [localhost]

TASK [geerlingguy.jenkins : Install our specific version of Jenkins.] *******************************************************************************************************************************************
skipping: [localhost]

TASK [geerlingguy.jenkins : Ensure Jenkins is installed.] *******************************************************************************************************************************************************
changed: [localhost]

TASK [geerlingguy.jenkins : include_tasks] **********************************************************************************************************************************************************************
skipping: [localhost]

TASK [geerlingguy.jenkins : include_tasks] **********************************************************************************************************************************************************************
included: /home/dave/devops-ansible/jenkins/roles/geerlingguy.jenkins/tasks/settings.yml for localhost

TASK [geerlingguy.jenkins : Check if jenkins_init_file exists.] *************************************************************************************************************************************************
ok: [localhost]

TASK [geerlingguy.jenkins : Ensure jenkins_init_file exists.] ***************************************************************************************************************************************************
skipping: [localhost]

TASK [geerlingguy.jenkins : Modify variables in init file.] *****************************************************************************************************************************************************
changed: [localhost] => (item={'option': 'JENKINS_ARGS', 'value': '--prefix='})
changed: [localhost] => (item={'option': 'JENKINS_JAVA_OPTIONS', 'value': '-Xmx4096M'})

TASK [geerlingguy.jenkins : Ensure jenkins_home /var/lib/jenkins exists.] ***************************************************************************************************************************************
ok: [localhost]

TASK [geerlingguy.jenkins : Set the Jenkins home directory.] ****************************************************************************************************************************************************
changed: [localhost]

TASK [geerlingguy.jenkins : Immediately restart Jenkins on init config changes.] ********************************************************************************************************************************
changed: [localhost]

TASK [geerlingguy.jenkins : Set HTTP port in Jenkins config.] ***************************************************************************************************************************************************
changed: [localhost]

TASK [geerlingguy.jenkins : Create custom init scripts directory.] **********************************************************************************************************************************************
changed: [localhost]

TASK [geerlingguy.jenkins : Configure proxy config for Jenkins] *************************************************************************************************************************************************
skipping: [localhost]

RUNNING HANDLER [geerlingguy.jenkins : configure default users] *************************************************************************************************************************************************
changed: [localhost]

TASK [geerlingguy.jenkins : Immediately restart Jenkins on http or user changes.] *******************************************************************************************************************************
changed: [localhost]

TASK [geerlingguy.jenkins : Ensure Jenkins is started and runs on startup.] *************************************************************************************************************************************
ok: [localhost]

TASK [geerlingguy.jenkins : Wait for Jenkins to start up before proceeding.] ************************************************************************************************************************************
FAILED - RETRYING: Wait for Jenkins to start up before proceeding. (60 retries left).
FAILED - RETRYING: Wait for Jenkins to start up before proceeding. (59 retries left).
FAILED - RETRYING: Wait for Jenkins to start up before proceeding. (58 retries left).
ok: [localhost]

TASK [geerlingguy.jenkins : Get the jenkins-cli jarfile from the Jenkins server.] *******************************************************************************************************************************
changed: [localhost]

TASK [geerlingguy.jenkins : Remove Jenkins security init scripts after first startup.] **************************************************************************************************************************
changed: [localhost]

TASK [geerlingguy.jenkins : include_tasks] **********************************************************************************************************************************************************************
included: /home/dave/devops-ansible/jenkins/roles/geerlingguy.jenkins/tasks/plugins.yml for localhost

TASK [geerlingguy.jenkins : Get Jenkins admin password from file.] **********************************************************************************************************************************************
skipping: [localhost]

TASK [geerlingguy.jenkins : Set Jenkins admin password fact.] ***************************************************************************************************************************************************
ok: [localhost]

TASK [geerlingguy.jenkins : Create Jenkins updates directory.] **************************************************************************************************************************************************
ok: [localhost]

TASK [geerlingguy.jenkins : Download current plugin updates from Jenkins update site.] **************************************************************************************************************************
ok: [localhost]

TASK [geerlingguy.jenkins : Remove first and last line from json file.] *****************************************************************************************************************************************
ok: [localhost]

TASK [geerlingguy.jenkins : Install Jenkins plugins using password.] ********************************************************************************************************************************************

PLAY RECAP ******************************************************************************************************************************************************************************************************
localhost : ok=34 changed=13 unreachable=0 failed=0 skipped=13 rescued=0 ignored=0


Configure nodes 

https://www.howtoforge.com/tutorial/ubuntu-jenkins-master-slave/




Viewing all articles
Browse latest Browse all 181

Trending Articles