gpt4 book ai didi

ansible - 此任务(名称)具有额外的参数,仅允许使用

转载 作者:行者123 更新时间:2023-12-03 14:37:05 24 4
gpt4 key购买 nike

ansible.builtin.shellansible.builtin.command有问题。可能没有正确使用它们,但用法与docs示例匹配。
Ansible版本2.10.3
在Roles/rabbitmq/tasks/main.yml中

---
# tasks file for rabbitmq

# If not shut down cleanly, the following will fix:
# systemctl stop rabbitmq-server
- name: Stop RabbitMQ service
ansible.builtin.service:
name: rabbitmq-server
state: stopped
become: yes

# rabbitmqctl force_boot
# https://www.rabbitmq.com/rabbitmqctl.8.html
# force_boot Ensures that the node will start next time, even if it was not the last to shut down.
- name: Force RabbitMQ to boot anyway
ansible.builtin.shell: /usr/sbin/rabbitmqctl force_boot

# systemctl start rabbitmq-server
- name: Stop RabbitMQ service
ansible.builtin.service:
name: rabbitmq-server
state: started
become: yes
导致以下错误:
ERROR! this task 'ansible.builtin.shell' has extra params, which is only allowed in the following modules: shell, command, ansible.windows.win_shell, ...

The error appears to be in '.../roles/rabbitmq/tasks/main.yml': line 15, > column 3, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

# force_boot Ensures that the node will start next time, even if it was not the last to shut down.
- name: Force RabbitMQ to boot anyway
^ here

我尝试过 ansible.builtin.command,无论是否带有 cmd:参数。
我对用法不了解?

最佳答案

尝试在命令周围加上“”,即

 ansible.builtin.shell: "/usr/sbin/rabbitmqctl force_boot"

关于ansible - 此任务(名称)具有额外的参数,仅允许使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66178118/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com