Ansible 错误说明 : 'apt_repository' is not a valid attribute for a Play

标签 ansible yaml

这个问题在这里已经有了答案:





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/

相关文章:

Ansible-安装固定到主要版本的软件包

vim - 如何使用 ansible 配置 vim vundle 插件?

go - 我如何阅读这个 YAML?

php - Symfony2 : how to read parameters array in config. yml

使用 ImageMagick 的 GitHub Action : Create a PNG and commit it to the repo

json - Ansible:带冒号的 json 元素带键

Ansible:删除主机

ansible - 所有 Ansible 剧本属性

java - 无法通过 Dockerized WebLogic 将 Debug 设置为适用于 Java,不能使用 IntelliJ 或 Studio Code

java - 由于 "Invalid tag"错误,无法构造 java 对象