Last active
February 2, 2018 23:49
-
-
Save daino3/e8e87720169d6ba53900305b26b300d7 to your computer and use it in GitHub Desktop.
Ansible role for installing phantomjs on Ubuntu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
# exists at roles/phantomjs/tasks/main.yml | |
- name: Update repositories cache and system deps | |
apt: name={{ item }} state=present update_cache=yes | |
with_items: | |
- build-essential | |
- chrpath | |
- libssl-dev | |
- libxft-dev | |
- name: Install phantomjs deps | |
apt: name={{ item }} state=present | |
with_items: | |
- libfreetype6 | |
- libfreetype6-dev | |
- libfontconfig1 | |
- libfontconfig1-dev | |
- name: Get phantomjs tarball | |
get_url: | |
url: "https://github.com/Medium/phantomjs/releases/download/v2.1.1/{{ phantomjs_version }}.tar.bz2" | |
dest: "/tmp/{{ phantomjs_version }}.tar.bz2" | |
ignore_errors: true | |
- name: Extract {{ phantomjs_version }}.tar.bz2 | |
command: "sudo tar xvjf {{ phantomjs_version }}.tar.bz2" | |
args: | |
chdir: "/tmp" | |
- name: Move {{ phantomjs_version }} to /usr/local/share | |
command: "mv /tmp/{{ phantomjs_version }} /usr/local/share/{{ phantomjs_version }}" | |
args: | |
creates: "/usr/local/share/{{ phantomjs_version }}" | |
- name: Symlink phantomjs executable | |
file: | |
src: "/usr/local/share/{{ phantomjs_version }}/bin/phantomjs" | |
dest: /usr/local/bin/phantomjs | |
owner: "{{ ansible_ssh_user }}" | |
state: link |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
# exists at roles/phantomjs/defaults/main.yml | |
phantomjs_version: phantomjs-2.1.1-linux-x86_64 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment