大网数据广告活动
服务器运维问答

What is the correct syntax of defining role dependencies in the meta/main.yml in Ansible?

· 52CE 我爱测

meta/main.yml dependencies: - { role: 030.sensu-install } results in: [DEPRECATION WARNING]: The comma separated role spec format, use the yaml/explicit format instead.. This feature will be removed in a future release. Deprecati…

问题原文

原帖链接 · 030 · CC BY-SA 3.0

meta/main.yml

dependencies:
  - { role: 030.sensu-install }

results in:

[DEPRECATION WARNING]: The comma separated role spec format, use the
yaml/explicit format instead..
This feature will be removed in a future release. 
Deprecation warnings can be disabled by setting deprecation_warnings=False in 
ansible.cfg.

when sudo ansible-galaxy install -r requirements/development.yml is issued.

Attempts to solve the issue

When

dependencies:
  - role: 030.sensu-install
    version: 0.1.0

is defined, the syntax check succeeds, but the deprecation warning persists.


When

dependencies:
  - src: 030.sensu-install
    version: 0.1.0

is defined, sudo ansible-galaxy install -r requirements/development.yml is run the deprecation warning is solved, but ansible-playbook /etc/ansible/roles/role_under_test/tests/${playbook} --syntax-check results in:

ERROR! role definitions must contain a role name

已采纳解答

原帖链接 · 030 · CC BY-SA 4.0

Updating the meta/main.yml according this snippet as follows:

dependencies:
  - src: 030.firewall
    version: 0.1.0
    name: 030.firewall
  - src: 030.sensu-client
    version: 0.4.1
    name: 030.sensu-client
  - src: geerlingguy.ntp
    version: 1.3.0
    name: geerlingguy.ntp    
  - src: geerlingguy.postfix
    version: 1.1.0
    name: geerlingguy.postfix
  - src: geerlingguy.redis
    version: 1.4.1
    name: geerlingguy.redis
  - src: Stouts.rabbitmq
    version: 1.2.1
    name: Stouts.rabbitmq

and installing the requirements by issuing ansible-galaxy install -r requirements/development.yml did not return the [DEPRECATION WARNING]: The comma separated role spec format issue anymore.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-09-14)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0 / CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。