'how to start Jenkins with the help of ansible playbook

When I try to start my Jenkins in ansible playbook, the below error is displayed:

fatal: [172.31.32.215]: FAILED! => {"changed": false, "msg": "Unable to start service jenkins: Job for jenkins.service failed because the control process exited with error code. See "systemctl status jenkins.service" and "journalctl -xe" for details.\n"}

Playbook:

    - name: im going to install jenkins from yum repo
      yum_repository:
        name: jenkins
        description: jenkins YUM repo
        baseurl: https://pkg.jenkins.io/redhat-stable
        gpgkey: https://pkg.jenkins.io/redhat-stable/jenkins.io.key

     - name: im install java 
       yum:
          name: "{{ item }}"
          state: present
          update_cache: true
       loop:
          - java
          - jenkins
    
     - name: Start service jenkins, if not started
       service:
          name: jenkins
          state: started

How to install Jenkins with remote server?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source