Answers: <p>Try this, please</p>
  <pre class="lang-yaml prettyprint-override"><code>- name: Pushing Nebula configs to node
    synchronize: 
      src: &lt;local dir&gt;
      dest: &quot;/etc/&lt;target_dir&gt;/&quot;
      dest_port: &quot;{{ ssh_port }}&quot;
      mode: push
    delegate_to: localhost
    vars:
      ansible_become: false
  </code></pre>
  
Answers: CC BY-SA 4.0
Answers: 2022-12-12T16:51:45.737Z
Answers: 2022-12-12T16:51:45.737Z
Answers: Rostyslav Malenko
Body: <p>while trying to setup a remote machine using ansible, I am running into the following issue:</p>
  <pre><code>FAILED! =&gt; {&quot;changed&quot;: false, &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}
  </code></pre>
  <p>I am already escalating privileges in the playbook using the following method:</p>
  <pre><code>  become: yes
    become_method: community.general.sudosu 
  </code></pre>
  <p>two of the tasks are successfully being executed with escalated privileges as well.
  i am running into this error when I run the following task:</p>
  <pre><code>    - name: Pushing Nebula configs to node
        synchronize: 
          src: &lt;local dir&gt;
          dest: &quot;/etc/&lt;target_dir&gt;/&quot;
          dest_port: &quot;{{ ssh_port }}&quot;
          mode: push
        delegate_to: localhost
  </code></pre>
  <p>the  user I am using does not require a sudo password.</p>
  
Tags: <ansible>
Title: ansible fatal: "sudo: a password is required", even after priveleges are escalated
UserDisplayName: vinylic
ThreadText: # ansible fatal: "sudo: a password is required", even after priveleges are escalated
  
  (Asked by: username_0 on 2022-11-09)
  
  while trying to setup a remote machine using ansible, I am running into the following issue:
  
  ```
  FAILED! => {"changed": false, "module_stderr": "sudo: a password is required\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}
  
  ```
  
  I am already escalating privileges in the playbook using the following method:
  
  ```
    become: yes
    become_method: community.general.sudosu 
  
  ```
  
  two of the tasks are successfully being executed with escalated privileges as well.
  i am running into this error when I run the following task:
  
  ```
      - name: Pushing Nebula configs to node
        synchronize: 
          src: <local dir>
          dest: "/etc/<target_dir>/"
          dest_port: "{{ ssh_port }}"
          mode: push
        delegate_to: localhost
  
  ```
  
  the user I am using does not require a sudo password.
  
  **Tags:** ansible
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2022-12-12. Score: 0
  
  Try this, please
  
  ```yaml
  - name: Pushing Nebula configs to node
    synchronize: 
      src: <local dir>
      dest: "/etc/<target_dir>/"
      dest_port: "{{ ssh_port }}"
      mode: push
    delegate_to: localhost
    vars:
      ansible_become: false
  
  ```
  
  
  ---
  
  