kitchen-ansible icon indicating copy to clipboard operation
kitchen-ansible copied to clipboard

Define collections download path

Open denists1984 opened this issue 1 year ago • 0 comments

Hi All

I would like to define path to download the collections. For now it goes by default to /home/ubuntu/.ansible/tmp/.

For example:

Process install dependency map
Starting collection install process
Downloading https://galaxy.ansible.com/download/ansible-posix-1.5.1.tar.gz to /home/ubuntu/.ansible/tmp/ansible-local-1104_yqk3n5x/tmpln918v32/ansible-posix-1.5.1-gi382mhz
Downloading https://galaxy.ansible.com/download/community-general-6.3.0.tar.gz to /home/ubuntu/.ansible/tmp/ansible-local-1104_yqk3n5x/tmpln918v32/community-general-6.3.0-71aobhnp
Installing 'ansible.posix:1.5.1' to '/tmp/kitchen/collections/ansible_collections/ansible/posix'
ansible.posix:1.5.1 was installed successfully
Installing 'community.general:6.3.0' to '/tmp/kitchen/collections/ansible_collections/community/general'
community.general:6.3.0 was installed successfully

From the ansible-galaxy cli tool i see that there is such option to define the directory to download the collections to. However didn't find such parameter in the provisioner_options.md.

ansible-galaxy cli:

ansible-galaxy collection download --help
positional arguments:
  collection            Collection(s)

options:
  -h, --help            show this help message and exit
  -n, --no-deps         Don't download collection(s) listed as dependencies.
  **-p DOWNLOAD_PATH, --download-path DOWNLOAD_PATH**
                        The directory to download the collections to.
  -r REQUIREMENTS, --requirements-file REQUIREMENTS
                        A file containing a list of collections to be downloaded.

My .kitchen.yaml:

provisioner:
      hosts: test-kitchen
      name: ansible_playbook
      roles_path: roles
      playbook: <%= settings[:playbook] %>
      ansible_extra_flags: --skip-tags=post --extra-vars "aws_default_region=<%= settings[:aws_default_region] %> 
      cloud_provider=<%= settings[:cloud_provider] %> ubuntu_version=<%= settings[:ubuntu_version] %>"
      require_ansible_repo: false
      ansible_verbosity: 2
      ansible_verbose: true
      ansible_diff: true
      ansible_binary_path: /usr/local/bin
<% if settings[:ubuntu_version] == '18.04' %>
      require_pip: true
      ansible_version: 2.8.10
<% elsif settings[:ubuntu_version] == '20.04' %
      require_pip3: true
      ansible_version: 6.7.0
      requirements_collection_path: ./roles/requirements.yml
<% elsif settings[:ubuntu_version] == '22.04' %>
      require_pip3: true
      ansible_version: 7.1.0
      requirements_collection_path: ./roles/requirements.yml
<% end %>

Ansible version and ansible.cfg configurations:

ansible-playbook [core 2.13.7]
config file = /etc/ansible/ansible.cfg
configured module search path = ['/home/ubuntu/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python3.8/dist-packages/ansible
ansible collection location = /tmp/kitchen/collections:/usr/share/ansible/collections:/home/ubuntu/.ansible/collections
executable location = /usr/local/bin/ansible-playbook
python version = 3.8.10 (default, Nov 14 2022, 12:59:47) [GCC 9.4.0]
[jinja version = 3.1.2
libyaml = True

Am i missing something or the --download-path option is not supported by the kitchen-ansible?

Thanks in advance

denists1984 avatar Feb 03 '23 19:02 denists1984