Installing Jenkins through Ansible play book - Tecnew

Home Ads

Installing Jenkins through Ansible play book

Installing Jenkins through Ansible play book

Share This

 ---

- hosts: web01

  become: yes


  tasks:

    - name: install openjdk

      apt:

        name: openjdk-8-jdk

        state: present


    - name: ensure the jenkins apt repository key is installed

      apt_key:

        url: https://pkg.jenkins.io/debian-stable/jenkins.io.key

        state: present

      become: yes


    - name: ensure the repository is configured

      apt_repository:

        repo: 'deb https://pkg.jenkins.io/debian-stable binary/'

        state: present

      become: yes


    - name: ensure jenkins is installed

      apt:

        name: jenkins

        state: present

        update_cache: yes

      become: yes


    - name: ensure jenkins is running

      service:

        name: jenkins

        state: started


    - name:  init password jenkins

      shell: cat /var/lib/jenkins/secrets/initialAdminPassword

      changed_when: false

      register: result


    - name: print init password jenkins

      debug:

        var: result.stdout


No comments:

Post a Comment