Outside of the plugin APIs, none of the python code of ansible-core should be considered a public API. Effectively, in practice that means that the ability to run any of the functionality of the ansible CLIs is not supported by any public API.
➤ python3 test.py
Starting galaxy collection install process
Nothing to do. All requested collections are already installed. If you want to reinstall them, consider using `--force`.
Starting galaxy role install process
- downloading role 'php', owned by geerlingguy
- downloading role from https://github.com/geerlingguy/ansible-role-php/archive/6.0.0.tar.gz
- extracting geerlingguy.php to /home/mark/.config/ansible/roles/geerlingguy.php
- geerlingguy.php (6.0.0) was installed successfully
Thanks for the quick feedback on this. I have some CLI tools based on Ansible Runner, with a use case where I wanted to fine tune some of the Galaxy dependency handling… read requirements from a file, detect what’s already installed, confirm user approval, installing the missing ones… but in the interest of time and simplicity, I decided to abandon this. There’s no reasons why those tools can’t just ship with a requirements file, install from that during runtime, and be done with it.
@gundalow Hope this answers your question. ansible-galaxy command works just fine
@markstos Nice! And could be very useful for other stuff too… I ended up doing this basically.