Skip to content

Commit 64f37f6

Browse files
bug/homebrew dir (#27)
* add privs, add gh cli * fix mac bugs, remove old software, add wsl defaults Co-authored-by: Dave <dave.benedic@insight.com>
1 parent 273563b commit 64f37f6

File tree

7 files changed

+48
-26
lines changed

7 files changed

+48
-26
lines changed

roles/bootstrap/tasks/darwin.yml

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,30 @@
3030
dest: "/Users/{{ ansible_user_id }}/.profile"
3131
content: alias git='xcrun git'
3232

33-
- name: ensure homebrew dir exists
34-
file:
35-
path: /usr/local/homebrew
36-
state: directory
37-
mode: 0755
38-
owner: "{{ ansible_user_id }}"
39-
group: "{{ ansible_user_gid }}"
40-
become: yes
33+
- name: curl homebrew
34+
block:
35+
- stat:
36+
path: /usr/local/homebrew
37+
register: homebrew
4138

42-
- name: install homebrew
43-
shell: cd /usr/local/src && curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C /usr/local/homebrew
39+
- shell: rm -rf /usr/local/homebrew
40+
when: homebrew.stat.exists
41+
become: yes
42+
43+
- name: ensure homebrew dir exists
44+
file:
45+
path: /usr/local/homebrew
46+
state: directory
47+
mode: 0755
48+
owner: "{{ ansible_user_id }}"
49+
group: "{{ ansible_user_gid }}"
50+
become: yes
51+
52+
- shell: cd /usr/local/src && curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C /usr/local/homebrew
4453

4554
- name: add homebrew binaries to path
4655
copy:
47-
dest: "/Users/{{ ansible_user }}/.profile"
56+
dest: "/Users/{{ ansible_user_id }}/.profile"
4857
content: PATH=$PATH:/usr/local/homebrew/bin
4958

5059
- name: update homebrew

roles/git/tasks/darwin.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
- name: install cli for github
33
homebrew:
4-
name: github/gh/gh
4+
name: gh
55
state: latest
66

77
# http://pre-commit.com

roles/git/tasks/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
- name: set fact for wsl environment
99
set_fact:
10-
wsl_environment: "{{ wsl_environment }}"
10+
wsl_environment: "{{ wsl_environment | default('false') }}"
1111

1212
- name: template gitconfig
1313
template:

roles/misc/tasks/darwin.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,11 @@
44
name: the_silver_searcher
55
state: latest
66

7-
- name: install royal-tsx
8-
shell: brew cask install royal-tsx
9-
10-
- name: install slack
11-
shell: brew cask install slack
12-
ignore_errors: yes # preinstalled version causing error
13-
147
- name: install fswatch
158
homebrew:
169
name: fswatch
1710
state: latest
1811

19-
- name: install vagrant
20-
shell: brew cask install vagrant
21-
2212
- name: autohide OSX dock
2313
shell: defaults write com.apple.dock autohide true
2414
notify: restart dock
@@ -51,3 +41,13 @@
5141
homebrew:
5242
name: direnv
5343
state: latest
44+
45+
- name: check if privileges cli app is installed (corporate nanny)
46+
command: /Applications/Privileges.app/Contents/Resources/PrivilegesCLI --help
47+
register: privs_install_check
48+
49+
- name: add privileges app alias
50+
lineinfile:
51+
dest: "~/.zshrc"
52+
line : alias privs=/Applications/Privileges.app/Contents/Resources/PrivilegesCLI
53+
when: privs_install_check.rc == 1

roles/python/tasks/darwin.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66

77
- name: shim pyenv into ~/.profile
88
lineinfile:
9-
path: "/Users/{{ ansible_user }}/.profile"
9+
path: "/Users/{{ ansible_user_id }}/.profile"
1010
line: "export PATH=${PATH}:$(pyenv root)/shims"
1111
regexp: "^export PATH=${PATH}"
1212

1313
- name: Add pyenv to .profile
1414
lineinfile:
15-
dest: "/Users/{{ ansible_user }}/.profile"
15+
dest: "/Users/{{ ansible_user_id }}/.profile"
1616
line: 'eval "$(pyenv init -)"'
1717

1818
# NOTE: CFLAGS="-I$(xcrun --show-sdk-path)/usr/include" pyenv install 3.7.3

roles/vim/tasks/main.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
- name: set fact for wsl environment
3131
set_fact:
32-
wsl_environment: "{{ wsl_environment }}"
32+
wsl_environment: "{{ wsl_environment | default('false') }}"
3333

3434
- name: template vimrc
3535
template:
@@ -41,26 +41,31 @@
4141
git:
4242
repo: 'https://github.com/scrooloose/nerdtree.git'
4343
dest: ~/.vim/bundle/nerdtree
44+
force: yes
4445

4546
- name: clone vim-sensible to ~/.vim/bundle/
4647
git:
4748
repo: 'https://github.com/tpope/vim-sensible.git'
4849
dest: ~/.vim/bundle/vim-sensible
50+
force: yes
4951

5052
- name: clone vim-airline to ~/.vim/bundle/
5153
git:
5254
repo: https://github.com/vim-airline/vim-airline
5355
dest: ~/.vim/bundle/vim-airline
56+
force: yes
5457

5558
- name: clone vim-mustache-handlebars to ~/.vim/bundle
5659
git:
5760
repo: https://github.com/mustache/vim-mustache-handlebars.git
5861
dest: ~/.vim/bundle/vim-mustache-handlebars
62+
force: yes
5963

6064
- name: clone vim-easy-align to ~/.vim/bundle/
6165
git:
6266
repo: https://github.com/junegunn/vim-easy-align
6367
dest: ~/.vim/bundle/vim-easy-align
68+
force: yes
6469

6570
- name: clone vim-ShowTrailingWhitespace to ~/.vim/bundle/
6671
git:

roles/zsh/tasks/darwin.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,11 @@
88
homebrew:
99
name: direnv
1010
state: latest
11+
12+
- name: ensure ~/.bash_profile exists
13+
file:
14+
path: "/Users/{{ ansible_user_id }}/.bash_profile"
15+
state: touch
16+
mode: 0755
17+
owner: "{{ ansible_user_id }}"
18+
group: "{{ ansible_user_gid }}"

0 commit comments

Comments
 (0)