Skip to content

Commit

Permalink
Separate local, remote, and vagrant environments
Browse files Browse the repository at this point in the history
...into different playbooks and scripts.

dot - sets up local environment
dot-remote - sets up remote environments
vdot - sets up vagrant test environment
  • Loading branch information
sloria committed Aug 17, 2014
1 parent c986254 commit 7906136
Show file tree
Hide file tree
Showing 11 changed files with 75 additions and 39 deletions.
38 changes: 35 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ $ git clone https://github.com/asmacdo/dotfiles.git ~/dotfiles
$ cd ~/dotfiles
```


Copy local variables file.

```bash
Expand Down Expand Up @@ -64,6 +65,15 @@ $ cd ~/dotfiles
$ git pull
```

commands
--------

There are three main commands in the `bin` directory for setting up and updating development environments:

- `dot`: sets up local environment.
- `dot-remote`: sets up remote environments.
- `vdot`: sets up vagrant environments.

special files
-------------

Expand All @@ -75,6 +85,28 @@ All configuration is done in `~/dotfiles`. Each role may contain (in addition to
notes
-----

**zsh on Mac OSX**

In order for zsh to work on OSX, you may need to add `/usr/local/bin/zsh` to your `/etc/shells`


`/etc/shells` should look something like this:

```
# List of acceptable shells for chpass(1).
# Ftpd will not allow users to connect who are not using
# one of these shells.
/bin/bash
/bin/csh
/bin/ksh
/bin/sh
/bin/tcsh
/bin/zsh
# Add this
/usr/local/bin/zsh
```

**fonts**

To install fonts on OSX, simply drag the `.ttf` files in `misc/fonts` directory onto the Font Book application.
Expand Down Expand Up @@ -112,14 +144,14 @@ Update the following variables in `group_vars/remote`:
- `git_email` : Your git email.


Then run the `dot` command.
Then run the `dot-remote` command.

```bash
$ ./bin/dot
$ ./bin/dot-remote
```

todo
----

- Full Debian and Red Hat support
- Support for getting a minimal environment on remote servers
- Add more options to `dot` script, e.g. for skipping tasks
3 changes: 2 additions & 1 deletion bin/dot
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
ansible-playbook -i ~/dotfiles/hosts ~/dotfiles/dot.yml --ask-sudo-pass
echo "Setting up local dev enviroment"
ansible-playbook -i ~/dotfiles/hosts ~/dotfiles/local_env.yml
2 changes: 2 additions & 0 deletions bin/dot-remote
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
echo "Setting up remote development enviroments"
ansible-playbook -i ~/dotfiles/hosts ~/dotfiles/remote_env.yml
3 changes: 2 additions & 1 deletion bin/vdot
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
ansible-playbook dot.yml -i vagranthosts -u vagrant --ask-sudo-pass --private-key=~/.vagrant.d/insecure_private_key -l remote -U vagrant
echo "Setting up vagrant test enviroment"
ansible-playbook remote_env.yml -i vagranthosts -u vagrant --ask-sudo-pass --private-key=~/.vagrant.d/insecure_private_key -l remote -U vagrant
7 changes: 7 additions & 0 deletions group_vars/vagrant
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# vi: set ft=yaml :

dotfiles_user_home: /home/vagrant
dotfiles_home: "{{dotfiles_user_home}}/dotfiles"

git_user: vagrant
git_email: [email protected]
1 change: 0 additions & 1 deletion hosts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ localhost
ansible_connection=local

[remote]

19 changes: 19 additions & 0 deletions local_env.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
- name: Collecting Facts
hosts: local
gather_facts: yes

- name: Set up local development environment
hosts: local
roles:
- git
- package_manager
- zsh
- vim
- python
- hub
- autojump
- autoenv
- ag
- tmux
- {role: osx, when: ansible_os_family == "Darwin"}

18 changes: 2 additions & 16 deletions dot.yml → remote_env.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,8 @@

- name: Collecting Facts
hosts: all
hosts: remote
gather_facts: yes

- name: Set up local development environment
hosts: local
roles:
- git
- package_manager
- zsh
- vim
- python
- hub
- autojump
- autoenv
- ag
- tmux
- {role: osx, when: ansible_os_family == "Darwin"}

- name: Set up remote dev environments (clone)
hosts: remote
tasks:
Expand Down
3 changes: 3 additions & 0 deletions roles/vim/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@ vim_install_plugins: no

# Only used on OSX machines. Ignored on other platforms
vim_install_macvim: yes

# Only install a minimal subset of the full vimrc (e.g. for remote servers)
vim_minimal: no
11 changes: 0 additions & 11 deletions roles/zsh/tasks/osx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,5 @@
- name: Make sure zsh is installed
homebrew: name=zsh state=latest

# http://zanshin.net/2013/09/03/how-to-use-homebrew-zsh-instead-of-max-os-x-default/
- name: Add zsh to /etc/shells
lineinfile:
line: /usr/local/bin/zsh
dest: /etc/shells
state: present
register: zsh_shells
sudo: yes

- name: Change default shell to zsh
command: chsh -s /usr/local/bin/zsh
# Only run this if above task was changed
when: zsh_shells.changed
9 changes: 3 additions & 6 deletions vagranthosts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
# Test ubuntu and fedora boxes
[remote]
[vagrant]
192.168.111.227

[remote:vars]
dotfiles_user_home=/home/vagrant
dotfiles_home="{{dotfiles_user_home}}/dotfiles"
git_user=vagrant
[email protected]
[remote:children]
vagrant

0 comments on commit 7906136

Please sign in to comment.