-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathplaybook.yml
185 lines (162 loc) · 6.37 KB
/
playbook.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
---
- hosts: localhost
connection: local
become: yes
vars_files:
- "default.config.yml"
pre_tasks:
- name: Include optional configuration files.
include_vars: "{{ item }}"
with_fileglob:
- "config.yml"
- "{{ config_file | default('') }}"
tags: always
roles:
- { role: system, tags: [packages] }
- { role: dev-tools/git, when: git, tags: [git, dev-tools] }
- { role: oefenweb.virtualbox, when: virtualbox, tags: [virtualbox, dev-tools] }
- { role: oefenweb.vagrant, when: vagrant, tags: [vagrant, dev-tools] }
- { role: gantsign.oh-my-zsh, when: zsh, tags: [shell, zsh] }
- { role: oefenweb.chrome, when: chrome, tags: [browser, chrome] }
- { role: geerlingguy.docker, when: docker, tags: [docker, dev-tools] }
#- { role: dev-tools/tmuxinator, when: tmuxinator, tags: [tmuxinator, dev-tools] }
- { role: aeimer.install_bat, when: bat, tags: [bat, dev-tools] }
- { role: dev-tools/mysql-workbench, when: mysql_workbench }
- { role: editors/typora, when: typora, tags: [typora, editor, markdown] }
- { role: dev-tools/pet, when: pet_cli, tags: [dev-tools] }
- { role: dev-tools/openshift_client, when: openshift_client, tags: [openshift_client, k8s, cloud] }
- { role: others/insync, when: insync, tags: [insync, drive] }
- { role: others/chezmoi, when: chezmoi, tags: [chezmoi, dotfiles] }
- { role: andrewrothstein.go, when: golang, tags: [golang] }
- { role: dev-tools/footloose, when: footloose, tags: [footloose] }
- { role: dev-tools/faas-cli, when: faas, tags: [faas] }
- { role: custom, become: no, tags: [custom, zsh] }
- { role: others/calibre-ebook, when: calibre, tags: [calibre] }
- { role: geerlingguy.java, when: java, tags: [java] }
- { role: dev-tools/azure, when: azure_cli, tags: [azure, azure-cli] }
- { role: cimon-io.asdf, when: asdf, tags: [asdf] }
# @todo
# Install zsh-plugins
# Install editor * plugins (vscode, phpstorm)
# Install autotag
# molotov
# java
# hub ?
# red : https://github.com/antonmedv/red
# bash-it : https://github.com/Bash-it/bash-it ?
post_tasks:
- name: Update .zshrc
block:
- name: Add tmux autostart support to zsh
become: no
lineinfile:
path: "{{ lookup('env','HOME') }}/.zshrc"
insertbefore: 'source \$ZSH\/oh\-my\-zsh\.sh'
line: "ZSH_TMUX_AUTOSTART=true"
when: tmux and tmux_autostart
- name: Update shell sources for zsh
become: no
blockinfile:
path: "{{ lookup('env','HOME') }}/.zshrc"
marker: "# {mark} ANSIBLE MANAGED BLOCK #"
content: |
{% if autojump is sameas true %}
source /usr/share/autojump/autojump.sh
{% endif %}
{% if direnv is sameas true %}
eval "$(direnv hook zsh)"
{% endif %}
{% if azure_cli is sameas true %}
autoload -U +X bashcompinit && bashcompinit
source /etc/bash_completion.d/azure-cli
{% endif %}
{% if direnv is sameas true %}
eval "$(direnv hook zsh)"
{% endif %}
{% if custom_aliases is defined and custom_aliases|length > 0 %}
{{ custom_aliases }}
{% endif %}
{% if custom_shell_sources is defined and custom_shell_sources|length > 0%}
{{ custom_shell_sources }}
{% endif %}
when: update_shell_sources
- name: Add GOPATH and GOBIN
become: no
block:
- name: Create go dir
with_items:
- '{{go_dev_path}}'
file:
path: '{{item}}'
state: directory
mode: '0755'
- blockinfile:
path: "{{ lookup('env','HOME') }}/.zshrc"
marker: "# {mark} ANSIBLE MANAGED BLOCK - golang #"
content: |
{{ golang_govars }}
when: golang and golang_govars and update_shell_sources
when: zsh
tags: [shell]
- name: Update .bashrc
block:
- name: Update shell sources for bash
become: no
blockinfile:
path: "{{ lookup('env','HOME') }}/.zshrc"
marker: "# {mark} ANSIBLE MANAGED BLOCK #"
content: |
{% if autojump is sameas true %}
source /usr/share/autojump/autojump.sh
{% endif %}
{% if direnv is sameas true %}
eval "$(direnv hook zsh)"
{% endif %}
{% if azure_cli is sameas true %}
autoload -U +X bashcompinit && bashcompinit
source /etc/bash_completion.d/azure-cli
{% endif %}
{% if direnv is sameas true %}
eval "$(direnv hook zsh)"
{% endif %}
{% if custom_aliases is defined and custom_aliases|length > 0 %}
{{ custom_aliases }}
{% endif %}
{% if custom_shell_sources is defined and custom_shell_sources|length > 0%}
{{ custom_shell_sources }}
{% endif %}
when: update_shell_sources
- name: Add GOPATH and GOBIN
become: no
block:
- name: Create go dir
with_items:
- '{{go_dev_path}}'
file:
path: '{{item}}'
state: directory
mode: '0755'
- blockinfile:
path: "{{ lookup('env','HOME') }}/.bashrc"
marker: "# {mark} ANSIBLE MANAGED BLOCK - golang #"
content: |
{{ golang_govars }}
when: golang and golang_govars and update_shell_sources
when: not zsh
tags: [shell]
- name: Create / Update gitconfig files
become: no
tags: [gitconfig]
blockinfile:
create: yes
path: "{{ lookup('env','HOME') }}/{{ item.name }}"
marker: "# {mark} ANSIBLE MANAGED BLOCK - {{ item.name }} #"
content: |
{{ item.value }}
loop: "{{ gitconfig|flatten(levels=1) }}"
when: update_gitconfig
- name: Restart network-manager
when: openvpn
service:
name: openvpn
state: restarted