title: MODULE FAILURE error while executing ansible script
body: <p>I am new to ansible and jenkins .I am using pipeline to  fetch code from git and replace some properties within it using ansible and  I am getting this error while trying to change the properties.</p>
  <pre><code>  Commit message: &quot;Update replace-property_Gbs.yml&quot;
      [Pipeline] }
      [Pipeline] // dir
      [Pipeline] }
      [Pipeline] // stage
      [Pipeline] stage
      [Pipeline] { (replace-property-files)
      [Pipeline] sh
      + ansible-playbook cicd-gbs/replace-property_Gbs.yml -e 'db_ip=localhost db_user=root db_pass=Gbs@2018  db=sf_inventory public_ip=96.126.116.100'
      [WARNING]: provided hosts list is empty, only localhost is available. Note that
      the implicit localhost does not match 'all'
      
      PLAY [To replace the correct values in properties file] ************************
      
      TASK [Gathering Facts] *********************************************************
      fatal: [localhost]: FAILED! =&gt; {&quot;ansible_facts&quot;: {}, &quot;changed&quot;: false, &quot;failed_modules&quot;: {&quot;setup&quot;: {&quot;failed&quot;: true, &quot;module_stderr&quot;: &quot;sudo: a password is required\n&quot;, &quot;module_stdout&quot;: &quot;&quot;, &quot;msg&quot;: &quot;MODULE FAILURE\nSee stdout/stderr for the exact error&quot;, &quot;rc&quot;: 1}}, &quot;msg&quot;: &quot;The following modules failed to execute: setup\n&quot;}
  
  PLAY RECAP *********************************************************************
  </code></pre>
  <p>this is my ANSIBLE SCRIPT in which i am trying to replace some property in code  after fetching it from git through pipeline script</p>
  <pre><code>---
      - name: To replace the correct values in properties file
        hosts: localhost
        become: true
        vars:
          ip: &quot;{{ db_ip }}&quot;
          user: &quot;{{ db_user }}&quot;
          password: &quot;{{ db_pass }}&quot;
          dbname: &quot;{{ db }}&quot;
          pub_ip: &quot;{{ public_ip }}&quot;
        tasks:
        - name: to remove unwanted properties files for now
          file:
            path: &quot;/var/lib/jenkins/workspace/cicd-gbs/cicd-gbs/config-server/src/main/resources/config/{{ item }}&quot;
            state: absent
          with_items:
            - production-service-dev.properties
            - stock-management-service-dev.properties
        - name: To replace the DB Ip on all properties files
          replace:
            path: &quot;{{ item }}&quot;
            regexp: '^spring.datasource.url=*(.+)$'
            replace: &quot;spring.datasource.url=jdbc:mysql://{{ ip }}:3306/{{ dbname }}?autoReconnect=true&amp;useSSL=false&amp;nullNamePatternMatchesAll=true&amp;serverTimezone=Asia/Jakarta&quot;
          with_items:
            - '/var/lib/jenkins/workspace/cicd-gbs/cicd-gbs/config-server/src/main/resources/config/buyback-service-dev.properties'
        - name: to change the port number on application-propertyfile
          replace:
             path: '/var/lib/jenkins/workspace/cicd-gbs/cicd-gbs/config-server/src/main/resources/application.properties'
             regexp: '9090'
             replace: '8821'   
        - name: To replace the db user name
          replace:
            path: &quot;{{ item }}&quot;
            regexp: '^spring.datasource.username=*(.+)$'
            replace: &quot;spring.datasource.username={{ user }}&quot;
          with_items:
            - '/var/lib/jenkins/workspace/cicd-gbs/cicd-gbs/config-server/src/main/resources/config/buyback-service-dev.properties'
        - name: To replace the db password
          replace:
            path: &quot;{{ item }}&quot;
            regexp: '^spring.datasource.password=*(.+)$'
            replace: &quot;spring.datasource.password={{ db_pass }}&quot; 
          with_items:
            - '/var/lib/jenkins/workspace/cicd-gbs/cicd-gbs/config-server/src/main/resources/config/buyback-service-dev.properties'
        - name: To change the log location
          replace:
            path: &quot;{{ item }}&quot;
            regexp: 'logs'
            replace: '/home/app/jenkinsdeployment'
          with_items:
      server/src/main/resources/config/distribution-service-dev.properties
            - '/var/lib/jenkins/workspace/cicd-gbs/cicd-gbs/config-server/src/main/resources/config/buyback-service-dev.properties'
        - name: To change the public ip address on property IP
          replace:
            path: &quot;{{ item }}&quot;
            regexp: '10.16.45.40'
            replace: &quot;{{ pub_ip }}&quot;
          with_items:
            - '/var/lib/jenkins/workspace/cicd-gbs/cicd-gbs/config-server/src/main/resources/config/buyback-service-dev.properties'
        - name: To change the port no in bootstrap properties on discovery-gateway service
          replace:
            path: &quot;{{ item }}&quot;
            regexp: '9090'
            replace: &quot;8821&quot;
          with_items:
            - '/var/lib/jenkins/workspace/cicd-gbs/cicd-gbs/discovery-gateway/src/main/resources/bootstrap.properties'
        - name: To add the entry for cassendra
          lineinfile:
            path: &quot;{{ item }}&quot;
            regexp: '^spring.data.cassandra.contact-points'
            line: 'spring.data.cassandra.contact-points=localhost'
          with_items:
            - '/var/lib/jenkins/workspace/cicd-gbs/cicd-gbs/config-server/src/main/resources/config/buyback-service-dev.properties'
  </code></pre>
  <p>Can any one help me with this?</p>