在CentOS服务器运行Ansible Playbook安装FortiClient时遇错误求助
解决CentOS上安装FortiClient的Ansible Playbook错误
错误提示里的Unsupported parameters for (ansible.legacy.dnf) module: description已经把问题说透了——你在yum和systemd模块里误用了description参数,这两个模块根本不支持这个参数,只有yum_repository模块需要用description来定义仓库的描述信息。
修正后的Playbook
--- - name: Install FortiClient hosts: all become: yes tasks: - name: Set up Fortinet repository yum_repository: name: fortinet description: configure yum for forticlient baseurl: http://repo.fortinet.com/repo/centos/7/os/x86_64/fortinet.repo - name: Install FortiClient yum: name: forticlient state: present - name: Restart FortiClient service systemd: name: forticlient state: restarted
修正说明
- 保留
yum_repository任务里的description,这是该模块的合法参数,用来描述仓库用途 - 删除
yum任务里的description,yum模块只需要指定要安装的包名和状态即可 - 删除
systemd任务里的description,systemd模块只需要服务名称和操作状态
验证步骤
运行修正后的Playbook后,可以通过以下命令确认结果:
# 检查FortiClient是否安装成功 rpm -q forticlient # 检查FortiClient服务状态 systemctl status forticlient
内容的提问来源于stack exchange,提问作者Alpha Lima
相关产品推荐
相关产品推荐

