HiveBrain v1.2.0
Get Started
← Back to all entries
patternbashMinor

ansible Unsupported parameters for (command) module:

Submitted by: @import:stackexchange-devops··
0
Viewed 0 times
unsupportedmoduleforcommandparametersansible

Problem

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.

Solution

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"

Code Snippets

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

Context

StackExchange DevOps Q#14808, answer score: 1

Revisions (0)

No revisions yet.