本文介绍了出现错误提示:"apt_repository"不是Play的有效属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图用以下命令来运行一个剧本:ansible-playbook roles/java/tasks/debian.yml -i /etc/ansible/hosts
I am trying to just run a playbook with: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文件有此标题:
The yml file that I am trying to play has this head:
- name: Setup oracle java deb repo
apt_repository:
repo: "ppa:webupd8team/java"
update_cache: yes
任何指示,我将不胜感激.谢谢
I would appreciate any direction given. Thanks
推荐答案
您尝试将任务列表作为剧本运行.
You try to run tasks list as a playbook.
要使其正常运行,请编写一个简单的剧本:
To make it work, write a simple playbook:
- hosts: all
tasks:
- include: roles/java/tasks/debian.yml
这篇关于出现错误提示:"apt_repository"不是Play的有效属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!