gpt4 book ai didi

Ansible 标签 include_role 不适用于 ansible 版本 2.3

转载 作者:行者123 更新时间:2023-12-02 13:39:25 25 4
gpt4 key购买 nike

我有以下剧本

- name: Restart Apache Server
hosts: "{{ host }}"
include_role:
name: root
tasks_from: apache-restart.yml
become: true
become_user: root

当我运行此剧本时,它抛出以下错误

ERROR! 'include_role' is not a valid attribute for a Play

The error appears to have been in '/Users/Atul/Workplace/infra-automation/deployments/LAMP/site.yml': line 18, column 3, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:


- name: Restart Apache Server
^ here

以下是我的笔记本电脑中安装的 Ansible 的详细信息。

ansible 2.3.1.0
config file = /Users/Atul/Workplace/infra-automation/ansible.cfg
configured module search path = Default w/o overrides
python version = 2.7.13 (default, Apr 4 2017, 08:47:57) [GCC 4.2.1 Compatible Apple LLVM 8.1.0 (clang-802.0.38)]

最佳答案

include_role是一个在任务中使用的操作模块。

对于游戏,您应该使用类似于 https://docs.ansible.com/ansible/latest/user_guide/playbooks_reuse_roles.html#using-rolesrole 指令。 .

关于Ansible 标签 include_role 不适用于 ansible 版本 2.3,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46315413/

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