Skip to content

Instantly share code, notes, and snippets.

@whacked
Last active June 19, 2017 07:49
Show Gist options
  • Save whacked/25ed7b1436517b942e61a6892239529a to your computer and use it in GitHub Desktop.
Save whacked/25ed7b1436517b942e61a6892239529a to your computer and use it in GitHub Desktop.
spin up a xenial image with vnc
[all]
xenial-host
[all:vars]
ansible_user=vagrant
ansible_python_interpreter=/usr/bin/python3
ansible_port=2222
ansible_ssh_common_args='-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null'
# ansible-playbook -vvv -i hosts playbook.yml
- hosts: all
sudo: True
roles:
- webofmars.xfce4-desktop
vars:
ansible_user_home: "/home/{{ ansible_user }}"
src_directory: "/home/src"
tasks:
- shell: whoami
- package:
# vncserver -geometry 1920x1080
name: vnc4server
state: latest
- command: which emacs
register: which_emacs
ignore_errors: True
# EMACS
- block:
# ubuntu only
- package:
name: emacs
state: build-dep
- package:
name: "{{ item }}"
state: latest
with_items:
- build-essential
- libpng-dev
- libgif-dev
- libtiff5-dev
- imagemagick
- libmagickcore-dev
- libwebkitgtk-3.0-dev
- libgtk-3-dev
- libxpm-dev
- libxml2-dev
- libcairo2-dev
- libncurses5-dev
- libmagick++-dev
- file:
path: "{{ src_directory }}/emacs-25.2"
state: directory
owner: "{{ ansible_user }}"
group: "{{ ansible_user }}"
# download emacs source
- get_url:
url: https://ftp.gnu.org/gnu/emacs/emacs-25.2.tar.xz
dest: "{{ src_directory }}/emacs-25.2.tar.xz"
owner: "{{ ansible_user }}"
group: "{{ ansible_user }}"
# Unarchive a file that needs to be downloaded (added in 2.0)
- unarchive:
src: "{{ src_directory }}/emacs-25.2.tar.xz"
dest: "{{ src_directory }}"
owner: "{{ ansible_user }}"
group: "{{ ansible_user }}"
remote_src: True
- name: configure & build emacs
shell: "{{ item }}"
args:
chdir: "{{ src_directory }}/emacs-25.2"
become: yes
become_user: "{{ ansible_user }}"
with_items:
- ./configure --with-cairo --with-xwidgets --with-x-toolkit=gtk
- make -j2
- name: install emacs
shell: "make install"
args:
chdir: "{{ src_directory }}/emacs-25.2"
when: which_emacs|failed
# /EMACS
# ELECTRON
- package:
name: "{{ item }}"
state: latest
with_items:
- npm
- nodejs-legacy
- libgtk2.0-0
- npm:
global: yes
name: "{{ item }}"
with_items:
- npm
- n
- shell: n stable
# bloddy npm installers. this is the only one that works
# https://github.com/electron-userland/electron-prebuilt/issues/139#issuecomment-245098956
- shell: npm install -g electron --unsafe-perm=true --allow-root
# bloddy electron fix
# without it, you get
# Xlib: extension "XInputExtension" missing on display ":1.0".
# and electron doesn't start
# ref: https://github.com/Microsoft/vscode/issues/3451#issuecomment-248398326
- shell: sed -i 's/BIG-REQUESTS/_IG-REQUESTS/' /usr/lib/x86_64-linux-gnu/libxcb.so.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment