blob: 0a6829d15c800d581aee411277de5683e1f640a5 (
plain) (
blame)
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
|
# This role is a little bit different from others, because it is supposed to
# run mostly from localhost to make and copy dotfiles that might be useful on
# this particular machine. There is maybe not enough permissions to install
# software, so we are taking unusual approach here: check if software is
# installed and then bring relevant dotfiles for it.
- name: Configure bash if installed
tags: bash
block:
- name: Check if bash is installed
ansible.builtin.command: bash --version
changed_when: false
failed_when: false
register: has_bash
- ansible.builtin.include_role:
name: bashrc
vars:
bashrc_user: '{{ dotfiles_user }}'
bashrc_group: '{{ dotfiles_group }}'
bashrc_homedir: '{{ dotfiles_homedir }}'
when: has_bash.rc == 0
- name: Configure vim if installed
tags: vim
block:
- name: Check if vim is installed
ansible.builtin.command: vim --version
changed_when: false
failed_when: false
register: has_vim
- ansible.builtin.include_role:
name: vimrc
vars:
vimrc_user: '{{ dotfiles_user }}'
vimrc_group: '{{ dotfiles_group }}'
vimrc_homedir: '{{ dotfiles_homedir }}'
when: has_vim.rc == 0
- name: Configure screen if installed
tags: screen
block:
- name: Check if screen is installed
ansible.builtin.command: screen --version
changed_when: false
failed_when: false
register: has_screen
- ansible.builtin.include_role:
name: screenrc
vars:
screenrc_user: '{{ dotfiles_user }}'
screenrc_group: '{{ dotfiles_group }}'
screenrc_homedir: '{{ dotfiles_homedir }}'
screenrc_jumphost: '{{ dotfiles_jumphost }}'
when: has_screen.rc == 0
- name: Configure ssh if installed
tags: ssh
block:
- name: Check if ssh is installed
ansible.builtin.command: ssh -V
changed_when: false
failed_when: false
register: has_ssh
- ansible.builtin.include_role:
name: sshconfig
vars:
sshconfig_user: '{{ dotfiles_user }}'
sshconfig_group: '{{ dotfiles_group }}'
sshconfig_homedir: '{{ dotfiles_homedir }}'
sshconfig_jumphost: '{{ dotfiles_jumphost }}'
when: has_ssh.rc == 0
- name: Configure git if installed
tags: git
block:
- name: Check if git is installed
ansible.builtin.command: git --version
changed_when: false
failed_when: false
register: has_git
- ansible.builtin.include_role:
name: gitconfig
vars:
gitconfig_user: '{{ dotfiles_user }}'
gitconfig_group: '{{ dotfiles_group }}'
gitconfig_homedir: '{{ dotfiles_homedir }}'
when: has_git.rc == 0
- name: Configure gdb if installed
tags: gdb
block:
- name: Check if gdb is installed
ansible.builtin.command: gdb --version
changed_when: false
failed_when: false
register: has_gdb
- ansible.builtin.include_role:
name: gdbinit
vars:
gdbinit_user: '{{ dotfiles_user }}'
gdbinit_group: '{{ dotfiles_group }}'
gdbinit_homedir: '{{ dotfiles_homedir }}'
when: has_gdb.rc == 0
- name: Configure mutt if installed
tags: mutt
block:
- name: Check if mutt is installed
ansible.builtin.command: mutt -v
changed_when: false
failed_when: false
register: has_mutt
- ansible.builtin.include_role:
name: muttrc
vars:
muttrc_user: '{{ dotfiles_user }}'
muttrc_group: '{{ dotfiles_group }}'
muttrc_homedir: '{{ dotfiles_homedir }}'
when: has_mutt.rc == 0
- name: Configure go if installed
tags: go
block:
- name: Check if go is installed
ansible.builtin.command: go version
changed_when: false
failed_when: false
register: has_go
- ansible.builtin.include_role:
name: goenv
vars:
goenv_user: '{{ dotfiles_user }}'
goenv_group: '{{ dotfiles_group }}'
goenv_homedir: '{{ dotfiles_homedir }}'
when: has_go.rc == 0
- name: Copy templates files if necessary
tags: templates
block:
- name: Check if C++ compiler is installed
ansible.builtin.command: c++ --version
changed_when: false
failed_when: false
register: has_cpp
- name: Check if Python is installed
ansible.builtin.command: python --version
changed_when: false
failed_when: false
register: has_python
- name: Setup templates directory
ansible.builtin.file:
path: '{{ dotfiles_homedir }}/.templates'
state: directory
owner: '{{ dotfiles_user }}'
when: has_cpp.rc == 0 or has_python.rc == 0
- name: Copy template.cpp to home directory
ansible.builtin.copy:
src: misc/dotfiles/templates/template.cpp
dest: '{{ dotfiles_homedir }}/.templates/template.cpp'
when: has_cpp.rc == 0
- name: Copy benchmark.cpp to home directory
ansible.builtin.copy:
src: misc/dotfiles/templates/benchmark.cpp
dest: '{{ dotfiles_homedir }}/.templates/benchmark.cpp'
when: has_cpp.rc == 0
- name: Copy template.py to home directory
ansible.builtin.copy:
src: misc/dotfiles/templates/template.py
dest: '{{ dotfiles_homedir }}/.templates/template.py'
when: has_python.rc == 0
|