Skip to content

Commit 8734c44

Browse files
daveybWalkingDisasterdbenedic-insight
authored
Merge stable develop into main (#26)
* cask is already included with homebrew, and pip3 required to run on my machine (#9) * Macos catalina (#10) * add alias for git log --graph * change glog format * add more mac os catalina fixes * update .profile * remove hub alias, add pyenv eval to profile instead of zshrc * add pre-commit support (#12) * add pre-commit support (#13) * add easy align plugin to vim (#14) * updates to support already installed enterprise apps (#16) * updates to support already installed enterprise apps * remove pyenv local version Co-authored-by: Dave <dave.benedic@insight.com> * add support for WSL, lint cleanup, README updates (#17) Co-authored-by: Dave <dave.benedic@insight.com> * WSL Fixes #1` (#18) * fix gh gpg, update fonts and zsh tasks * fix perms on git-credential-manager bin * update zsh to exec via bash_profile (#19) * set gh cli editor to vim (#21) * add direnv to misc role (#22) Co-authored-by: Dave Benedic <dave.benedic@insight.com> * move direnv into zsh role, make zsh exec idempotent (#23) Co-authored-by: Dave <dave.benedic@insight.com> * change vimrc to templated file, add WSL keybinding maps (#24) Co-authored-by: Dave <dave.benedic@insight.com> * add syntax settings for .hcl files (#25) Co-authored-by: Dave <dave.benedic@insight.com> Co-authored-by: Michael Meadows <michaelmeadows@gmail.com> Co-authored-by: Dave <dave.benedic@insight.com>
1 parent 637516d commit 8734c44

File tree

33 files changed

+208
-79
lines changed

33 files changed

+208
-79
lines changed

.pre-commit-config.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
repos:
2+
- repo: https://github.com/adrienverge/yamllint.git
3+
sha: v1.10.0
4+
hooks:
5+
- id: yamllint
6+
args: ['-d {extends: relaxed, rules: {line-length: disable}}', '-s']

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,7 @@ It's designed to init new dotfiles as needed, so be aware that it may clobber ex
2424
`ansible-playbook -i hosts main.yml --ask-become-pass -t zsh`
2525

2626
### Configure GitHub user/email via parameters
27-
`ansible-playbok -i hosts main.yml --ask-become-pass -t git -e"user=MeMeMeMe" -e"email=me@me.com"`
27+
`ansible-playbook -i hosts main.yml --ask-become-pass -t git -e"git_user=MeMeMeMe" -e"git_email=me@me.com"`
28+
29+
### Run all plays in Windows Subsystem for Linux
30+
`ansible-playbook -i hosts main.yml --ask-become-pass -e"wsl_environment=true"`

group_vars/Debian.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,10 @@ colorize_script: solarized-mate.sh
77
docker_source: "deb https://apt.dockerproject.org/repo/ debian-{{ ansible_distribution_release }} main"
88
docker_gpg_source: "https://apt.dockerproject.org/gpg"
99
docker_gpg_key_id: 58118E89F3A912897C070ADBF76221572C52609D
10+
11+
gh_source: "deb https://cli.github.com/packages focal main"
12+
gh_gpg_source: "keyserver.ubuntu.com"
13+
gh_gpg_key_id: C99B11DEB97541F0
14+
15+
# bool - set to "true" if executing Ansible playbook within Windows Subsystem for Linux
16+
wsl_environment: false

group_vars/all.yml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
---
22
# common
3-
user:
4-
email:
3+
git_user:
4+
git_email:
55
working_dir: /tmp
6-
7-
# git
8-
github_user:
9-
10-

main.yml

Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
- hosts: all
33
tasks:
44
- debug:
5-
msg: vars
5+
msg: "{{ vars }}"
66
- name: Group all hosts by os
77
group_by: key={{ ansible_os_family }}
88
tags:
@@ -25,10 +25,10 @@
2525
- name: Install fonts
2626
hosts: all
2727
roles:
28-
- fonts
28+
- fonts
2929
tags:
30-
- fonts
31-
30+
- fonts
31+
3232
- name: Configure shell
3333
hosts: all
3434
roles:
@@ -50,37 +50,23 @@
5050
tags:
5151
- vim
5252

53-
- name: Install chrome
54-
hosts: all
55-
roles:
56-
- chrome
57-
tags:
58-
- chrome
59-
60-
- name: Install docker
61-
hosts: all
62-
roles:
63-
- docker
64-
tags:
65-
- docker
66-
6753
- name: Install misc packages
6854
hosts: all
6955
roles:
70-
- misc
56+
- misc
7157
tags:
72-
- misc
58+
- misc
7359

7460
- name: AWS stuff
7561
hosts: all
7662
roles:
77-
- aws
63+
- aws
7864
tags:
79-
- aws
65+
- aws
8066

8167
- name: Python stuff
8268
hosts: all
8369
roles:
84-
- python
70+
- python
8571
tags:
86-
- python
72+
- python

roles/bootstrap/tasks/linux.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
package:
99
name: xclip
1010
state: latest
11+
when: wsl_environment == false
1112

1213
- name: Install curl
1314
package:
@@ -18,3 +19,4 @@
1819
package:
1920
name: jq
2021
state: latest
22+
become: true

roles/bootstrap/tasks/main.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
# Utility role for bootstrapping future roles
22
# Linux runs as root
3-
---
3+
---
44
- name: ensure src dir exists
55
file:
66
path: /usr/local/src
77
state: directory
88
mode: 0755
99
owner: "{{ ansible_user_id }}"
1010
group: "{{ ansible_user_gid }}"
11-
become: yes
11+
become: true
1212

1313
- name: ensure shell profile exists
1414
file:
15-
path: "/Users/{{ ansible_user_id }}/.profile"
15+
path: ~/.profile
1616
state: touch
1717
mode: 0755
1818
owner: "{{ ansible_user_id }}"

roles/docker/tasks/darwin.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
---
22
- name: install docker
3-
shell: brew cask install docker
3+
shell: brew cask install docker
4+
ignore_errors: yes

roles/docker/tasks/linux.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
gpg_source: "{{ docker_gpg_source }}"
2525
gpg_key_id: "{{ docker_gpg_key_id }}"
2626

27-
- name: update packages
27+
- name: update packages
2828
include_role:
2929
name: packages
3030
vars:

roles/docker/tasks/linux/docker-compose.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
- name: Determine latest release of docker-compose
33
shell: >
4-
curl -s https://api.github.com/repos/docker/compose/releases/latest |
4+
curl -s https://api.github.com/repos/docker/compose/releases/latest |
55
jq -r ".assets[] |
66
select(.name==\"docker-compose-{{ ansible_system }}-{{ ansible_machine }}\") |
77
.browser_download_url"
@@ -15,7 +15,7 @@
1515
become: true
1616

1717
- name: Create zsh autocomplete folder
18-
file:
18+
file:
1919
path: ~/.zsh/completion/
2020
state: directory
2121

roles/docker/tasks/linux/docker-engine.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
become: true
1313

1414
- debug:
15-
msg: "Logoff/Logon required for {{ ansible_user_id }} before group changes will take effect"
15+
msg: "Logoff/Logon required for {{ ansible_user_id }} before group changes will take effect"

roles/dropbox/tasks/linux.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
failed_when: dropbox_install_check.rc > 1
66
changed_when: dropbox_install_check.rc == 1
77
become: true
8-
8+
99
- name: download dropbox
1010
get_url:
1111
url: "{{ dropbox_url }}"

roles/fonts/tasks/linux.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55
state: latest
66
become: true
77

8-
- name: Install powerline fonts
9-
shell: ". {{ working_dir }}/powerline-fonts/install.sh"
8+
- name: Install powerline font
9+
command: "{{ working_dir }}/powerline-fonts/install.sh {{ powerline_font }}"
10+
args:
11+
chdir: "{{ working_dir }}/powerline-fonts"
1012

1113
- name: Create ~/.fonts directory
1214
file:
@@ -30,6 +32,6 @@
3032

3133
- name: Set powerline font
3234
shell: "cp ~/.local/share/fonts/'{{ powerline_font }}' ~/.fonts/'{{ powerline_font }}'"
33-
35+
3436
- name: Reload font cache
3537
shell: "fc-cache -vf ~/.fonts/"
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/sh
2+
exec '/mnt/c/Program Files (x86)/Git Credential Manager Core/git-credential-manager-core.exe' $@

roles/git/tasks/darwin.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,9 @@
33
homebrew:
44
name: github/gh/gh
55
state: latest
6+
7+
# http://pre-commit.com
8+
- name: install pre-commit for git
9+
homebrew:
10+
name: pre-commit
11+
state: latest

roles/git/tasks/linux.yml

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,45 @@
55
state: latest
66
become: true
77

8+
- name: Add github cli official GPG key
9+
apt_key:
10+
keyserver: "{{ gh_gpg_source }}"
11+
id: "{{ gh_gpg_key_id }}"
12+
state: present
13+
when: (ansible_os_family == "Debian") or
14+
(ansible_os_family == "Ubuntu")
15+
become: true
16+
17+
- name: enable github cli source in package repository
18+
include_role:
19+
name: packages
20+
vars:
21+
add_source: true
22+
package_source: "{{ gh_source }}"
23+
24+
- name: update packages
25+
include_role:
26+
name: packages
27+
vars:
28+
update_cache: true
29+
830
- name: Install cli for github
931
package:
10-
name: hub
32+
name: gh
1133
state: latest
1234
become: true
35+
36+
- name: install pre-commit for git
37+
pip:
38+
name: pre-commit
39+
40+
# Note: there is an external dependency here - you must have git-credential-manager-core installed in Windows!!!
41+
- name: alias Windows git-credential-manager-core into WSL environment
42+
copy:
43+
src: "{{ role_path}}/files/git-credential-manager"
44+
dest: /usr/bin/git-credential-manager
45+
owner: root
46+
group: root
47+
mode: '0755'
48+
when: wsl_environment
49+
become: true

roles/git/tasks/main.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
- include_tasks: darwin.yml
66
when: ansible_system == "Darwin"
77

8+
- name: set fact for wsl environment
9+
set_fact:
10+
wsl_environment: "{{ wsl_environment }}"
11+
812
- name: template gitconfig
913
template:
1014
src: "templates/gitconfig.j2"
@@ -15,3 +19,6 @@
1519
get_url:
1620
url: https://gist.githubusercontent.com/octocat/9257657/raw/3f9569e65df83a7b328b39a091f0ce9c6efc6429/.gitignore
1721
dest: ~/.gitignore
22+
23+
- name: set vim as gh cli editor
24+
command: gh config set editor vim

roles/git/templates/gitconfig.j2

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1+
{% if wsl_environment %}
2+
[credential]
3+
helper = manager
4+
useHttpPath = true
5+
{% endif %}
16
[user]
2-
name = {{ user }}
3-
email = {{ email }}
7+
name = {{ git_user }}
8+
email = {{ git_email }}
49
[merge]
510
tool = vimdiff
611
[alias]
@@ -23,9 +28,5 @@
2328
editor = vim
2429
mergeoptions = --no-edit
2530
pager = cat
26-
[github]
27-
user = {{ github_user }}
28-
[hub]
29-
protocol = ssh
3031
[push]
3132
default = upstream

roles/misc/tasks/darwin.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,8 @@
4646
homebrew:
4747
name: kubernetes-helm
4848
state: latest
49+
50+
- name: install direnv
51+
homebrew:
52+
name: direnv
53+
state: latest

roles/misc/tasks/linux.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,16 @@
33
package:
44
name: lshw
55
state: latest
6+
when: wsl_environment == false
67

78
- name: Install kupfer
89
package:
910
name: kupfer
1011
state: latest
12+
when: wsl_environment == false
1113

12-
- name: Install Silver Searcher
14+
- name: Install direnv
1315
package:
14-
name: silversearcher-ag
16+
name: direnv
1517
state: latest
18+
become: true

roles/packages/tasks/gpg.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
- name: fail if gpg_source is unspecified
33
fail:
44
msg: "gpg_source is not specified"
5-
when: gpg_source is undefined
5+
when: gpg_source is undefined
66

77
- name: fail if gpg_key_id is unspecified
88
fail:
99
msg: "gpg_key_id is not specified"
10-
when: gpg_key_id is undefined
10+
when: gpg_key_id is undefined
1111

1212
- name: Add GPG key to apt
1313
apt_key:

roles/packages/tasks/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
- include_tasks: update.yml
2+
- include_tasks: update.yml
33
when: update_cache is defined
44

55
- include_tasks: source.yml

roles/packages/tasks/source.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
msg: "package_source is not specified"
55
when: package_source is undefined
66

7-
- name: add source to apt
7+
- name: add source to apt
88
lineinfile:
99
dest: /etc/apt/sources.list
1010
line: "{{ package_source }}"

roles/slack/tasks/linux.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
register: slack_install_check
55
failed_when: slack_install_check.rc > 1
66
changed_when: slack_install_check.rc == 1
7-
7+
88
- name: download slack
99
get_url:
1010
url: "{{ slack_debian_url }}"
@@ -15,4 +15,3 @@
1515
apt: deb="{{ working_dir }}/{{ slack_package_name }}"
1616
when: slack_install_check.rc == 1
1717
become: true
18-

roles/slack/vars/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
---
22
slack_version: '2.3.3'
3-
slack_package_name: 'slack-desktop-{{ slack_version }}-amd64.deb'
3+
slack_package_name: 'slack-desktop-{{ slack_version }}-amd64.deb'
44
slack_debian_url: 'https://downloads.slack-edge.com/linux_releases/{{ slack_package_name }}'

roles/term/tasks/darwin.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
- name: install iterm2
33
shell: brew cask install iterm2
4+
ignore_errors: yes
45

56
- name: install zsh syntax highlighting
67
homebrew:

0 commit comments

Comments
 (0)