Created
December 16, 2016 10:47
-
-
Save craig-m/9269314c1739f7f10bbdc8eeecb6353b to your computer and use it in GitHub Desktop.
single page ansible playbook for gohugo.io webdev
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
--- | |
# everything needed for n0de.cloud Hugo web dev | |
# | |
# $ ansible-playbook webdev_playbook.yml -i localhost | |
- name: hugo webdev complete | |
hosts: localhost | |
connection: local | |
# --- varibles --- | |
vars: | |
# Hugo CMS | |
hugo_url: "https://github.com/spf13/hugo/releases/download/v0.17/hugo_0.17-64bit.deb" | |
hugo_sha: "de17a12fc5f8379fd19665ead6561f3d0ca334269172d633b7dc32fa6bb66a40" | |
# NodeJS | |
node_url: "https://deb.nodesource.com/setup_7.x" | |
node_sha: "f8a4754cf73cf8ea0a373bb85529c29c00ecac605c2a399897cb0595ba8f4618" | |
# PhantomJS | |
phantom_url: "https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2" | |
phantom_sha: "86dd9a4bf4aee45f1a84c9f61cf1947c1d6dce9b9e8d2a907105da7852460d2f" | |
# --- tasks --- | |
tasks: | |
# test | |
- name: test | |
shell: hostname | |
changed_when: False | |
# hugo - https://gohugo.io/ | |
- name: check hugo deb file dowloaded | |
stat: path=~/source/hugo_0.17-64bit.deb | |
register: hugodeb | |
# download | |
- name: download hugo | |
get_url: | |
url: "{{ hugo_url }}" | |
dest: ~/source/ | |
checksum: sha256:{{ hugo_sha }} | |
when: hugodeb.stat.exists == False | |
register: hugodebdl | |
retries: 1 | |
delay: 10 | |
# install | |
- name: Install a hugo.deb package | |
apt: | |
deb: /home/{{ ansible_user }}/source/hugo_0.17-64bit.deb | |
sudo: yes | |
when: hugodebdl.changed | |
# NodeJS | |
# https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions | |
- name: check nodejs install script | |
stat: path=~/source/nodejs_setup_7.x | |
register: nodejsinstsh | |
# download installation script :( | |
- name: download nodejs | |
get_url: | |
url: "{{ node_url }}" | |
dest: ~/source/nodejs_setup_7.x | |
checksum: sha256:{{ node_sha }} | |
when: nodejsinstsh.stat.exists == False | |
register: nodejsshdeb | |
retries: 1 | |
delay: 10 | |
# install script to add repo | |
- name: run nodejs install script | |
script: /home/{{ ansible_user }}/source/nodejs_setup_7.x | |
sudo: yes | |
when: nodejsshdeb.changed | |
# apt-get update | |
- name: run apt-get update | |
apt: | |
update_cache: yes | |
sudo: yes | |
changed_when: False | |
# install nodejs package | |
- name: install nodejs | |
sudo: yes | |
apt: name=nodejs state=present | |
# PhantomJS | |
# http://phantomjs.org/ | |
- name: check PhantomJS bin | |
stat: path=~/source/phantomjs-2.1.1-linux-x86_64.tar.bz2 | |
register: phantomjssrc | |
# download | |
- name: download phantomjs | |
get_url: | |
url: "{{ phantom_url }}" | |
dest: ~/source/ | |
checksum: sha256:{{ phantom_sha }} | |
when: phantomjssrc.stat.exists == False | |
register: phantomjssrcdl | |
retries: 1 | |
delay: 10 | |
# uncompress | |
- name: unarchive phantomjs | |
unarchive: src=~/source/phantomjs-2.1.1-linux-x86_64.tar.bz2 dest=~/bin/ | |
# sass css | |
- name: sass css lang | |
gem: name=sass state=latest | |
# npm install (packages.json) | |
- name: npm install | |
shell: npm install | |
sudo: yes | |
# bower - install global packages | |
- name: Install npm packages | |
npm: name={{ item }} global=yes | |
with_items: | |
- bower | |
- grunt | |
- gulp | |
- csslint | |
sudo: yes | |
# bower - update | |
- name: bower update | |
shell: bower update | |
# bower - install CSS/JS packages (bower.json) | |
- name: install bower packages | |
shell: bower install |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment