Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
---
- hosts: localhost
connection: local
become: true
vars:
- google_file: /etc/apt/sources.list.d/google-chrome.list
tasks:
- name: base deps
apt: name={{ item }} update_cache=yes
with_items:
- git
- gnupg
- curl
- wget
- file
- apt-transport-https
- ca-certificates
- gnupg-agent
- software-properties-common
- name: Does the Docker apt exist?
command: grep "download.docker.com/linux/ubuntu" /etc/apt/sources.list
register: docker_apt_exists
ignore_errors: true
- name: Add Docker key
shell: wget -q -O - https://download.docker.com/linux/ubuntu/gpg | apt-key add -
when: docker_apt_exists.rc != 0
- name: Add Docker CE repo
shell: add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
when: docker_apt_exists.rc != 0
- name: Does the Google apt file exist?
command: test -f {{google_file}}
register: google_apt_exists
ignore_errors: true
- name: Add Google Chrome key
shell: wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
when: google_apt_exists.rc == 1
- name: Add Google Chrome repo
copy: content="deb http://dl.google.com/linux/chrome/deb/ stable main" dest={{google_file}} owner=root group=root mode=644
when: google_apt_exists.rc == 1
# slack, keybase, music-player, nvidia
- name: Check if node is installed
command: dpkg-query -l nodejs
register: nodejs_check
failed_when: no
changed_when: no
- name: setup nodejs apt
shell: curl -sL https://deb.nodesource.com/setup_12.x | bash -
when: nodejs_check.rc != 0
- name: setup nvidia ppa
command: add-apt-repository ppa:graphics-drivers/ppa
- name: Install Packages
apt: name={{ item }} update_cache=yes
with_items:
- google-chrome-stable
- chrome-gnome-shell
- emacs
- zsh
- tmux
- tig
- htop
- tlp
- wmctrl
- fcitx-mozc
- docker-ce
- docker-ce-cli
- containerd.io
- nodejs
- ruby
- emacs-mozc
- emacs-mozc-bin
- peco
- fasd
- jq
- network-manager-gnome
- network-manager-l2tp-gnome
- libreswan
- fonts-inconsolata
- fonts-ricty-diminished
- openjdk-11-jdk
- python-pip
- steam
- vlc
- sysfsutils
- qemu-kvm
- xclip
- vim
- silversearcher-ag
- plantuml
- tree
- unar
- name: Install nodejs global packages
npm: name={{ item }} global=yes
with_items:
- yarn
- typescript-language-server
- prettier
- lumo-cljs
- react-native-cli
- name: Install python packages
pip:
name: '{{ item }}'
executable: pip3
with_items:
- awscli
# snap module will be added in 2.8
# - name: Install vscode
# snap:
# name: code
# classic: yes
- shell: snap install code slack android-studio --classic
- shell: sudo apt-get -y install $(check-language-support -l ja)
- name: setup my user
user: name=k2nr shell=/usr/bin/zsh groups=docker,kvm,plugdev,sudo
- hosts: localhost
connection: local
tasks:
- file:
path: ~/repos
state: directory
mode: 0755
- file:
path: ~/bin
state: directory
mode: 0755
- name: dotfiles
git:
repo: https://github.com/k2nr/dotfiles
dest: ~/repos/dotfiles
update: yes
- command: ~/repos/dotfiles/link.sh
args:
chdir: ~/repos/dotfiles
- git:
repo: https://github.com/robbyrussell/oh-my-zsh
dest: ~/.oh-my-zsh
- git:
repo: https://github.com/zsh-users/zsh-autosuggestions.git
dest: ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions
- git:
repo: https://github.com/zsh-users/zsh-syntax-highlighting.git
dest: ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting
- git:
repo: https://github.com/tmux-plugins/tpm
dest: ~/.tmux/plugins/tpm
depth: 1
- name: Install TPM plugins
shell: ~/.tmux/plugins/tpm/bin/install_plugins
- name: spacemacs
git:
repo: https://github.com/syl20bnr/spacemacs
dest: ~/.emacs.d
version: origin/develop
update: no
- name: im-config
command: im-config -n fcitx
- name: wa
get_url:
url: https://gist.githubusercontent.com/k2nr/3e664396ce0c8781cd0885ccb0700efa/raw/0c1cca792bf067976a04f7847917bdeb08e5f446/wa
dest: ~/bin/wa
mode: 0755
- name: disalbe gnome-keyring
command: (cat /etc/xdg/autostart/gnome-keyring-ssh.desktop; echo Hidden=true) > ~/.config/autostart/gnome-keyring-ssh.desktop
- command: gsettings set org.gnome.desktop.input-sources xkb-options "['caps:ctrl_modifier']"
- command: gsettings set org.gnome.desktop.input-sources sources "[('fcitx', 'mozc-jp'), ('xkb', 'us')]"
- command: gsettings set org.gnome.desktop.wm.preferences audible-bell false
- command: gsettings set org.gnome.desktop.interface gtk-key-theme Emacs
- command: gsettings set org.gnome.shell.extensions.dash-to-dock dock-fixed false
- command: gsettings set org.gnome.shell.extensions.dash-to-dock autohide true
- command: gsettings set org.gnome.shell enabled-extensions "['gnome-shell-screenshot@ttll.de', 'sound-output-device-chooser@kgshank.net']"
- command: gsettings set org.gnome.settings-daemon.plugins.media-keys custom-keybindings "['/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom2/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom3/']"
- command: gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/ name google-chrome
- command: gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/ command "wmctrl -xa google-chrome"
- command: gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/ binding '<Primary><Shift>braceright'
- command: gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1/ name gnome-terminal
- command: gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1/ command "wmctrl -xa gnome-terminal"
- command: gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1/ binding '<Primary><Shift>i'
- command: gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom2/ name slack
- command: gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom2/ command "wmctrl -xa slack"
- command: gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom2/ binding '<Primary><Shift>s'
- command: gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom3/ name emacs
- command: gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom3/ command "wmctrl -xa emacs"
- command: gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom3/ binding '<Primary><Shift>e'
@skate056

This comment has been minimized.

Copy link

skate056 commented Nov 6, 2019

Very useful. Thanks for sharing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.