-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.yml
205 lines (186 loc) · 5.41 KB
/
config.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
201
202
203
204
# ~/.local/etc/config.yml
## Ansible Playbook - config.yml
## Defines user level configuration and environment
##
## Copyright (C)2021, Da Planet Security. All Rights Reserved
## Licenced under a modified BSD 2.0 Licence.
## Authors:
## - Dwight Spencer <@denzuko>
# gather_facts: false
# roles:
# - { role: systemli.drift }
---
- hosts: localhost
vars:
homedir: "{{ lookup('env', 'HOME') }}"
pubkey: "{{lookup('env', 'HOME')}}/.ssh/id_rsa.pub"
gh_token: "{{lookup('env', 'GH_TOKEN')}}"
tasks:
- name: Install needed tools
become: true
apt:
name: "{{item}}"
update_cache: yes
state: latest
loop:
- monit
- incron
- vim-nox
- mutt
- fetchmail
- gpgv2
- git
- python3-pip
- python3-venv
- python3-jsonschema
- python3-setuptools
- httpie
- msmtp
- docker
- irssi
- surfraw
- elinks
- jo
- jq
- awscli
- s3cmd
- ctags
- name: remove broken vim
become: true
apt:
name: vim-tiny
state: absent
- name: Configure vimrc
blockinfile:
path: "{{homedir}}/.vimrc"
state: present
create: yes
marker: '" {mark} ANSIBLE MANAGED BLOCK'
content: |
filetype plugin on
set nocompatible
set ts=4 sts=4 sw=4 ai si et tw=80 ff=unix vb
set ru sb spr ls=2
set fdm=indent
set foldlevel=99
set encoding=utf-8
set omnifunc=syntaxcomplete#Complete
syntax on
set list
nnoremap <space> za
augroup Python
au!
au BufCreate,BufNewFile,BufRead *.py set tw=79 list rn
au BufCreate,BufNewFile,BufRead *.py set makeprg=invoke
augroup end
augroup yaml
au!
au BufNewFile,BufRead *.yaml,*.yml set makeprg=pipx\ run\ yamllint\ %
au BufNewFile,BufRead *.yaml,*.yml set list ruler rnu
augroup end
- name: Configure inputrc
blockinfile:
path: "{{homedir}}/.inputrc"
state: present
create: yes
content: |
set editing-mode vi
set bell-style none
- name: Add content for powerline bash lib
blockinfile:
path: "{{homedir}}/.local/lib/powerline.sh"
state: present
create: yes
content: |
powerline-daemon -q
POWERLINE_BASH_CONTINUATION=1
POWERLINE_BASH_SELECT=1
source /usr/share/powerline/bindings/bash/powerline.sh
- name: append bashrc with powerline lib
blockinfile:
path: "{{homedir}}/.bashrc"
state: present
create: true
content: 'source /$HOME/.local/lib/powerline.sh'
- name: Add vim theme to config directory
git:
repo: https://github.com/mr-ubik/vim-hackerman-syntax.git
force: true
dest: "{{homedir}}/.vim/"
depth: 1
- name: remove theme's git folder [fixme]
file:
path: "{{lookup('env', 'HOME') }}/.vim/.git"
force: true
state: absent
- name: establish cron re-provisioning
cron:
name: 'rerun config playbook'
special_time: hourly
job: "cd {{homedir}}; invoke provision"
- name: fetchmail periodically
cron:
name: 'fetchmail on the hour'
special_time: hourly
job: "fetchmail"
- name: Establish git config, User
git_config:
name: user.name
scope: global
value: 'Dwight Spencer'
- name: Establish git config, Email
git_config:
name: user.email
scope: global
value: 'dwightaspencer@gmail.com'
- name: Establish git config, hub protocol
git_config:
name: hub.protocol
scope: global
value: 'https'
- name: Establish git config - github user
git_config:
name: github.user
scope: global
value: 'denzuko'
- name: Generate an OpenSSH keypair
openssh_keypair:
path: "{{homedir}}/.ssh/id_rsa"
force: no
- name: Update github public keys
github_key:
name: "Access key - {{ansible_hostname}}"
token: "{{gh_token}}"
pubkey: "{{lookup('file', pubkey)}}"
- name: Add monitrc
blockinfile:
path: "{{homedir}}/.monitrc"
state: present
create: yes
content: |
set daemon 120
set logfile "{{homedir}}/.monit.log"
set httpd port 2812 and use address localhost allow localhost allow @adm
check system localhost if loadavg (1min) > 10 then alert
- name: theme tmux
git:
repo: https://github.com/jimeh/tmux-themepack.git
dest: "{{homedir}}/.tmux-themepack"
- name: config tmux theme
blockinfile:
path: "{{homedir}}/.tmux.conf"
state: present
create: yes
content: |
source-file "${HOME}/.tmux-themepack/powerline/block/magenta.tmuxtheme"
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix
bind | split-window -h
bind - split-window -v
unbind '"'
unbind %
set -g mouse-select-window on
set -g mouse-select-pane on
set -g mouse-resize-pane on
set -g mouse on