nick_invision.required
必需的
一个基本的角色,用于检查变量是否已设置以及路径是否存在。此角色旨在在剧本中首先运行,以便快速失败,而不是等待需要该变量或路径的任务执行时才失败。
要求
无
角色变量
没有默认的变量设置,但如果发现以下任一项,则会进行指定的断言。
# 如果设置,则检查变量是否已定义且长度不为零
required_vars
# 如果设置,则检查本地路径是否存在
required_local_paths
# 如果设置,则检查每个远程主机的路径是否存在
required_remote_paths
依赖关系
无
示例剧本
- name: 验证先决条件
include_role:
name: nick_invision.required
vars:
required_vars:
- an_important_var
- another_important_var
- name: 验证先决条件
include_role:
name: nick_invision.required
vars:
required_local_paths:
- ~/something/locally/important.txt
- something/locally/relatively/important.txt
- /something/locally/absolutely/important.txt
- name: 验证先决条件
include_role:
name: nick_invision.required
vars:
required_remote_paths:
- ~/something/remote/important.txt
- something/remote/relatively/important.txt
- /something/remote/absolutely/important.txt
- name: 验证先决条件
include_role:
name: nick_invision.required
vars:
required_vars:
- an_important_var
- another_important_var
required_local_paths:
- ~/something/locally/important.txt
- something/locally/relatively/important.txt
- /something/locally/absolutely/important.txt
required_remote_paths:
- ~/something/remote/important.txt
- something/remote/relatively/important.txt
- /something/remote/absolutely/important.txt
许可证
MIT
安装
ansible-galaxy install nick_invision.required
许可证
Unknown
下载
255
拥有者