I'd like to extend my ansible playbook to install/verify installation of phantomjs and wkhtmltopdf to my Debian 7 machine. Both programs are available as packed tarballs via HTTP. I know the get_url module, but it doesn't unpack stuff, and if I'd add some shell commands for unpacking and moving the binaries, I suspect each time I run ansible, the tarballs would be downloaded, unpacked and moved again, causing unnecessary network traffic.
How can I solve this? Should I make a .deb file and run that using the apt command, or should I make a new ansible module for installing tarballs, or is there something that I'm overlooking?
For other installation options, we recommend installing via “pip”, which is the Python package manager, though other options are also available. If you wish to track the development release to use and test the latest features, we will share information about running from source.
You can also use the unarchive module to unpack your tar file directly from the HTTP source.
- name: Download and unpack directly from HTTP source
unarchive:
src: "http://your_tarball_to_download.tar.gz"
dest: "/home/dest_directory"
copy: no
More information about the unarchive module can be found on the docs http://docs.ansible.com/ansible/unarchive_module.html
If you download specific versions (e.g. foo_1.2.3.tar.gz
and not foo_latest.tar.gz
), you can do this by keeping the downloaded tarball :
- name: Gets tarball
sudo: yes
sudo_user: "{{ deploy_user }}"
get_url:
url="http://some.host/some_tarball-{{ tarball_version }}.tar.gz"
dest="/home/{{ deploy_user }}/"
register: new_archive
- name: Unarchive source
sudo: yes
sudo_user: "{{ deploy_user }}"
unarchive:
src="/home/{{ deploy_user }}/some_tarball-{{ tarball_version }}.tar.gz"
dest="/home/{{ deploy_user }}/app/"
copy=no
when: new_archive|changed
Change variables according to your environment.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With