Skip to content

Commit 9f9d612

Browse files
authored
Merge pull request #8 from daveyb/release/1.0
Release/1.0
2 parents f17a430 + 74b7519 commit 9f9d612

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+713
-103
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.retry
2+
*.swp

README.md

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,27 @@
11
# daveyb's Ansible Playbook
22

3-
This is my personal (and always a WIP) Ansible playbook for setting up and enforcing a consistent config on my computers.
3+
This is my personal (and always a WIP, beware the monsters) Ansible playbook for setting up and enforcing a consistent config on my computers.
44

55
Out-of-the-box, the plays will run on `localhost`, but it can be configured to run on remote *nix machines as well.
66

77
It's designed to init new dotfiles as needed, so be aware that it may clobber existing dotfiles you already have.
88

9-
##Usage
10-
###Prerequisites
11-
1. Python 2.7+ and `pip`
9+
## Usage
10+
11+
### Prerequisites
12+
1. Python 3.5+ and `pip3` (sudo easy_install pip)
1213
2. A user account that's a member of the sudoers group `adduser <user> sudo`
13-
3. Ansible `sudo pip install ansible`
14+
3. Ansible `sudo pip3 install ansible`
1415
4. An internet connection
1516

16-
###Clone
17-
`git clone https://github.com/daveyb/ansible.git /usr/local/src/ansible && cd /usr/local/src/ansible`
17+
### Clone
18+
`git clone https://github.com/daveyb/ansible.git ~/ansible && cd ~/ansible`
1819

19-
###Run all plays
20-
`ansible-playbook -i hosts main.yml --ask-sudo-pass`
20+
### Run all plays
21+
`ansible-playbook -i hosts main.yml --ask-become-pass`
2122

22-
###Run a specific play based on tag (optional)
23-
`ansible-playbook -i hosts main.yml --ask-sudo-pass --tags=zsh`
23+
### Run a specific play based on tag (optional)
24+
`ansible-playbook -i hosts main.yml --ask-become-pass -t zsh`
2425

26+
### Configure GitHub user/email via parameters
27+
`ansible-playbok -i hosts main.yml --ask-become-pass -t git -e"user=MeMeMeMe" -e"email=me@me.com"`

ansible.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[defaults]
2+
inventory = ./hosts

bootstrap.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
- hosts: all
3+
tasks:
4+
- debug:
5+
msg: vars
6+
- name: Group all hosts by os
7+
group_by: key={{ ansible_os_family }}
8+
tags:
9+
- always
10+
11+
- name: Bootstrap
12+
hosts: all
13+
roles:
14+
- bootstrap
15+
tags:
16+
- bootstrap
17+
18+
- name: Install and configure git
19+
hosts: all
20+
roles:
21+
- git
22+
tags:
23+
- git

group_vars/Darwin.yml

Whitespace-only changes.

group_vars/Debian.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
apt_nonfree_source: 'deb http://httpredir.debian.org/debian/ {{ ansible_distribution_release }} main contrib non-free'
3+
4+
colorize_repo: "https://github.com/daveyb/solarized-mate-terminal.git"
5+
colorize_script: solarized-mate.sh
6+
7+
docker_source: "deb https://apt.dockerproject.org/repo/ debian-{{ ansible_distribution_release }} main"
8+
docker_gpg_source: "https://apt.dockerproject.org/gpg"
9+
docker_gpg_key_id: 58118E89F3A912897C070ADBF76221572C52609D

group_vars/all.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ user:
44
email:
55
working_dir: /tmp
66

7-
# debian
8-
apt_nonfree_source: 'deb http://httpredir.debian.org/debian/ jessie main contrib non-free'
9-
107
# git
118
github_user:
129

main.yml

Lines changed: 46 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,86 @@
11
---
2+
- hosts: all
3+
tasks:
4+
- debug:
5+
msg: vars
6+
- name: Group all hosts by os
7+
group_by: key={{ ansible_os_family }}
8+
tags:
9+
- always
10+
211
- name: Bootstrap
312
hosts: all
413
roles:
514
- bootstrap
615
tags:
716
- bootstrap
8-
become: true
917

1018
- name: Install and configure git
1119
hosts: all
1220
roles:
1321
- git
1422
tags:
1523
- git
16-
become: true
1724

25+
- name: Install fonts
26+
hosts: all
27+
roles:
28+
- fonts
29+
tags:
30+
- fonts
31+
1832
- name: Configure shell
1933
hosts: all
2034
roles:
2135
- zsh
2236
tags:
2337
- shell
2438

39+
- name: Configure terminal
40+
hosts: all
41+
roles:
42+
- term
43+
tags:
44+
- term
45+
2546
- name: Install and configure vim
2647
hosts: all
2748
roles:
2849
- vim
2950
tags:
3051
- vim
3152

32-
- name: Install dropbox
53+
- name: Install chrome
54+
hosts: all
55+
roles:
56+
- chrome
57+
tags:
58+
- chrome
59+
60+
- name: Install docker
61+
hosts: all
62+
roles:
63+
- docker
64+
tags:
65+
- docker
66+
67+
- name: Install misc packages
3368
hosts: all
3469
roles:
35-
- dropbox
70+
- misc
3671
tags:
37-
- dropbox
38-
become: true
72+
- misc
3973

40-
- name: Install and configure oh-my-zsh
74+
- name: AWS stuff
4175
hosts: all
4276
roles:
43-
- zsh
77+
- aws
4478
tags:
45-
- zsh
79+
- aws
4680

47-
- name: Install slack
81+
- name: Python stuff
4882
hosts: all
4983
roles:
50-
- slack
84+
- python
5185
tags:
52-
- slack
86+
- python

