Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Collections in Ansible galaxy yaml file was ignored when I run install command

---
roles:
    -
        name: Aplyca.S3fs
    -
        name: badpacketsllc.aws_cli
        version: v1.0.3
    -
        name: geerlingguy.nodejs
        version: 5.1.1
    -
        name: geerlingguy.filebeat
        version: 3.0.2
    -
        name: geerlingguy.pip
        version: 2.0.0

collections:
    -   name: nginxinc.nginx_core
        version: 0.1.3

Result

ansible-galaxy install -r galaxy.yml -p ./roles
[WARNING]: - Aplyca.S3fs (master) is already installed - use --force to change version to unspecified
- badpacketsllc.aws_cli (v1.0.3) is already installed, skipping.
- geerlingguy.nodejs (5.1.1) is already installed, skipping.
- geerlingguy.filebeat (3.0.2) is already installed, skipping.
- geerlingguy.pip (2.0.0) is already installed, skipping.

This is my file and this is the command I run to install roles and collections.

ansible-galaxy install -r galaxy.yml -p ./roles

I am using Ansible 2.9.13

I don't see what is wrong in my file, here is the official doc. https://docs.ansible.com/ansible/latest/user_guide/collections_using.html

---
roles:
  # Install a role from Ansible Galaxy.
  - name: geerlingguy.java
    version: 1.9.6

collections:
  # Install a collection from Ansible Galaxy.
  - name: geerlingguy.php_roles
    version: 0.9.3
    source: https://galaxy.ansible.com
like image 710
tom10271 Avatar asked Dec 09 '25 11:12

tom10271


1 Answers

To install both roles and collections at the same time with one command, run the following:

ansible-galaxy install -r galaxy.yml

Installing both roles and collections from the same requirements file will not work when specifying a custom collection or role install path. In this scenario the collections will be skipped and the command will process each like ansible-galaxy role install would.

Then you need install collections with this command

ansible-galaxy collection install -r galaxy.yml -p ./roles

Documentation:

https://docs.ansible.com/ansible/latest/user_guide/collections_using.html#install-multiple-collections-with-a-requirements-file

like image 155
gary lopez Avatar answered Dec 12 '25 02:12

gary lopez



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!