Skip to content

Instantly share code, notes, and snippets.

@danlamanna
Created August 24, 2014 19:40
Show Gist options
  • Select an option

  • Save danlamanna/ad0f05eb3866ea5bd68c to your computer and use it in GitHub Desktop.

Select an option

Save danlamanna/ad0f05eb3866ea5bd68c to your computer and use it in GitHub Desktop.
---
- hosts: amd64_personal
remote_user: dan
vars:
- root_password: "foo"
tasks:
- name: change root password
sudo: yes
user:
name=root
password=$root_password
- name: add dan to sudoers
sudo: yes
lineinfile:
dest=/etc/sudoers
regexp="dan ALL"
line="dan ALL=NOPASSWD:ALL"
state=present
- name: apt-get update && apt-get install build-essential
sudo: yes
apt: update_cache=yes
apt: name=build-essential state=present
- name: install base packages
sudo: yes
apt: name={{ item }} state=present
with_items:
- ack-grep
- artha
- chromium
- claws-mail
- claws-mail-plugins
- claws-mail-extra-plugins
- claws-mail-trayicon
- claws-mail-pgpinline
- claws-mail-pgpmime
- cmake
- curl
- ecryptfs-utils
- filezilla
- git
- gtk-redshift
- htop
- keepassx
- libclang-dev
- libx11-dev
- mlocate
- openjdk-7-jre
- pcmanfm
- pidgin
- python-dev
- python-pip
- synergy
- tmux
- transmission-gtk
- valgrind
- virtualbox
- vlc
- zsh
- name: remove certain default packages
sudo: yes
apt: name={{ item }} state=absent
with_items:
- clipit
- conky
- thunar
- name: create home directory structure
file:
dest=/home/dan/{{ item }}
mode=755
owner=dan
group=dan
state=directory
with_items:
- bin
- src
- tmp
- name: clone dotfiles
git:
repo=git@github.com:danlamanna/dotfiles.git
dest=/home/dan/dotfiles
- name: change default shell
sudo: yes
command: chsh -s /bin/zsh dan
- name: remove defaults in order to symlink
file:
path=/home/dan/{{ item }}
state=absent
with_items:
- dotfiles/.bashrc
- dotfiles/.tmux.conf
- dotfiles/.emacs.d
- dotfiles/.Xmodmap
- dotfiles/openbox/autostart
- dotfiles/openbox/menu.xml
- dotfiles/openbox/rc.xml
- dotfiles/terminator/config
- dotfiles/tint2/tint2rc
- name: symlink dotfiles
file:
src=/home/dan/{{ item.src }}
dest=/home/dan/{{ item.dest }}
owner=dan
group=dan
state=link
force=yes # src may already exist, delete it and link to dest regardless.
with_items:
- { src: "dotfiles/.bashrc", dest: ".bashrc" }
- { src: "dotfiles/.tmux.conf", dest: ".tmux.conf" }
- { src: "dotfiles/.emacs.d", dest: ".emacs.d" }
- { src: "dotfiles/.Xmodmap", dest: ".Xmodmap" }
- { src: "dotfiles/openbox/autostart", dest: ".config/openbox/autostart" }
- { src: "dotfiles/openbox/menu.xml", dest: ".config/openbox/menu.xml" }
- { src: "dotfiles/openbox/rc.xml", dest: ".config/openbox/rc.xml" }
- { src: "dotfiles/terminator/config", dest: ".config/terminator/config" }
- { src: "dotfiles/tint2/tint2rc", dest: ".config/tint2/tint2rc" }
- name: use pcmanfm instead of thunar
file:
src=/usr/bin/pcmanfm
dest=/home/dan/bin/thunar
owner=dan
group=dan
state=link
- name: update alternatives
sudo: yes
alternatives:
name=java
path=/usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java
- name: _Grid Layouts_ copy setlayout.c
copy:
src=files/setlayout.c
dest=/home/dan/src
- name: _Grid Layouts_ compile setlayout.c
command:
gcc -o /home/dan/bin/setlayout /home/dan/src/setlayout.c -lX11
creates=/home/dan/bin/setlayout
@danlamanna

Copy link
Copy Markdown
Author

PLAY [amd64_personal] *********************************************************

GATHERING FACTS ***************************************************************
ok: [localhost]

TASK: [change root password] **************************************************
changed: [localhost]

TASK: [add dan to sudoers] ****************************************************
changed: [localhost]

TASK: [apt-get update && apt-get install build-essential] *********************
ok: [localhost]

TASK: [install base packages] *************************************************
changed: [localhost] => (item=ack-grep,artha,chromium,claws-mail,claws-mail-plugins,claws-mail-extra-plugins,claws-mail-trayicon,claws-mail-pgpinline,claws-mail-pgpmime,cmake,curl,ecryptfs-utils,filezilla,git,gtk-redshift,htop,keepassx,libclang-dev,libx11-dev,mlocate,openjdk-7-jre,pcmanfm,pidgin,python-dev,python-pip,synergy,tmux,transmission-gtk,valgrind,virtualbox,vlc,zsh)

