New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ansible provisionner: support collections using ansible-galaxy #10958
Comments
According to ansible/ansible#57106, we will not need to support collections lockfile and mazer because support of ansible collections has been added to I will made some tests when Ansible 2.9 will be released. |
@nqb thank you very much! Please let us know when you have some Ansible 2.9+ results 👍 |
Hello @gildegoma, According to following documentations:
A requirements file can be used to install collections and roles. Example: ---
roles:
- src: inverse_inc.gitlab_buildpkg_tools
collections:
- name: inverse_inc.packetfence BUT:
|
We can have same usage as for roles with following command:
This will install collections in a relative |
We certainly need to use a new compatibility mode for Ansible 2.9 |
+1 |
I did a test today with:
---
roles:
- src: geerlingguy.nodejs
- src: inverse_inc.gitlab_buildpkg_tools
collections:
- name: inverse_inc.packetfence
- name: debops.debops
- name: inverse_inc.windows
- name: inverse_inc.cumulus
- name: inverse_inc.utils
config.vm.provision "ansible", type: 'ansible' do |ansible|
ansible.playbook = "site.yml"
ansible.config_file = "ansible.cfg"
ansible.inventory_path = "inventory"
ansible.galaxy_role_file = "requirements.yml"
end
[defaults]
inventory = inventory/
# change display of log
stdout_callback = yaml
# disable host key checking
host_key_checking = False
# forks
forks = 50
# Installs collections into [current dir]/ansible_collections/namespace/collection_name
collections_paths = ./ And due to changes related to |
Trying to do
which will just install it to the default collections location, but if people wanted to do the path as well ( like mentioned here: #10958 (comment) ) then they should be able to add |
If you are using the |
Combine ability to install roles to root-owned path https://www.vagrantup.com/docs/provisioning/ansible_local#install-galaxy-roles-in-a-path-owned-by-root with support to also install collections hashicorp/vagrant#10958 (comment)
Is the @elreydetoda: It doesn't work for me sadly, I get an error instead:
Edit: I solved this now with an external script: #!/usr/bin/env sh
ansible-galaxy collection install --collections-path="$3" --force -r "$2" && \
ansible-galaxy role install --roles-path="$1" --force -r "$2"
# [...]
ansible.galaxy_command = './scm/ansible-galaxy-install-all.sh %{roles_path} %{role_file} scm/vendor/collections'
# [...] The placeholders can be passed as arguments (and the path to collections directory) to the external script so they can be also used there. |
ya... @strarsis, I think I had this error recently as well. I think this happened in some kind of update, but didn't dig too far into it. I will post back here if I can find the vagrantfile this was happening in, but I do have quite a few of them that I have collected over the years 😅 so I don't know when I will get a chance to post it. Also, cool @uncletall! I will have to check that out. I have so many different things that I need to add by default now, for Vagrantfiles, I feel like I need to create a script to generate all of the default config options 😅 ( depending on provisioner and provider of course ). |
@bruinsg, this didn't seem to work:
@elreydetoda, this almost worked for me, but not quite:
I just had to remove the
Thanks for the workaround! |
Hello,
First of all, thanks for this nice software !
Context
Current Ansible provisionner is able to download roles from Ansible Galaxy website during provisioning (option galaxy_role_file).
Since Ansible 2.8 and Galaxy 3.2, users can upload collections on Galaxy website.
Collections could be install using mazer tool and a collections lock file:
collections_lockfile.yml (see format):
Request
Have a dedicated option for Ansible provisionner to install collections from a collection lockfile if
mazer
is present on the host.The text was updated successfully, but these errors were encountered: