1.5. 使用容器化 Ansible Automation Platform 的 postinstall 功能
使用容器化 Ansible Automation Platform 的实验性 postinstaller 功能,在初始安装过程中定义和加载配置。这使用 configuration-as-code 的方法,只需将配置定义为简单的 YAML 文件。
要使用此可选功能,您需要在清单文件中取消注释以下变量:
controller_postinstall=true
默认值为 false,因此您需要启用它来激活 postinstaller。对于必须驻留在本地文件系统中的此功能,您需要一个 Ansible Automation Platform 许可证,以便自动载入它:
controller_license_file=/full_path_to/manifest_file.zip
您可以从基于 Git 的存储库中拉取配置作为代码。要做到这一点,将以下变量设置为指定从中拉取内容的位置,并将其上传到 Ansible Automation Platform 控制器的位置:
controller_postinstall_repo_url=https://your_cac_scm_repo controller_postinstall_dir=/full_path_to_where_you_want_the pulled_content_to_reside
controller_postinstall_repo_url 变量可用于定义必须包含身份验证信息的 postinstall 存储库 URL。
http(s)://<host>/<repo>.git (public repository without http(s) authentication) http(s)://<user>:<password>@<host>:<repo>.git (private repository with http(s) authentication) git@<host>:<repo>.git (public/private repository with ssh authentication)
注意使用基于 ssh 的身份验证时,安装程序不会为您配置任何内容,因此您必须在安装程序节点上配置所有内容。
定义文件使用 infra 认证的集合。controller_configuration 集合已作为安装的一部分预安装,并使用您在清单文件中提供的安装控制器凭证来访问 Ansible Automation Platform 控制器。您只需要提供 YAML 配置文件。
您可以设置 Ansible Automation Platform 配置属性,如凭证、LDAP 设置、用户和团队、机构、项目、清单和主机、作业和工作流模板。
以下示例显示了定义和加载控制器作业模板的示例 your-config.yml。该示例演示了对 Ansible Automation Platform 安装提供的预加载演示示例的简单更改。
/full_path_to_your_configuration_as_code/ ├── controller └── job_templates.yml
controller_templates: - name: Demo Job Template execution_environment: Default execution environment instance_groups: - default inventory: Demo Inventory