这个问题在这里已经有了答案:
ERROR! 'fail' is not a valid attribute for a Play
(1 个回答)
3年前关闭。
我正在尝试运行一个剧本:ansible-playbook roles/java/tasks/debian.yml -i /etc/ansible/hosts
输出如下:
ERROR! 'apt_repository' is not a valid attribute for a Play
The error appears to have been in '/Users/awest1/Workspace/ansible-playbooks/roles/java/tasks/debian.yml': line 2, column 3, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
---
- name: Setup oracle java deb repo
^ here
我试图播放的 yml 文件有这个头:
- name: Setup oracle java deb repo
apt_repository:
repo: "ppa:webupd8team/java"
update_cache: yes
我将不胜感激任何指示。
谢谢
最佳答案
您尝试将任务列表作为剧本运行。
为了让它工作,写一个简单的剧本:
- hosts: all
tasks:
- include: roles/java/tasks/debian.yml
关于Ansible 错误说明 : 'apt_repository' is not a valid attribute for a Play,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44788757/