Hi Dick, > I'm setting out to upgrade ansible in some places here. > We exclusively use ansible in dedicated venvs, using python3.9. > Most of the installs are 3.4.0. > Looking back over the last years I had the impression that doing 'pip > install ansible' was increasingly slower. > This makes sense as there is increasingly more to it. I just a quick
note that installing Ansible is also pretty slow since there are no wheels. This is something that will change for Ansible 6 (see https://docs.ansible.com/ansible/devel/roadmap/COLLECTIONS_6.html#planned-work and https://github.com/ansible-community/antsibull/pull/395). > test and indeed it's been growing a lot: > > 153M 2.9.27 > 368M 2.10.7 > 402M 3.4.0 > 488M 4.10.0 > 508M 5.3.0 > > Half a gig seems like a lot for what we do - we use the same modules > as when we ran 2.9. It's not just a lot for what you do, it's also a lot for everyone else :) Actually with Ansible 6 size should drop considerably (roughtly ~50 %) since we plan to leave out tests/ and docs/ folders for collections (see the roadmap and https://github.com/ansible-community/community-topics/issues/65). Obviously that does not solve the problem that Ansible as a package contains a lot more than most folks will ever need. Your point here: > Since we only use a fraction of these, I would like to have only those > installed. is totally valid! There have been discussions in the past on whether it's better to teach folks to install ansible-core + only the collections they need (which also fits nicely to the concept of Execution Environments), or whether it's better to just let them install the Ansible package "with batteries included" (including a lot of exotic batteries you will never need). > I couldn't find any clean way of uninstalling collections from > lib/python3.9/site-packages/ansible_collections. I don't think it is really possible to do this in a clean way. (Simply `rm -rf`-ing them works fine though, pip does not complain if files have vanished.) > But rather than fetching content and then removing almost all of it > again, I thought it'd be cleaner to start with ansible-core and then > add collections to that. > [...] > > It appears I now have a fully functioning ansible install, with just > the collections that I need: > > [...] Sivel aleady pointed you to the https://github.com/ansible-community/ansible-build-data/ repository, which contains (among other things) the collection versions that are included in Ansible. You can either use the data from there to compile your own collection requirements file with the same versions, but just the collections you are interested in, or you can use the same machinery we use to build the Ansile package (https://github.com/ansible-community/antsibull/) to create your own ansible Python package which contains exactly the collections you want. (That's definitely more work, but in the end you get a single tarball you can also install on air-gapped machines. Depending on your use-case and the number of machines you want to install this on, this can be useful.) > Now, while all of this seems to work - I'm not sure if it is supposed > to work.... > Are there any gotchas with this approach? I would change the part of your approach which extracts the collection versions to use the ansible-build-data repo instead, but besides that, it's a totally valid approach! Cheers, Felix -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/20220223174725.7e78e083%40rovaniemi.
