错题集 zabbix--yaml

报错环境

一、ansible—yaml

[root@server1 ~]# vim Apcha.yaml

  • hosts: mysql
    remote_user: root
    tasks:
    • name: yum httpd
      yum: name=httpd
    • name: start httpd
      service: name=httpd state=started
    • name: stop firewalld
      service: name=firewalld state=stopped
    • name: index.html
      copy: content=this is Apcha dest=/var/www/html/index.html

报错信息:

[root@server1 ~]# ansible-playbook Apcha.yaml --syntax-check
ERROR! this task ‘copy’ has extra params, which is only allowed in the following modules: shell, win_shell, include_vars, ansible.builtin.import_tasks, add_host, ansible.legacy.meta, ansible.builtin.include_vars, ansible.legacy.include_role, raw, ansible.legacy.add_host, include_role, meta, ansible.builtin.meta, ansible.legacy.include, ansible.legacy.import_role, ansible.builtin.include_role, ansible.legacy.include_vars, ansible.legacy.include_tasks, set_fact, include, import_tasks, ansible.legacy.set_fact, ansible.builtin.set_fact, script, ansible.builtin.group_by, ansible.builtin.import_role, import_role, ansible.builtin.include_tasks, include_tasks, ansible.legacy.group_by, ansible.builtin.include, group_by, command, ansible.builtin.add_host, ansible.legacy.import_tasks, win_command

The error appears to be in ‘/root/Apcha.yaml’: line 9, column 19, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

 service: name=firewalld state=stopped
              ^ here

There appears to be both ‘k=v’ shorthand syntax and YAML in this task. Only one syntax may be used.

解决:没有加引号

 copy: content="this is Apcha" dest=/var/www/html/index.html
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值