apt module with list of packages

32 views
Skip to first unread message

Jason Clark

unread,
Jul 17, 2014, 4:12:53 PM7/17/14
to ansible...@googlegroups.com
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...

Michael DeHaan

unread,
Jul 17, 2014, 9:42:29 PM7/17/14
to ansible...@googlegroups.com
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"





On Thu, Jul 17, 2014 at 4:12 PM, Jason Clark <jason...@360pi.com> wrote:
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...

--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/4cd3ee55-5439-445f-932f-4b6230e04898%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jason Clark

unread,
Jul 18, 2014, 12:33:57 PM7/18/14
to ansible...@googlegroups.com
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
Reply all
Reply to author
Forward
0 new messages