# Does the \`ansible.builtin.apt\` module provide parameters that only downloads the debian packages and not install it?

**URL:** <https://forum.ansible.com/t/does-the-ansible-builtin-apt-module-provide-parameters-that-only-downloads-the-debian-packages-and-not-install-it/6052>\
**Category:** Get Help\
**Tags:** ansible-core\
**Created:** [May 29, 2024, 8:59am UTC](https://forum.ansible.com/t/does-the-ansible-builtin-apt-module-provide-parameters-that-only-downloads-the-debian-packages-and-not-install-it/6052 "2024-05-29T08:59:14Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ShanDesai](https://avatars.discourse-cdn.com/v4/letter/s/838e76/32.png) [@ShanDesai](https://forum.ansible.com/u/ShanDesai)\
**Post date:** [May 29, 2024, 8:59am UTC](https://forum.ansible.com/t/does-the-ansible-builtin-apt-module-provide-parameters-that-only-downloads-the-debian-packages-and-not-install-it/6052/1 "2024-05-29T08:59:14Z")

</div>

From what I know using `apt-get upgrade -d` only downloads the packages in the `/var/cache/apt/archives` directory [source](https://askubuntu.com/questions/706483/how-can-i-download-then-install-packages)

Based on the documentation there is no explicit mention of download parameter. Does someone have any information about this. I would like to avoid using `command` module for something that already has a module in `ansible-core`.

---

<div class="post-metadata">

**Author:** ![motorbass](https://avatars.discourse-cdn.com/v4/letter/m/13edae/32.png) [@motorbass](https://forum.ansible.com/u/motorbass)\
**Post date:** [May 29, 2024, 9:08am UTC](https://forum.ansible.com/t/does-the-ansible-builtin-apt-module-provide-parameters-that-only-downloads-the-debian-packages-and-not-install-it/6052/2 "2024-05-29T09:08:50Z")

</div>

Hi  
It seems there’s no options to make it works or workaround like you need.  
So probably you’ll go for command or script-like.

What’s the purpose to download package without installing it ?

Some people already try to ask a PR about that :  
[https://github.com/ansible/ansible/issues/23220](https://github.com/ansible/ansible/issues/23220)

---

<div class="post-metadata">

**Author:** ![ShanDesai](https://avatars.discourse-cdn.com/v4/letter/s/838e76/32.png) [@ShanDesai](https://forum.ansible.com/u/ShanDesai)\
**Post date:** [May 29, 2024, 9:15am UTC](https://forum.ansible.com/t/does-the-ansible-builtin-apt-module-provide-parameters-that-only-downloads-the-debian-packages-and-not-install-it/6052/3 "2024-05-29T09:15:46Z")

</div>

I have certain air-gapped devices which I would like to update on a timely basis. Having the debian packages downloaded on a device connected with internet and then tarballing it to be shipped to the air-gapped environment would be something interesting to tackle.

From what I understand setting up a file-server on a gateway device which is connected to an air-gapped Ansible group would act similar to APT repositories on the internet.

---

<div class="post-metadata">

**Author:** ![motorbass](https://avatars.discourse-cdn.com/v4/letter/m/13edae/32.png) [@motorbass](https://forum.ansible.com/u/motorbass)\
**Post date:** [May 29, 2024, 9:18am UTC](https://forum.ansible.com/t/does-the-ansible-builtin-apt-module-provide-parameters-that-only-downloads-the-debian-packages-and-not-install-it/6052/4 "2024-05-29T09:18:55Z")

</div>

Ok that makes sense.  
Another solution but it’s more a networking-oriented solution, should be to get your own apt mirror (like a server that get access to internet) then configure your sources.list on your air-gapped devices to this mirror.

Then you can easily manage available packages and/or update/upgrade rythm with Ansible playbook that only make update/upgrade tasks.

We set up that kind of solution for different purpose (to avoid to get a bunch of VM that have access to internet) and it works pretty well.

---

<div class="post-metadata">

**Author:** ![ShanDesai](https://avatars.discourse-cdn.com/v4/letter/s/838e76/32.png) [@ShanDesai](https://forum.ansible.com/u/ShanDesai)\
**Post date:** [May 29, 2024, 9:20am UTC](https://forum.ansible.com/t/does-the-ansible-builtin-apt-module-provide-parameters-that-only-downloads-the-debian-packages-and-not-install-it/6052/5 "2024-05-29T09:20:55Z")

</div>

Any documentation on how to achieve the mirror settings? I am looking into similar lines of implementation too.

---

<div class="post-metadata">

**Author:** ![motorbass](https://avatars.discourse-cdn.com/v4/letter/m/13edae/32.png) [@motorbass](https://forum.ansible.com/u/motorbass)\
**Post date:** [May 29, 2024, 9:25am UTC](https://forum.ansible.com/t/does-the-ansible-builtin-apt-module-provide-parameters-that-only-downloads-the-debian-packages-and-not-install-it/6052/6 "2024-05-29T09:25:53Z")

</div>

Sure, that kind of tutorial is a good basis :

> **[How to Create a Local Debian Mirror or Ubuntu Repository](https://pendrivelinux.com/how-to-set-up-your-own-debian-linux-mirror/?utm_content=cmp-true)**
>
> Create a self hosted local Ubuntu Mirror or Debian Mirror Repository. Share locally or on the internet. Speed up the process of installing packages

Depends on mirror you need (Deb10,11,12 or others) you may face some issues related to “Translation” but there’s some tips & tricks to resolve this.

About storage, in our case we got Deb11 & Deb12 (without src) mirroring and it takes around 500GB. So you need to properly size your storage parts before mirroring, cause it can takes a lot of space if you didn’t handle it well 🙂

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [June 28, 2024, 9:26am UTC](https://forum.ansible.com/t/does-the-ansible-builtin-apt-module-provide-parameters-that-only-downloads-the-debian-packages-and-not-install-it/6052/7 "2024-06-28T09:26:33Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
