Skip to content

Commit cbaf3fd

Browse files
Merge pull request #120 from craigcomstock/ansible-galaxy-collection-package-method
Added package-method-ansible-galaxy-collection
2 parents dcb2aa2 + 91f9ee8 commit cbaf3fd

3 files changed

Lines changed: 42 additions & 0 deletions

File tree

cfbs.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,15 @@
177177
"bundles powershell_execution_policy_inventory"
178178
]
179179
},
180+
"package-method-ansible-galaxy-collection": {
181+
"description": "Package method for installing Ansible Galaxy Collections.",
182+
"subdirectory": "management/package-method-ansible-galaxy-collection",
183+
"dependencies": [],
184+
"steps": [
185+
"directory ./ services/cfbs/modules/package-method-ansible-galaxy-collection/",
186+
"policy_files services/cfbs/modules/package-method-ansible-galaxy-collection/"
187+
]
188+
},
180189
"package-method-winget": {
181190
"description": "Package method for Windows winget package manager.",
182191
"subdirectory": "management/package-method-winget",
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# package-method-ansible-galaxy-collection
2+
3+
## Usage
4+
This module enables a `ansible-galaxy-collection` package method used with policy like:
5+
6+
```cf3
7+
packages:
8+
"ansible.posix"
9+
package_method => ansible_galaxy_collection,
10+
package_policy => "add";
11+
```
12+
13+
Note that there is not a command option in ansible-galaxy to uninstall collections so that will result in no changes being made and a warning message. Ansible documentation suggests [removing collections with rm](https://docs.ansible.com/projects/ansible/latest/collections_guide/collections_installing.html#removing-a-collection)
14+
15+
## Installation
16+
17+
This module does not ensure that needed ansible packages are installed to provide the `ansible-galaxy` command.
18+
Typically this is a package named `ansible` on Debian-based distributions or `ansible-core` on RedHat-based distributions.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
body package_method ansible_galaxy_collection
2+
{
3+
package_changes => "bulk";
4+
package_name_convention => "$(name)";
5+
package_delete_convention => "$(name)";
6+
7+
package_installed_regex => ".*";
8+
package_list_name_regex => '^"([^"]*)",.*';
9+
package_list_version_regex => '.*,"([^"]*)".*';
10+
11+
12+
package_list_command => "ansible-galaxy collection list";
13+
package_delete_command => 'echo "Deleting an Ansible Galaxy Collection is not supported"';
14+
package_add_command => "ansible-galaxy collection install ";
15+
}

0 commit comments

Comments
 (0)