Skip to content

Instantly share code, notes, and snippets.

@algotrader-dotcom
Last active January 4, 2023 17:57
Show Gist options
  • Save algotrader-dotcom/b44784eecbdd141bd73cc976a9d19992 to your computer and use it in GitHub Desktop.
Save algotrader-dotcom/b44784eecbdd141bd73cc976a9d19992 to your computer and use it in GitHub Desktop.
Install jenkins on aws AMI linux
---
- hosts: 127.0.0.1
connection: local
become: true
tasks:
- name: install wget
yum:
name: wget
state: present
- name: install openjdk
yum:
name: java-1.8.0-openjdk
state: present
- name: download jenkins.repo
get_url:
url: http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo
dest: /etc/yum.repos.d/jenkins.repo
- name: import jenkins key
rpm_key:
state: present
key: https://jenkins-ci.org/redhat/jenkins-ci.org.key
- name: install jenkins
yum:
name: jenkins
state: present
#- name: start jenkins
# systemd:
# name: jenkins
# state: started
#- name: enable jenkins
# systemd:
# name: jenkins
# enabled: true
- name: Start jenkins
shell: sudo service jenkins start
- name: sleep for 30 seconds and continue with play
wait_for: timeout=30
delegate_to: localhost
- name: init password jenkin
shell: cat /var/lib/jenkins/secrets/initialAdminPassword
changed_when: false
register: result
- name: print init password jenkins
debug:
var: result.stdout
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment