[meta] irregular-apocalypse
diff --git a/.ssh/config b/.ssh/config
index 3b21349a..9e51d023 100644
--- a/.ssh/config
+++ b/.ssh/config
@@ -19,3 +19,6 @@ Host kejadlen.console.xen.prgmr.com
Host 127.0.0.1
StrictHostKeyChecking no
+
+Host irregular-apocalypse
+ HostName 35.197.9.101
diff --git a/Brewfile b/Brewfile
index 6f155226..a5a8dcaf 100644
--- a/Brewfile
+++ b/Brewfile
@@ -13,6 +13,8 @@ brew 'fzf'
brew 'git'
brew 'macvim', args: ['with-override-system-vim']
brew 'mas'
+brew 'pip'
+brew 'python'
brew 'reattach-to-user-namespace'
brew 'ripgrep'
brew 'ruby-install'
diff --git a/ansible/ansible.cfg b/ansible/ansible.cfg
index 5afd57f5..a96c5f7c 100644
--- a/ansible/ansible.cfg
+++ b/ansible/ansible.cfg
@@ -2,6 +2,7 @@
inventory = hosts.private
retry_files_enabled = False
pipelining = True
+host_key_checking = False
[ssh_connection]
ssh_args = -o ForwardAgent=yes
diff --git a/ansible/irregular-apocalypse.yml b/ansible/irregular-apocalypse.yml
new file mode 100644
index 00000000..0b7e3fcc
--- /dev/null
+++ b/ansible/irregular-apocalypse.yml
@@ -0,0 +1,48 @@
+---
+- hosts: all
+ pre_tasks:
+ - name: update dotfiles repo
+ git:
+ repo: https://github.com/kejadlen/dotfiles.git
+ dest: ~/.dotfiles
+ ignore_errors: yes
+
+- hosts: all
+ tasks:
+ - name: install dependencies
+ apt:
+ name: "{{ item }}"
+ update_cache: yes
+ with_items:
+ - make
+ - python-pip
+ - zsh
+ become: yes
+
+- hosts: all
+ roles:
+ - dotfiles
+ - zsh
+
+- hosts: all
+ tasks:
+ - stat: path=/usr/bin/local/chruby-exec
+ register: chruby
+ - import_tasks: irregular-apocalypse/chruby.yml
+ vars:
+ version: 0.3.9
+ when: chruby.stat.exists == False
+
+- hosts: all
+ tasks:
+ - stat: path=/usr/bin/local/ruby-install
+ register: ruby_install
+ - import_tasks: irregular-apocalypse/ruby-install.yml
+ vars:
+ version: 0.6.1
+ when: ruby_install.stat.exists == True
+
+- hosts: all
+ tasks:
+ - name: install Ruby
+ command: ruby-install ruby
diff --git a/ansible/irregular-apocalypse/chruby.yml b/ansible/irregular-apocalypse/chruby.yml
new file mode 100644
index 00000000..33715730
--- /dev/null
+++ b/ansible/irregular-apocalypse/chruby.yml
@@ -0,0 +1,21 @@
+- name: create ~/src
+ file:
+ path: ~/src
+ state: directory
+
+- name: download chruby
+ get_url:
+ url: https://github.com/postmodern/chruby/archive/v{{ version }}.tar.gz
+ dest: ~/src/chruby-{{ version }}.tar.gz
+
+- name: extract chruby
+ unarchive:
+ src: ~/src/chruby-{{ version }}.tar.gz
+ dest: ~/src
+ remote_src: yes
+
+- name: install chruby
+ command: make install
+ args:
+ chdir: "{{ ansible_env.HOME }}/src/chruby-{{ version }}"
+ become: yes
diff --git a/ansible/irregular-apocalypse/ruby-install.yml b/ansible/irregular-apocalypse/ruby-install.yml
new file mode 100644
index 00000000..c0650d14
--- /dev/null
+++ b/ansible/irregular-apocalypse/ruby-install.yml
@@ -0,0 +1,16 @@
+- name: download ruby-install
+ get_url:
+ url: https://github.com/postmodern/ruby-install/archive/v{{ version }}.tar.gz
+ dest: ~/src/ruby-install-{{ version }}.tar.gz
+
+- name: extract ruby-install
+ unarchive:
+ src: ~/src/ruby-install-{{ version }}.tar.gz
+ dest: ~/src
+ remote_src: yes
+
+- name: install ruby-install
+ command: make install
+ args:
+ chdir: "{{ ansible_env.HOME }}/src/ruby-install-{{ version }}"
+ become: yes
diff --git a/ansible/roles/dotfiles/tasks/main.yml b/ansible/roles/dotfiles/tasks/main.yml
index 1d019402..bbc0fdd7 100644
--- a/ansible/roles/dotfiles/tasks/main.yml
+++ b/ansible/roles/dotfiles/tasks/main.yml
@@ -16,7 +16,7 @@
with_dict: "{{ private_symlinks }}"
- name: symlink SSH configs
- file: src={{ item }} dest=~/.ssh/{{ item | basename }} state=link
+ file: src=~/.dotfiles/.ssh/{{ item | basename }} dest=~/.ssh/{{ item | basename }} state=link
with_fileglob: ~/.dotfiles/.ssh/*
- name: symlink ~bin
diff --git a/ansible/roles/powerline/tasks/main.yml b/ansible/roles/powerline/tasks/main.yml
index cbca3f35..43e6d4cd 100644
--- a/ansible/roles/powerline/tasks/main.yml
+++ b/ansible/roles/powerline/tasks/main.yml
@@ -1,16 +1,14 @@
-- name: install Python
- homebrew: name=python state=present
-
- name: check if Powerline is already installed
- shell: /usr/local/bin/pip list | grep Powerline
+ shell: pip list | grep Powerline
ignore_errors: true
register: powerline_installed
+
- name: install Powerline
command: >
- /usr/local/bin/pip
+ pip
install
--user
- --editable={{ ansible_env.HOME }}/.dotfiles/src/powerline
+ --editable=~/.dotfiles/src/powerline
when: powerline_installed.failed
- name: symlink Powerline configs
diff --git a/ansible/roles/zsh/tasks/main.yml b/ansible/roles/zsh/tasks/main.yml
index b2cf096c..24042618 100644
--- a/ansible/roles/zsh/tasks/main.yml
+++ b/ansible/roles/zsh/tasks/main.yml
@@ -1,6 +1,3 @@
-- name: install ZSH
- homebrew: name=zsh state=present
-
- name: symlink ~/.zprezto
file:
src: "{{ ansible_env.HOME }}/.dotfiles/src/prezto"
@@ -18,10 +15,14 @@
state: link
with_items: "{{ prezto_runcoms.stdout_lines }}"
-- name: add /usr/local/bin/zsh to /etc/shells
- lineinfile: dest=/etc/shells line=/usr/local/bin/zsh state=present
+- name: find where zsh is
+ command: which zsh
+ register: which_zsh
+
+- name: add zsh to /etc/shells
+ lineinfile: dest=/etc/shells line={{ which_zsh.stdout | trim }} state=present
become: yes
- name: set the default user shell to zsh
- user: name={{ ansible_env.USER }} shell=/usr/local/bin/zsh
+ user: name={{ ansible_env.USER }} shell={{ which_zsh.stdout | trim }}
become: yes