-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdev-vm.yaml
704 lines (626 loc) · 23.7 KB
/
dev-vm.yaml
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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
---
- hosts: localhost
connection: local
become: no
vars:
apt_package_list:
- wget
- curl
- gzip
- pbzip2
- parallel
- unzip
- vim
- git
- zip
- sudo
- webp
homebrew_package_list:
- awscli
- bash-completion
- direnv
- dos2unix
- fd
- gnu-tar
- go
- gpg
- imagemagick
- kubectl
- mas
- node
- obsidian
- parallel
- pinentry-mac
- pyenv
- thefuck
- tmux
- webp
- wget
- watch
- webp
homebrew_cask_package_list:
# Interpreters:
# Not using - java
# Not using - maven
# Plain text editors:
# Not using - sublime-text
# Not using - atom
# Browsers:
# Already part of base image
# - google-chrome
- homebrew/cask-versions/firefox-developer-edition
- tor-browser
# IDE:
- visual-studio-code
# General Dev tools:
- iterm2
# Already part of base image
# - slack
- meld
- docker
# Virtualization and remote access:
#- vagrant # maybe don't need vagrant anymore, doing more docker
#- virtualbox VirtualBox is tricky on recent OSX
# Every now and then, have to edit an image
#- gimp # gimp is pretty tricky.
- krita
- inkscape
# Misc:
- evernote
- vlc
# Some people still use Skype
#- skype # removing skype, homebrew install seems flaky.
# App store apps
apple_appstore_package_list:
- "1295203466" # Microsoft Remote Desktop
homebrew_cask_antivirus: avast-security
homebrew_cask_password_vault: 1password
personal_bin: "{{ansible_env.HOME}}/bin"
get_fonts: true
docker: true
ruby: true
google_cloud: true
projects_dir: "{{ansible_env.HOME}}/Projects"
projects_dir_personal: "{{projects_dir}}/Personal"
projects_dir_work: "{{projects_dir}}/Work"
shell: bash
tasks:
- name: Install atom apt repo
become: yes
apt_repository:
repo: ppa:webupd8team/atom
when:
- ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu'
- editor == 'atom'
- name: Remove old Docker.io (if installed)
become: yes
apt: pkg=docker.io state=absent
when: ansible_distribution_version == '14.04' and docker
- name: Install docker apt repo key
become: yes
apt_key: keyserver=hkp://p80.pool.sks-keyservers.net:80 id=58118E89F3A912897C070ADBF76221572C52609D
when: ansible_distribution_version == '14.04' and docker
- name: Install docker apt repo
become: yes
apt_repository: repo='deb https://apt.dockerproject.org/repo ubuntu-trusty main' update_cache=yes
when: ansible_distribution_version == '14.04' and docker
- name: Install docker.io for Ubuntu 15+ vms
become: yes
apt: pkg=docker.io state=latest
when: ansible_distribution_version >= '15.04' and docker
- name: Install docker-engine for Ubuntu 14 vms
become: yes
apt: pkg=docker-engine state=latest
when: ansible_distribution_version == '14.04' and docker
- name: Install apt packages
become: yes
apt: pkg={{ apt_package_list }} state=present
when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu'
- name: Install apt additional packages, if any
apt: pkg={{ item }} state=present
with_items: "{{additional_apt_packages}}"
when:
- ansible_distribution_version == '14.04'
- additional_apt_packages is defined
- name: Install atom via apt
become: yes
apt: pkg=atom state=present
when:
- ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu'
- editor == 'atom'
- name: Install Visual Studio Code
become: yes
apt:
deb: https://go.microsoft.com/fwlink/?LinkID=760868
when:
- ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu'
- editor == 'visual-studio-code'
- name: Check if homebrew is installed
shell: brew list
register: homebrew_installed
when: ansible_distribution == "MacOSX"
- name: Ensure homebrew is installed
command: /usr/bin/ruby -e "curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install"
when:
- ansible_distribution == "MacOSX"
- homebrew_installed is changed
- homebrew_installed.rc != 0
- name: Brew doctor to check basics.
command: brew doctor
when:
- ansible_distribution == "MacOSX"
ignore_errors: yes
- name: Install homebrew packages
homebrew: name={{ homebrew_package_list }} state=present
when: ansible_distribution == "MacOSX"
- name: Install homebrew additional packages, if any
homebrew: name={{ additional_homebrew_packages }} state=present
when:
- ansible_distribution == "MacOSX"
- additional_homebrew_packages is defined
- name: Install homebrew cask packages
command: brew install --cask {{ item }}
loop: "{{ homebrew_cask_package_list }}"
when:
- ansible_distribution == "MacOSX"
- name: List homebrew casks installed
command: brew list --cask
register: homebrew_casks
when: ansible_distribution == "MacOSX"
- name: Install additional homebrew cask packages, if any
command: brew install {{ item }}
loop: "{{ additional_cask_packages }}"
when:
- ansible_distribution == "MacOSX"
- additional_cask_packages is defined
- name: Add antivirus as homebrew cask package
command: brew install {{ homebrew_cask_antivirus }}
when:
- ansible_distribution == "MacOSX"
- homebrew_cask_antivirus is defined
- homebrew_cask_antivirus|length > 0
# Check for password app (I usually download it manually beforehand)
- name: Look for password app
shell: ls /Applications/ | grep -i {{ homebrew_cask_password_vault }}
register: password_app_exists
when: ansible_distribution == "MacOSX"
ignore_errors: yes
- name: Add password vault as homebrew cask package
command: brew install {{ homebrew_cask_password_vault }}
when:
- ansible_distribution == "MacOSX"
- homebrew_cask_password_vault is defined
- homebrew_cask_password_vault|length > 0
- password_app_exists.changed and password_app_exists.rc != 0
- name: Sign in to Apple App Store apps
command: mas signin {{ apple_id }} {{ apple_id_password }}
register: mas_signin
when:
- ansible_distribution == "MacOSX"
- apple_id is defined
- apple_id|length > 0
- apple_id_password is defined
- apple_id_password|length > 0
- name: Sign in to Apple App Store apps (no password)
command: mas signin --dialog {{ apple_id }}
when:
- ansible_distribution == "MacOSX"
- apple_id is defined
- apple_id|length > 0
- mas_signin is not changed
- name: Install Apple App Store apps, if any
command: mas install {{ item }}
with_items: "{{apple_appstore_package_list}}"
when:
- ansible_distribution == "MacOSX"
- apple_appstore_package_list is defined
- apple_id is defined
- apple_id|length > 0
- name: Install homebrew docker
homebrew: name=docker state=present
when: ansible_distribution == "MacOSX" and docker
- name: Copy gitconfig file
become: yes
copy: src=files/gitconfig dest=/etc/gitconfig backup=yes
- name: Start Docker service
become: yes
service: name=docker state=started
when: ansible_distribution != "MacOSX" and docker
- name: Add local bin folder for helper scripts
file: path={{personal_bin}} state=directory
- name: Copy xgrep
copy: src={{ item }} dest={{ansible_env.HOME}}/bin/ mode=u=rwx
with_fileglob:
- files/*grep
- name: Copy gup
copy: src=files/gup dest={{ansible_env.HOME}}/bin/ mode=u=rwx
- name: ensure .bashrc exists
copy:
content: "# startup file for bash shell"
dest: "{{ansible_env.HOME}}/.bashrc"
force: no
mode: 0600
- name: ensure .bashrc is loaded by .bash_profile
copy:
content: |
# .bash_profile
if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi
dest: "{{ansible_env.HOME}}/.bash_profile"
force: no
mode: 0600
- name: Bash completion
lineinfile:
dest: "{{ansible_env.HOME}}/.bash_profile"
regexp: "^.*. /usr/local/etc/bash_completion"
line: "[ -f /usr/local/etc/bash_completion ] && . /usr/local/etc/bash_completion"
- name: Install latest bash shell
block:
- name: Install bash from homebrew
homebrew: name=bash state=present
- name: Add new bash to list of shells
become: yes
lineinfile:
path: /etc/shells
regexp: "^/usr/local/bin/bash"
line: /usr/local/bin/bash
- name: Use new bash as shell
command: chsh -s /usr/local/bin/bash
when:
- shell == "bash"
- ansible_distribution == "MacOSX"
- name: Install fish shell on MacOS
homebrew: name=fish state=present
when:
- shell == "fish"
- ansible_distribution == "MacOSX"
- name: Install fish shell on Linux
block:
- name: Install fish apt repo
become: yes
apt_repository:
repo: ppa:fish-shell/release-3
- name: Install from apt repo
become: yes
apt: pkg=fish state=present
when:
- shell == "fish"
- ansible_distribution == 'Ubuntu'
- name: ensure config.fish exists
block:
- name: Ensures fish config dir exists
file: path={{ansible_env.HOME}}/.config/fish state=directory
- name: copy the file
copy:
content: "# startup file for fish shell"
dest: "{{ansible_env.HOME}}/.config/fish/config.fish"
force: no
mode: 0600
when: shell == "fish"
- name: Add oh-my-fish
block:
- name: Get installer
get_url:
url: "https://get.oh-my.fish"
dest: "{{ansible_env.HOME}}/fish_install"
mode: u+x
- name: Run oh-my-fish installer
command: fish {{ansible_env.HOME}}/fish_install -y --noninteractive
when:
- shell == "fish"
- name: Check if file exists
stat:
path: "{{ansible_env.HOME}}/.oh-my-zsh"
register: oh_my_zsh
- name: Add oh-my-zsh
block:
- name: Get installer
get_url:
url: "https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh"
dest: "{{ansible_env.HOME}}/ohmyzsh_install"
mode: u+x
- name: Run oh-my-zsh installer
command: sh {{ansible_env.HOME}}/ohmyzsh_install -y --noninteractive
when:
- shell == "zsh"
- not oh_my_zsh.stat.exists
- name: Make sure ~/bin is in PATH
lineinfile: dest={{ansible_env.HOME}}/.bashrc regexp="^export PATH=.*{{personal_bin}}" line='export PATH={{personal_bin}}:$PATH'
when: shell == "bash"
- name: Make sure ~/bin is in PATH
lineinfile: dest={{ansible_env.HOME}}/.config/fish/config.fish regexp="^set -x PATH .*{{personal_bin}}" line='set -x PATH {{personal_bin}} $PATH'
when: shell == "fish"
- name: Add good old JDK8, since some projects use it
block:
- name: Add tap for AdoptOpenJDK
command: brew tap adoptopenjdk/openjdk
- name: Install Java environment chooser
command: brew install jenv
- name: Install JDK8
command: brew install adoptopenjdk/openjdk/adoptopenjdk8
- name: Add jenv to path
lineinfile: dest={{ansible_env.HOME}}/.config/fish/config.fish regexp='^set -x PATH $HOME/.jenv/bin $PATH' line='set -x PATH $HOME/.jenv/bin $PATH'
when: shell == "fish"
- name: Load jenv on login
lineinfile: dest={{ansible_env.HOME}}/.config/fish/config.fish regexp='^status --is-interactive; and source (jenv init -|psub)' line='status --is-interactive; and source (jenv init -|psub)'
when: shell == "fish"
- name: Add JDK8 as possible environment
shell: export PATH=$PATH:{{ansible_env.HOME}}/.jenv/bin && eval "$(jenv init -)" && jenv add /usr/lib/jvm/java-8-openjdk-amd64
args:
executable: /bin/bash
- name: Set JAVA_HOME
lineinfile: dest={{ansible_env.HOME}}/.config/fish/config.fish regexp='^set -x JAVA_HOME /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home' line='set -x JAVA_HOME /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home'
when: shell == "fish"
when:
- ansible_distribution == "MacOSX"
- jdk8 is defined and jdk8
- name: Add good old JDK8, since some projects use it (linux)
block:
- name: Install Java environment chooser
command: git clone https://github.com/gcuisinier/jenv.git ~/.jenv
- name: Install JDK8
become: yes
apt:
pkg:
- openjdk-8-jdk
- openjdk-8-jre
- name: Add jenv to path
lineinfile: dest={{ansible_env.HOME}}/.config/fish/config.fish regexp='^set -x PATH $HOME/.jenv/bin $PATH' line='set -x PATH $HOME/.jenv/bin $PATH'
when: shell == "fish"
- name: Load jenv on login
lineinfile: dest={{ansible_env.HOME}}/.config/fish/config.fish regexp='^status --is-interactive; and source (jenv init -|psub)' line='status --is-interactive; and source (jenv init -|psub)'
when: shell == "fish"
- name: Add JDK8 as possible environment
shell: export PATH=$PATH:{{ansible_env.HOME}}/.jenv/bin && eval "$(jenv init -)" && jenv add /usr/lib/jvm/java-8-openjdk-amd64
args:
executable: /bin/bash
- name: Set JAVA_HOME
lineinfile: dest={{ansible_env.HOME}}/.config/fish/config.fish regexp='^set -x JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64' line='set -x JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64'
when: shell == "fish"
when:
- ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu'
- jdk8 is defined and jdk8
- name: Copy inputrc file
copy: src=files/inputrc dest={{ansible_env.HOME}}/.inputrc
- name: Install gitconfig for user from template.
template: src=templates/gitconfig.j2 dest={{ansible_env.HOME}}/.gitconfig force=no
- name: Passwordless sudo (it's a VM or dev box, relax)
lineinfile:
dest: "/etc/sudoers.d/{{ ansible_user_id }}"
create: yes
regexp: "^.*ALL=(ALL:ALL) NOPASSWD: ALL"
line: "{{ ansible_user_id }} ALL=(ALL:ALL) NOPASSWD: ALL"
validate: "visudo -cf %s"
become: yes
- name: tmux prettier configuration
git:
repo: "https://github.com/gpakosz/.tmux.git"
dest: "{{ansible_env.HOME}}/.tmux"
- name: Copy tmux local customizations
copy: src=files/tmux.conf.local dest={{ansible_env.HOME}}/.tmux.conf.local
- name: Install apt packages for ruby
become: yes
package: name=ruby-full state=present
when:
- ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu'
- ruby
- name: Check ruby version
command: ruby -v
when: ruby
- name: Install tmuxinator
gem: name=tmuxinator state=present
when: ruby
- name: Download Powerline font for fancy terminal doodads
block:
- name: Add homebrew cask for fonts
command: brew tap homebrew/cask-fonts
- name: Install the hack nerd font
command: brew install --cask font-hack-nerd-font
# - name: Install the hack font
# command: brew install font-lekton-nerd-font
# - name: Install the hack font
# command: brew install font-ubuntumono-nerd-font
when:
- ansible_distribution == "MacOSX"
- get_fonts
- name: Decorate prompt with git status (Linux)
git:
repo: "https://github.com/magicmonty/bash-git-prompt.git"
dest: "{{ansible_env.HOME}}/.bash-git-prompt"
depth: 1
when: ansible_distribution != "MacOSX"
- name: Add gitprompt to bashrc
blockinfile:
dest: "{{ansible_env.HOME}}/.bashrc"
marker: "## {mark} Ansible gitprompt"
content: |
GIT_PROMPT_ONLY_IN_REPO=1
source ~/.bash-git-prompt/gitprompt.sh
when:
- ansible_distribution != "MacOSX"
- shell == "bash"
- name: Decorate prompt with git status (OSX)
homebrew:
name: bash-git-prompt
state: present
when:
- ansible_distribution == "MacOSX"
- shell == "bash"
- name: Add gitprompt to bashrc
blockinfile:
dest: "{{ansible_env.HOME}}/.bashrc"
marker: "## {mark} Ansible gitprompt"
content: |
if [ -f "$(brew --prefix)/opt/bash-git-prompt/share/gitprompt.sh" ]; then
GIT_PROMPT_ONLY_IN_REPO=1
__GIT_PROMPT_DIR=$(brew --prefix)/opt/bash-git-prompt/share
source "$(brew --prefix)/opt/bash-git-prompt/share/gitprompt.sh"
fi
when:
- ansible_distribution == "MacOSX"
- shell == "bash"
- name: Install Oh My Bash
block:
- get_url:
url: "https://raw.githubusercontent.com/ohmybash/oh-my-bash/master/tools/install.sh"
dest: "/tmp/install.sh"
mode: u+x
- name: Install Oh My Bash
command: /bin/bash "/tmp/install.sh"
- name: Choose Oh My Bash theme
lineinfile:
dest: "{{ansible_env.HOME}}/.bashrc"
regexp: "^OSH_THEME="
line: 'OSH_THEME="powerline"'
when:
- shell == "bash"
- name: Add useful bash aliases
blockinfile:
dest: "{{ansible_env.HOME}}/.bash_profile"
marker: "## {mark} Ansible aliases"
content: |
alias gpthis='git push origin HEAD:$(git_current_branch)'
alias grb='git rebase -p'
alias gm='git merge --no-ff'
alias glog='git log --oneline --decorate'
alias gup='git up'
when: shell == "bash"
- name: Add useful bash aliases for editor
lineinfile:
path: "{{ansible_env.HOME}}/.bash_profile"
regexp: "^alias e="
line: alias e='code --goto '
when:
- shell == "bash"
- editor is defined and editor == 'visual-studio-code'
- name: Add useful bash variables for editor
lineinfile:
path: "{{ansible_env.HOME}}/.bashrc"
regexp: "^export EDITOR="
line: export EDITOR=code
when:
- shell == "bash"
- editor is defined and editor == 'visual-studio-code'
- name: Add useful fish aliases
blockinfile:
dest: "{{ansible_env.HOME}}/.config/fish/config.fish"
marker: "## {mark} Ansible aliases"
content: |
alias gpthis='git push origin HEAD:(git_current_branch)'
alias grb='git rebase -p'
alias gm='git merge --no-ff'
alias glog='git log --oneline --decorate'
alias gup='git up'
alias k='kubectl'
when: shell == "fish"
- name: Add useful bash aliases (Linux)
blockinfile:
dest: "{{ansible_env.HOME}}/.bash_profile"
marker: "## {mark} Ansible aliases for linux"
content: |
alias psc='ps xawf -eo pid,user,cgroup,args'
when:
- ansible_distribution != "MacOSX"
- shell == "bash"
- name: Add useful fish aliases (Linux)
blockinfile:
dest: "{{ansible_env.HOME}}/.config/fish/config.fish"
marker: "## {mark} Ansible aliases for linux"
content: |
alias psc='ps xawf -eo pid,user,cgroup,args'
when:
- ansible_distribution != "MacOSX"
- shell == "fish"
- name: Install zshrc
copy: src=files/zshrc dest={{ansible_env.HOME}}/.zshrc mode=u=rw
when: shell == "zsh"
- name: Add z utility
block:
- get_url:
url: "https://raw.github.com/rupa/z/master/z.sh"
dest: "{{ansible_env.HOME}}/bin/z.sh"
mode: u+x
- name: Add z.sh to startup (bash)
lineinfile: dest={{ansible_env.HOME}}/.bashrc regexp="^. {{personal_bin}}/z.sh" line='. {{personal_bin}}/z.sh'
when: shell == "bash"
- name: Get google cloud SDK
block:
- get_url:
url: https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-435.0.0-darwin-x86_64.tar.gz
dest: "{{ansible_env.HOME}}/google-cloud-sdk.tar.gz"
- unarchive:
src: "{{ansible_env.HOME}}/google-cloud-sdk.tar.gz"
dest: "{{ansible_env.HOME}}"
- command: "{{ansible_env.HOME}}/google-cloud-sdk/install.sh"
- lineinfile:
dest: "{{ansible_env.HOME}}/.bash_profile"
regexp: "^source '{{ansible_env.HOME}}/google-cloud-sdk/path.bash.inc'"
line: "source '{{ansible_env.HOME}}/google-cloud-sdk/path.bash.inc'"
- lineinfile:
dest: "{{ansible_env.HOME}}/.bash_profile"
regexp: "^source '{{ansible_env.HOME}}/google-cloud-sdk/completion.bash.inc'"
line: "source '{{ansible_env.HOME}}/google-cloud-sdk/completion.bash.inc'"
when:
- google_cloud
- not ansible_check_mode
- ansible_distribution == "MacOSX"
- name: Get google cloud SDK
block:
- get_url:
url: https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-435.0.1-linux-x86_64.tar.gz
dest: "{{ansible_env.HOME}}/google-cloud-sdk.tar.gz"
- unarchive:
src: "{{ansible_env.HOME}}/google-cloud-sdk.tar.gz"
dest: "{{ansible_env.HOME}}"
- command: "{{ansible_env.HOME}}/google-cloud-sdk/install.sh"
- lineinfile:
dest: "{{ansible_env.HOME}}/.bash_profile"
regexp: "^source '{{ansible_env.HOME}}/google-cloud-sdk/path.bash.inc'"
line: "source '{{ansible_env.HOME}}/google-cloud-sdk/path.bash.inc'"
- lineinfile:
dest: "{{ansible_env.HOME}}/.bash_profile"
regexp: "^source '{{ansible_env.HOME}}/google-cloud-sdk/completion.bash.inc'"
line: "source '{{ansible_env.HOME}}/google-cloud-sdk/completion.bash.inc'"
when:
- google_cloud
- not ansible_check_mode
- ansible_distribution != "MacOSX"
- name: Get google repo
get_url:
url: https://storage.googleapis.com/git-repo-downloads/repo
dest: "{{ansible_env.HOME}}/bin/repo"
mode: u+x
- name: Get rmate utility as rsub
get_url:
url: "https://raw.github.com/aurora/rmate/master/rmate"
dest: "{{ansible_env.HOME}}/bin/rsub"
mode: u+x
when:
- ansible_distribution != "MacOSX"
- editor is defined and editor == 'sublime'
- name: Add Sublime remote editing alias
blockinfile:
dest: "{{ansible_env.HOME}}/.bashrc"
marker: "## {mark} Ansible aliases"
content: |
alias e="rsub"
when:
- ansible_distribution != "MacOSX"
- editor is defined and editor == 'sublime'
- name: Install pry shortcuts
copy: src=files/pryrc dest={{ansible_env.HOME}}/.pryrc mode=u=rwx
when: ruby
- name: Install useful atom packages
command: apm install {{ item }}
with_items: "{{atom_packages}}"
when:
- atom_packages is defined
- editor is defined and editor == 'atom'
- name: Install useful vscode packages
command: code --install-extension {{ item }}
with_items: "{{vscode_packages}}"
when:
- vscode_packages is defined
- editor is defined and editor == 'visual-studio-code'
- ansible_user_id != 'root'