-
Notifications
You must be signed in to change notification settings - Fork 24
/
admin.yml
200 lines (165 loc) · 6.75 KB
/
admin.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
---
# playbook for setting up the admin account with stuff I like to work with
# pass in a specific host of group of hosts when calling this playbook. This keeps
# the playbook non-destructive except for explicitly defined hosts.
- hosts: '{{ target }}'
user: '{{ admin_user }}'
vars:
homebrew_apps:
- git
- node
cask_apps:
- docker
- github
- google-chrome
- kaleidoscope
- qlcolorcode
- qlimagesize
- qlmarkdown
- qlstephen
- quicklook-json
- slack
- visual-studio-code
username: '{{ ansible_user_id }}'
dock_apps:
- /Applications/Slack.app
- /Applications/Google Chrome.app
- /Applications/Kaleidoscope.app
- /Applications/Visual Studio Code.app
- /Applications/Utilities/Terminal.app
dock_others:
- {path: "/tmp", type: directory, arrange: 2}
dock_expose_group_by_app: yes
dock_dim_hidden: yes
node_global_packages:
- browser-sync
- npm
roles:
- global-prefs
- { role: finder, tags: finder, when: user_lib is defined and user_lib_prefs is defined }
- { role: dock, tags: dock, when: user_lib is defined and user_lib_prefs is defined }
- { role: safari, tags: safari, when: user_lib is defined and user_lib_prefs is defined }
- { role: terminal, tags: [terminal], become: no }
- { role: homebrew, apps: "{{ homebrew_apps }}", become: no }
- { role: homebrew_cask, apps: "{{ cask_apps }}", become: no }
- { role: node.js }
# - { role: vagrant, vagrant_user: "{{ username }}", tags: [vagrant] }
- { role: vscode }
pre_tasks:
- set_fact: user_home=/Users/{{ ansible_user_id }}
tags: always
- set_fact: user_lib={{ user_home }}/Library
tags: always
- set_fact: user_lib_prefs={{ user_lib }}/Preferences
tags: always
- name: Stay awake for 20 minutes
shell: caffeinate -t 900 &
- command: scutil --get ComputerName
register: computer_name
- name: Set name of HD to ComputerName + HD/SSD
shell:
diskutil rename / '{{ computer_name.stdout }} SSD'
- name: Make sure User icons directory exists
file: path='/Library/User Pictures/Ansible/' state=directory mode=0755
become: yes
- name: Get available account pictures
shell: ls -1 files/admin_account_images/*.png
register: account_images
ignore_errors: yes
connection: local
- name: Default to an empty list if no images are found
# The `with_random_choice` command needs a list to pull from, it fails loudly if the list is empty
# Sending a list with one empty string allows us to use `account_images.stdout_lines[0]` as a boolean
set_fact:
account_images:
stdout_lines: ['']
when: account_images.stdout_lines | length == 0
- name: Send new account picture
copy:
src: '{{ item }}'
dest: '/Library/User Pictures/Ansible/{{ item | basename }}'
mode: 0644
when: account_images.stdout_lines[0]
with_random_choice: '{{ account_images.stdout_lines }}'
ignore_errors: yes
register: account_image
become: yes
- name: Clear existing user account picture
command: 'dscl . {{ item }}'
with_items:
- 'delete /Users/{{ admin_user }} jpegphoto'
- 'delete /Users/{{ admin_user }} Picture'
become: yes
- name: Update user account picture
command: 'dscl . create /Users/{{ admin_user }} Picture "/Library/User Pictures/Ansible/{{ account_image.results[0].item | basename }}"'
when: account_image.results[0].item is defined
become: yes
- name: set umask to 002 in .profile
lineinfile: 'dest=/Users/{{ ansible_user_id }}/.profile state=present regexp="^umask\s+\d+" insertafter=EOF line="umask 002" create=yes'
- name: Prepend /usr/local/bin to $PATH in .profile
lineinfile: 'dest=/Users/{{ ansible_user_id }}/.profile state=present regexp="^export\s+PATH=/usr/local/bin:\\$PATH" insertafter=EOF line="export PATH=/usr/local/bin:$PATH" create=yes'
- name: 'Finder: Very fast keyboard repeat'
shell: defaults write {{ user_lib_prefs }}/.GlobalPreferences KeyRepeat -int 1
- name: 'Finder: Initial KeyRepeat delay'
shell: defaults write {{ user_lib_prefs }}/.GlobalPreferences InitialKeyRepeat -int 25
- name: 'Finder: Show all files'
shell: defaults write {{ user_lib_prefs }}/com.apple.finder AppleShowAllFiles -bool true
- name: 'Disable Dashboard'
shell: defaults write com.apple.dashboard mcx-disabled -bool true
- name: 'Finder: Empty the Desktop folder'
shell: find {{ user_home }}/Desktop -mindepth 1 -delete
become: yes
- name: 'Dock: Enable App Exposé'
shell: defaults write {{ user_lib_prefs }}/com.apple.dock showAppExposeGestureEnabled -bool true
- name: 'Dock: Use translucent icons for hidden applications'
shell: defaults write {{ user_lib_prefs }}/com.apple.dock showhidden -bool true
- stat: path={{ user_home }}/Downloads
register: downloads
- name: Move existing Downloads folder out of the way
shell: mv {{ user_home }}/Downloads {{ user_home }}/Old_Downloads
become: yes
when: not downloads.stat.islnk
- name: symlink /tmp to ~/Downloads
file:
src=/https/github.com/tmp
dest={{ user_home }}/Downloads
state=link
force=yes
- name: Remove old leftovers and junk
file:
path={{ item }}
state=absent
with_items:
- /Library/LaunchAgents/com.adobe.CS5ServiceManager.plist
- /Library/LaunchAgents/com.xrite.device.softwareupdate.plist
- /Library/LaunchDaemons/com.xrite.device.xrdd.plist
- /Library/LaunchAgents/com.wacom.wacomtablet.plist
- /Library/LaunchAgents/com.wacom.pentablet.plist
become: yes
- name: Repair permissions
file:
path={{ user_lib_prefs }}
owner={{ ansible_user_id }}
group=staff
recurse=yes
become: yes
# post_tasks:
# - name: Install virtualenvwrapper
# pip: name=virtualenvwrapper
# environment:
# PATH: /usr/local/bin:{{ ansible_env["PATH"] }}
# become: yes
# tags: pip
# - name: Copy terminal settings file
# copy: src=files/smoke.terminal dest=/tmp/smoke.terminal
# tags: terminal
# - name: Set terminal to Smoke theme
# command: open /tmp/smoke.terminal
# ignore_errors: yes
# tags: terminal
# - name: 'Terminal: Set startup window'
# shell: 'defaults write {{ user_lib_prefs }}/com.apple.Terminal "Startup Window Settings" -string smoke'
# tags: terminal
# - name: 'Terminal: Set default window'
# shell: 'defaults write {{ user_lib_prefs }}/com.apple.Terminal "Default Window Settings" -string smoke'
# tags: terminal