TASK: [remove certain default packages] ***************************************
changed: [localhost] => (item=clipit,conky,thunar)

TASK: [create home directory structure] ***************************************
ok: [localhost] => (item=bin)
changed: [localhost] => (item=src)
ok: [localhost] => (item=tmp)

TASK: [clone dotfiles] ********************************************************
changed: [localhost]

TASK: [change default shell] **************************************************
changed: [localhost]

TASK: [remove defaults in order to symlink] ***********************************
changed: [localhost] => (item=dotfiles/.bashrc)
changed: [localhost] => (item=dotfiles/.tmux.conf)
changed: [localhost] => (item=dotfiles/.emacs.d)
changed: [localhost] => (item=dotfiles/.Xmodmap)
changed: [localhost] => (item=dotfiles/openbox/autostart)
changed: [localhost] => (item=dotfiles/openbox/menu.xml)
changed: [localhost] => (item=dotfiles/openbox/rc.xml)
changed: [localhost] => (item=dotfiles/terminator/config)
changed: [localhost] => (item=dotfiles/tint2/tint2rc)

TASK: [symlink dotfiles] ******************************************************
changed: [localhost] => (item={'dest': '.bashrc', 'src': 'dotfiles/.bashrc'})
changed: [localhost] => (item={'dest': '.tmux.conf', 'src': 'dotfiles/.tmux.conf'})
changed: [localhost] => (item={'dest': '.emacs.d', 'src': 'dotfiles/.emacs.d'})
changed: [localhost] => (item={'dest': '.Xmodmap', 'src': 'dotfiles/.Xmodmap'})
changed: [localhost] => (item={'dest': '.config/openbox/autostart', 'src': 'dotfiles/openbox/autostart'})
changed: [localhost] => (item={'dest': '.config/openbox/menu.xml', 'src': 'dotfiles/openbox/menu.xml'})
changed: [localhost] => (item={'dest': '.config/openbox/rc.xml', 'src': 'dotfiles/openbox/rc.xml'})
changed: [localhost] => (item={'dest': '.config/terminator/config', 'src': 'dotfiles/terminator/config'})
changed: [localhost] => (item={'dest': '.config/tint2/tint2rc', 'src': 'dotfiles/tint2/tint2rc'})

TASK: [use pcmanfm instead of thunar] *****************************************
changed: [localhost]

TASK: [update alternatives] ***************************************************
changed: [localhost]

TASK: [Grid Layouts copy setlayout.c] ***************************************
changed: [localhost]

TASK: [Grid Layouts compile setlayout.c] ************************************
changed: [localhost]

PLAY RECAP ********************************************************************
localhost : ok=15 changed=13 unreachable=0 failed=0

@danlamanna

Copy link
Copy Markdown
Author

PLAY [amd64_personal] *********************************************************

GATHERING FACTS ***************************************************************
ok: [localhost]

TASK: [change root password] **************************************************
ok: [localhost]

TASK: [add dan to sudoers] ****************************************************
ok: [localhost]

TASK: [apt-get update && apt-get install build-essential] *********************
ok: [localhost]

TASK: [install base packages] *************************************************
ok: [localhost] => (item=ack-grep,artha,chromium,claws-mail,claws-mail-plugins,claws-mail-extra-plugins,claws-mail-trayicon,claws-mail-pgpinline,claws-mail-pgpmime,cmake,curl,ecryptfs-utils,filezilla,git,gtk-redshift,htop,keepassx,libclang-dev,libx11-dev,mlocate,openjdk-7-jre,pcmanfm,pidgin,python-dev,python-pip,synergy,tmux,transmission-gtk,valgrind,virtualbox,vlc,zsh)

TASK: [remove certain default packages] ***************************************
ok: [localhost] => (item=clipit,conky,thunar)

TASK: [create home directory structure] ***************************************
ok: [localhost] => (item=bin)
ok: [localhost] => (item=src)
ok: [localhost] => (item=tmp)

TASK: [clone dotfiles] ********************************************************
changed: [localhost]

TASK: [change default shell] **************************************************
failed: [localhost] => {"failed": true, "parsed": false}
invalid output was:
/usr/bin/python: can't open file '�[H�[J/home/dan/.ansible/tmp/ansible-tmp-1408909541.5-166181350534438/command': [Errno 2] No such file or directory

FATAL: all hosts have already failed -- aborting

PLAY RECAP ********************************************************************
to retry, use: --limit @/home/dan/playbook.retry

localhost : ok=8 changed=1 unreachable=0 failed=1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment