Collection Galaxy 元数据结构

Ansible collection 的一个关键组件是放置在 collection 根目录下的 galaxy.yml 文件。该文件包含用于生成 collection 构件(artifact)的元数据。

结构

galaxy.yml 文件必须包含以下符合有效 YAML 格式的键:

注释

namespace

string 

required

Collection 的命名空间(namespace)。

这可以是一个公司/品牌/组织或产品命名空间,所有内容都位于该空间之下。

仅能包含小写字母数字字符和下划线。命名空间不能以下划线或数字开头,且不能包含连续的下划线。

name

string 

required

Collection 的名称。

具有与 namespace 相同的字符限制。

version

string 

required

Collection 的版本。

必须兼容语义化版本控制(semantic versioning)。

readme

string 

required

Markdown (.md) 自述文件的路径。

该路径相对于 collection 的根目录。

authors

list 

required

Collection 内容作者的列表。

可以是仅姓名,或采用 ‘Full Name <email> (url) @nicks:irc/im.site#channel’ 格式。

description

string 

Collection 的简短摘要描述。

license

list 

单个许可证或 collection 内部内容的许可证列表。

Ansible Galaxy 目前仅接受 SPDX 许可证

此键与 license_file 互斥。

license_file

string 

Collection 许可证文件的路径。

该路径相对于 collection 的根目录。

此键与 license 互斥。

tags

list 

您希望与 collection 关联以用于索引/搜索的标签列表。

标签名称具有与 namespacename 相同的字符要求。

dependencies

dictionary 

该 collection 为使其可用而需要安装的其他 collections。

字典的键是 collection 标识符 namespace.name

值是版本范围 指定符 (specifiers)

可以设置多个版本范围指定符,并用 , 分隔。

repository

string 

源 SCM 仓库的 URL。

documentation

string 

任何在线文档的 URL。

homepage

string 

Collection/项目的主页 URL。

issues

string 

Collection 问题追踪器的 URL。

build_ignore

list 


version_added: 2.10

 

用于过滤不应包含在构建构件中的任何文件或目录的类 glob 文件模式列表。

模式与 collection 目录中文件或目录的相对路径进行匹配。

使用 fnmatch 来匹配文件或目录。

某些目录和文件(如 galaxy.yml, *.pyc, *.retry.git)总是会被过滤。

manifest 互斥

manifest

sentinel 


version_added: 2.14

 

一个用于控制构建 collection 构件时使用的 manifest 指令的字典。

directives 是一个 MANIFEST.in 风格的 指令 列表

omit_default_directives 是一个布尔值,控制是否使用默认指令

build_ignore 互斥

示例

namespace: "namespace_name"
name: "collection_name"
version: "1.0.12"
readme: "README.md"
authors:
    - "Author1"
    - "Author2 (https://author2.example.com)"
    - "Author3 <author3@example.com>"
dependencies:
    "other_namespace.collection1": ">=1.0.0"
    "other_namespace.collection2": ">=2.0.0,<3.0.0"
    "anderson55.my_collection": "*"    # note: "*" selects the highest version available
license:
    - "MIT"
tags:
    - demo
    - collection
repository: "https://www.github.com/my_org/my_collection"

另请参阅

开发集合

开发或修改 collection。

开发模块

了解如何编写 Ansible 模块

使用 Ansible 集合

了解如何安装和使用集合。

邮件列表

开发邮件列表

irc.libera.chat

#ansible IRC 聊天频道