Is there a way to have a file i.e system-requirements.txt with a package per line and have the apt module install that? Exactly how pip works…
apt is not pip, but we have some very nice lookup plugins that are useful.
- apt: name={{ item }} state=installed
with_pipe: cat /path/to/file.txt
Note that the file.txt is assumed to be on the control machine.
Alternatively, you could register the result of running ls and loop through “result.stdout_lines”
Thanks Michael. Yeah I didn’t mean pip == apt but that the apt module in ansible take a file like the pip module does.
Here is what I ended up with in case anyone else needs to do the same thing.
- name: Ensure all base system packages are installed
sudo: true
apt: pkg={{ item }} state=installed
with_lines: cat …/files/base-packages.txt