<p>Got it to work with this</p>
<pre><code>- name: Set File Watch Limit
  shell: &quot;echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf &amp;&amp; sudo sysctl -p&quot;

</code></pre>

CC BY-SA 4.0
2021-10-09T02:00:13.307Z
That is much cleaner looking ansible also.
chicks
CC BY-SA 4.0
2021-10-09T01:00:44.197Z
2021-10-09T01:00:44.197Z
learningtech
<p>I'm trying to run a shell command in an ansible task but I keep getting an error.</p>
<p>This is the task item and the shell command I want to run:</p>
<pre><code>- name: Set File Watch Limit
  ansible.builtin.shell:
    cmd: &quot;echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf &amp;&amp; sudo sysctl -p&quot;

</code></pre>
<p>But this is the error that ansible gives me:</p>
<pre><code>fatal: [...]: FAILED! =&gt; {&quot;changed&quot;: false, &quot;msg&quot;: &quot;Unsupported parameters for (command) module: cmd Supported parameters include: _raw_params, _uses_shell, argv, chdir, creates, executable, removes, stdin, stdin_add_newline, strip_empty_ends, warn&quot;}

</code></pre>
<p>The reason I want to run the command is because it will address a problem that reactjs/nodejs developers are facing when they use <code>npm run watch</code> as explained in this related question: <a href="https://stackoverflow.com/questions/55763428/react-native-error-enospc-system-limit-for-number-of-file-watchers-reached">https://stackoverflow.com/questions/55763428/react-native-error-enospc-system-limit-for-number-of-file-watchers-reached</a></p>
<p>How do I get ansible to run the command?  THe command works perfectly fine if I login to the server and manually execute it.</p>

CC BY-SA 4.0
2021-10-08T23:09:01.827Z
Are you sure the error belongs to this task?
Vladimir Botka
CC BY-SA 4.0
2021-10-08T23:33:09.293Z
Yup, i deleted all other tasks from my playbook, this is the only action to perform
learningtech
<ansible><bash>
ansible Unsupported parameters for (command) module:
learningtech
# ansible Unsupported parameters for (command) module:

(Asked by: username_0 on 2021-10-08)

I'm trying to run a shell command in an ansible task but I keep getting an error.
This is the task item and the shell command I want to run:
- name: Set File Watch Limit
  ansible.builtin.shell:
    cmd: "echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p"


But this is the error that ansible gives me:
fatal: [...]: FAILED! => {"changed": false, "msg": "Unsupported parameters for (command) module: cmd Supported parameters include: _raw_params, _uses_shell, argv, chdir, creates, executable, removes, stdin, stdin_add_newline, strip_empty_ends, warn"}


The reason I want to run the command is because it will address a problem that reactjs/nodejs developers are facing when they use npm run watch as explained in this related question: https://stackoverflow.com/questions/55763428/react-native-error-enospc-system-limit-for-number-of-file-watchers-reached
How do I get ansible to run the command?  THe command works perfectly fine if I login to the server and manually execute it.

**Tags:** ansible, bash

> **Comments:**
> **username_1**: Are you sure the error belongs to this task?  
> **username_0**: Yup, i deleted all other tasks from my playbook, this is the only action to perform  

---

## 1 answers

### Answer by username_0 on 2021-10-09. Score: 1

Got it to work with this
- name: Set File Watch Limit
  shell: "echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p"

> **Comments:**
> **username_2**: That is much cleaner looking ansible also.  

---

