# Uninstall not needed collections when using ansible-builder

**URL:** <https://forum.ansible.com/t/uninstall-not-needed-collections-when-using-ansible-builder/7568>\
**Category:** Get Help\
**Tags:** awx, collections, ansible-builder, ee\
**Created:** [July 31, 2024, 3:18pm UTC](https://forum.ansible.com/t/uninstall-not-needed-collections-when-using-ansible-builder/7568 "2024-07-31T15:18:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marcelo\_Arizaga](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/marcelo_arizaga/32/2860_2.png) [@Marcelo\_Arizaga](https://forum.ansible.com/u/Marcelo_Arizaga)\
**Post date:** [July 31, 2024, 3:18pm UTC](https://forum.ansible.com/t/uninstall-not-needed-collections-when-using-ansible-builder/7568/1 "2024-07-31T15:18:59Z")

</div>

Is There a way to unistall not needed collections?.

- when run ansible-builder it uses execution-environment.yml file to read collections you want.
- But if i use base iamge, it comes with bunch of collections i dont need.
- awx-ee:23.5.0 comes with theforeman.foreman, ovirt.ovirt and others.
- i got some issues dealing with dependencies, sometime they dont match.

I would apreciate if you can give some advice on it or the best aproach to improve building execution environments.

regards  
Marcelo

---

<div class="post-metadata">

**Author:** ![Denney-tech](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/denney-tech/32/1556_2.png) [@Denney-tech](https://forum.ansible.com/u/Denney-tech)\
**Post date:** [July 31, 2024, 4:41pm UTC](https://forum.ansible.com/t/uninstall-not-needed-collections-when-using-ansible-builder/7568/2 "2024-07-31T16:41:12Z")

</div>

If you want to only have the collections you prefer in your image, then you should either use a proper base image (fedora/centos/ubi, I think ansible-builder recently added support for other distros as well, you just have to define the package manager commands); or you could use the [community-minimal-ee](http://forum.ansible.com/t/release-announcement-ansible-community-execution-environment-base-and-minimal-2-17-2-1/7355) which contains only 3 `ansible.*` collections.

You should also consider using multiple EE’s. The AWX-EE has _everything it needs_ for AWX to function. This should be the control plane’s EE (i.e. `control_plane_ee_image`). Your custom EE’s can be added as extra execution environments and you can set them as the default EE for your Org, while still allowing the AWX itself to use its own EE.

---

<div class="post-metadata">

**Author:** ![bvitnik](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/bvitnik/32/4132_2.png) [@bvitnik](https://forum.ansible.com/u/bvitnik)\
**Post date:** [August 1, 2024, 12:07am UTC](https://forum.ansible.com/t/uninstall-not-needed-collections-when-using-ansible-builder/7568/3 "2024-08-01T00:07:59Z")

</div>

If `awx-ee` is the closest thing to what you need but has some extras, you can use it as a base image but remove extra collections by running `rm -rf /path/to/collection` inside `additional_build_step` key of the `execution-environment.yml`:

[https://ansible.readthedocs.io/projects/builder/en/latest/definition/#additional-build-steps](https://ansible.readthedocs.io/projects/builder/en/latest/definition/#additional-build-steps)

`append_galaxy` sub key should do the trick, if not, use `append_final`.
