gpt4 book ai didi

ansible - 错误 : apt is not a legal parameter of an Ansible Play

转载 作者:行者123 更新时间:2023-12-03 21:52:46 24 4
gpt4 key购买 nike

尝试运行 YML 文件时出现以下错误:-

user@ubuntuA:~$ ansible-playbook -i hostfile setup.yml

错误 :

apt is not a legal parameter of an Ansible Play



Ansible 版本:1.9.2

yml 文件:-
---

- name: Install MySQL server
apt: name=mysql-server state=latest

- name: Install Apache module for MySQL authentication
apt: name=libapache2-mod-auth-mysql state=latest

- name: Install MySQL module for PHP
apt: name=php5-mysql state=latest

最佳答案

您的 yml 文件应如下所示:

---
- hosts: all
become: yes
tasks:
- name: Install packages
apt:
name:
- mysql-server
- libapache2-mod-auth-mysql
- php5-mysql
state: latest
cache_valid_time: 3600 # update cache if more than an hour old

关于ansible - 错误 : apt is not a legal parameter of an Ansible Play,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32087617/

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