roles/appearance/tasks/darwin.yml

Whitespace-only changes.

roles/appearance/tasks/linux.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
- name: Install GNOME Tweak
3+
package:
4+
name: gnome-tweak-tool
5+
state: latest
6+
7+
- name: Install gtk2-engines-pixbuf
8+
package:
9+
name: gtk2-engines-pixbuf
10+
state: latest
11+
12+
- name: Install gtk2-engines-murrine
13+
package:
14+
name: gtk2-engines-murrine
15+
state: latest

roles/appearance/tasks/main.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
- include_tasks: linux.yml
3+
when: ansible_system == "Linux"
4+
5+
- include_tasks: darwin.yml
6+
when: ansible_system == "Darwin"

roles/audio/defaults/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
vocal_podcatcher_repo: "ppa:nathandyer/vocal-stable"

roles/audio/tasks/main.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
#- block:
3+
# - name: Enable vocal repo
4+
# lineinfile:
5+
# dest: /etc/apt/sources.list
6+
# line: "{{ vocal_podcatcher_repo }}"
7+
#
8+
# - name: apt-get update
9+
# apt:
10+
# update_cache: yes
11+
12+
# - name: install podcatcher
13+
# apt:
14+
# update_cache: yes
15+
# become: true

roles/aws/defaults/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
aws_cli_container: mesosphere/aws-cli

roles/aws/tasks/main.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
- name: Add alias to aws-cli docker container
3+
lineinfile:
4+
dest: "~/.zshrc"
5+
line: |
6+
alias aws='docker run --rm -t $(tty &>/dev/null && echo "-i") -e "AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}" -e "AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}" -e "AWS_DEFAULT_REGION=${AWS_DEFAULT_REGION}" -v "$(pwd):/project" {{ aws_cli_container }}'
7+
8+
- name: reload zshrc
9+
shell: "source ~/.zshrc"
10+
args:
11+
executable: /usr/bin/zsh
12+
when: ansible_system == "Linux"
13+
14+
- name: reload zshrc
15+
shell: "source ~/.zshrc"
16+
args:
17+
executable: /bin/zsh
18+
when: ansible_system == "Darwin"

roles/bootstrap/tasks/darwin.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
- name: touch installondemand file
2+
file:
3+
state: touch
4+
path: /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
5+
6+
- name: Install Xcode Command Line Tools
7+
shell: |
8+
PROD=$(softwareupdate -l | grep "\*.*Command Line" | head -n 1 | awk -F"*" '{print $2}' | sed -e 's/^ *//' | tr -d '\n')
9+
softwareupdate -i "$PROD"
10+
11+
- name: remove installondemand file
12+
file:
13+
state: absent
14+
path: /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
15+
16+
- name: alias xcrun git to git in profile
17+
copy:
18+
dest: "/Users/{{ ansible_user_id }}/.profile"
19+
content: aliast git='xcrun git'
20+
21+
- name: ensure homebrew dir exists
22+
file:
23+
path: /usr/local/homebrew
24+
state: directory
25+
mode: 0755
26+
owner: "{{ ansible_user_id }}"
27+
group: "{{ ansible_user_gid }}"
28+
become: yes
29+
30+
- name: install homebrew
31+
shell: cd /usr/local/src && curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C /usr/local/homebrew
32+
33+
- name: add homebrew binaries to path
34+
copy:
35+
dest: "/Users/{{ ansible_user_id }}/.profile"
36+
content: PATH=$PATH:/usr/local/homebrew/bin
37+
38+
- name: update homebrew
39+
homebrew:
40+
update_homebrew: yes
41+
upgrade_all: yes
42+
43+
- name: enable homebrew cask
44+
shell: brew tap caskroom/cask
45+
46+
- name: install jq
47+
homebrew:
48+
name: jq
49+
state: latest
Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
---
2-
- name: apt-get update
3-
apt:
4-
update_cache: yes
2+
- include_role:
3+
name: packages
4+
vars:
5+
update_cache: true
56

67
- name: Install xclip
78
package:
@@ -13,4 +14,7 @@
1314
name: curl
1415
state: latest
1516

16-
17+
- name: Install jq
18+
package:
19+
name: jq
20+
state: latest

roles/bootstrap/tasks/main.yml

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,25 @@
1-
---
2-
- include: debian.yml
3-
when: ansible_os_family == "Debian"
1+
# Utility role for bootstrapping future roles
2+
# Linux runs as root
3+
---
4+
- name: ensure src dir exists
5+
file:
6+
path: /usr/local/src
7+
state: directory
8+
mode: 0755
9+
owner: "{{ ansible_user_id }}"
10+
group: "{{ ansible_user_gid }}"
11+
become: yes
412

5-
- include: darwin.yml
6-
when: ansible_os_family == "Darwin"
13+
- name: ensure shell profile exists
14+
file:
15+
path: "/Users/{{ ansible_user_id }}/.profile"
16+
state: touch
17+
mode: 0755
18+
owner: "{{ ansible_user_id }}"
19+
group: "{{ ansible_user_gid }}"
20+
21+
- include_tasks: linux.yml
22+
when: ansible_system == "Linux"
23+
24+
- include_tasks: darwin.yml
25+
when: ansible_system == "Darwin"

roles/chrome/tasks/linux.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
- name: install chrome
3+
package:
4+
name: chromium
5+
state: latest
6+
become: true

roles/chrome/tasks/main.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
- include_tasks: linux.yml
3+
when: ansible_system == "Linux"

roles/docker/tasks/darwin.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
- name: install docker
3+
shell: brew cask install docker

0 commit comments

Comments
 (0)