我在我的树莓派上运行任何命令或shell时遇到了问题。
当我使用以下代码时:
- name: Example command
ansible.builtin.command:
cmd: "cat /etc/motd"
我遇到了这个错误:
Unsupported parameters for (ansible.builtin.command) module: cmd Supported parameters include: _raw_params, _uses_shell, argv, chdir, creates, executable, removes, stdin, stdin_add_newline, strip_empty_ends, warn"}
当我尝试这样做:
- name: Example command
ansible.builtin.command: cat /etc/motd
我遇到了这个错误:
ERROR! this task 'ansible.builtin.command' has extra params, which is only allowed in the following modules: import_tasks, raw, include, include_tasks, include_vars, include_role, script, set_fact, win_command, add_host, shell, import_role, group_by, command, win_shell, meta
当我尝试使用ansible.builtin.shell时,我遇到了相同的错误。我尝试了几个其他命令,但都没有成功。似乎我无法运行任何命令而不出现这两个错误。
我使用的是ansible 2.9.6。我尝试升级它,但apt说它已经是最新的可用版本了。
感谢任何帮助。