11 Commits

Author SHA1 Message Date
6ff50854e0 Add magnet & mas for macOS
The `mas` role installed the command-line tool of the same name to
install Mac App Store package. The `magnet` role then uses `mas` to
install the tiling window manager from the App Store.
2022-12-10 22:44:50 +00:00
5cba48f632 Ensure tmux-256color exists on macOS
As outlined in [this
gist](https://gist.github.com/bbqtd/a4ac060d6f6b9ea6fe3aabe735aa9d95)
the version of `ncurses` shipped with macOS is too old to be aware of
the `tmux-256color` terminal info database which is the default in
`tmux`. This patch downloads the latest `ncurses` terminal info database
and uses that to install the `tmux-256color` entry for the current user
in `~/.terminfo`. This ensures that bold, italic, etc, are working
correctly and `git` does not throw warnings as noted
[here](1e2c00aa32)
2022-12-10 22:18:50 +00:00
7e9166cb48 Add font role for macOS (initially) 2022-12-10 16:27:15 +00:00
747f1a6992 Add watch role for macOS, implicitly installed on Linux 2022-12-10 16:08:20 +00:00
db3d146dc9 Fix playbook imports 2022-12-10 15:45:46 +00:00
91839b927d Fix obsidian role on macOS 2022-12-10 15:45:30 +00:00
c5e2a76d2e Fix jp role on macOS 2022-12-10 15:27:02 +00:00
baa0206937 Make sudo role work on macOS 2022-12-09 15:19:40 +00:00
2abc38f696 Add gh role for macOS, Windows, and Debian 2022-12-08 11:42:15 +00:00
63ff47c3b2 Don't install xclip or xsel in WSL
Newer WSL2 has issues with `xclip`/`xsel` behaviour which cause Windows
GUI's to freeze waiting for input from an already exited process.
Switching to `win32yank.exe` for clipboard integrations.
2022-12-03 18:53:12 +00:00
da4b8858d3 Split out Unix into UnixCLI and UnixGUI 2022-12-02 19:11:22 +00:00
22 changed files with 186 additions and 21 deletions

View File

@@ -1,6 +1,5 @@
--- ---
- hosts: localhost - hosts: localhost
roles: roles:
- role: sudo - role: sudo
when: ansible_user_id != "root" when: ansible_user_id != "root"
@@ -15,6 +14,7 @@
- role: bat - role: bat
- role: curl - role: curl
- role: fzf - role: fzf
- role: gh
- role: git - role: git
- role: htop - role: htop
- role: jp - role: jp
@@ -23,12 +23,11 @@
- role: tidy - role: tidy
- role: tree - role: tree
- role: yq - role: yq
- role: watch
- role: llvm - role: llvm
- role: nodejs - role: nodejs
- role: python - role: python
- role: 1password
- role: wsl - role: wsl
when: '"WSL" in ansible_kernel' when: '"WSL" in ansible_kernel'

5
UnixGUI.yaml Normal file
View File

@@ -0,0 +1,5 @@
---
- import_playbook: UnixCLI.yaml
- hosts: localhost
roles:
- role: 1password

View File

@@ -14,8 +14,9 @@
- role: bat - role: bat
- role: curl - role: curl
- role: fzf - role: fzf
- role: tree - role: gh
- role: jq - role: jq
- role: tree
- role: yq - role: yq
- role: llvm - role: llvm

View File

@@ -1,7 +1,9 @@
--- ---
- import_playbook: Unix.yaml - import_playbook: UnixGUI.yaml
- hosts: localhost - hosts: localhost
roles: roles:
- role: mas
- role: fonts
- role: magnet
- role: obsidian - role: obsidian

View File

@@ -0,0 +1,9 @@
---
- name: enable homebrew tap
homebrew_tap:
name: homebrew/cask-fonts
- name: install Caskaydia Cove Nerd Font
homebrew_cask:
name: font-caskaydia-cove-nerd-font
state: latest

View File

@@ -0,0 +1,5 @@
---
- name: install homebrew package
homebrew:
name: gh
state: latest

View File

@@ -0,0 +1,31 @@
---
- set_fact:
arch_map:
aarch64: arm64
armv6l: armhf
armv7l: armhf
i386: i386
x86_64: amd64
- set_fact:
arch: '{{ [ansible_architecture] | map("extract", arch_map) | first }}'
- name: download apt repository key
become: true
get_url:
url: https://cli.github.com/packages/githubcli-archive-keyring.gpg
dest: /usr/share/keyrings/githubcli-archive-keyring.gpg
mode: 0644
- name: add apt repository list
become: true
apt_repository:
filename: github-cli
repo: 'deb [arch={{arch}} signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main'
state: present
- name: install apt package
become: true
apt:
name: gh
state: latest
update_cache: true

View File

@@ -1,5 +1,5 @@
--- ---
- name: install chocolatey package - name: install chocolatey package
win_chocolatey: win_chocolatey:
name: moonlight-qt name: gh
state: latest state: latest

2
roles/gh/tasks/main.yaml Normal file
View File

@@ -0,0 +1,2 @@
---
- include_tasks: '{{ansible_os_family}}.yaml'

View File

@@ -4,9 +4,12 @@
url: https://api.github.com/repos/jmespath/jp/releases/latest url: https://api.github.com/repos/jmespath/jp/releases/latest
register: latest register: latest
# TODO: Support arm64
- set_fact: - set_fact:
asset_query: '[?contains(name, `jp-darwin-amd64`)] | [0]' arch: '{{ [ansible_architecture] |
map("extract", { "arm64": "arm64", "x86_64": "amd64" }) | first }}'
- set_fact:
asset_query: '[?contains(name, `jp-darwin-{{arch}}`)] | [0]'
assets: '{{latest.json.assets}}' assets: '{{latest.json.assets}}'
latest_version: '{{latest.json.tag_name}}' latest_version: '{{latest.json.tag_name}}'
jp_exe: '{{ansible_env.HOME}}/.local/bin/jp' jp_exe: '{{ansible_env.HOME}}/.local/bin/jp'
@@ -14,7 +17,7 @@
- name: check if already installed - name: check if already installed
stat: stat:
path: '{{jp_exe}}' path: '{{jp_exe}}'
register: jp_exe register: jp_stat
- name: get installed version - name: get installed version
when: jp_stat.stat.exists == True when: jp_stat.stat.exists == True

View File

@@ -0,0 +1,8 @@
---
- assert:
that: ansible_os_family == 'Darwin'
- name: install app store package
mas:
id: 441258766
state: latest

View File

@@ -0,0 +1,8 @@
---
- assert:
that: ansible_os_family == 'Darwin'
- name: install homebrew package
homebrew:
name: mas
state: latest

View File

@@ -1,6 +1,6 @@
--- ---
- name: install homebrew package - name: install homebrew package
homebrew: homebrew_cask:
name: obsidian name: obsidian
state: latest state: latest
@@ -8,4 +8,4 @@
git: git:
repo: git@github.com:kbenzie/notes.git repo: git@github.com:kbenzie/notes.git
dest: '{{ansible_env.HOME}}/Documents/Notes' dest: '{{ansible_env.HOME}}/Documents/Notes'
branch: main version: main

View File

@@ -2,11 +2,13 @@
- assert: - assert:
that: ansible_user_id != "root" that: ansible_user_id != "root"
- include_vars: '{{ansible_os_family}}.yaml'
- name: create /etc/sudoers.d/{user} config file - name: create /etc/sudoers.d/{user} config file
become: true become: true
template: template:
src: sudoers src: sudoers
dest: '/etc/sudoers.d/{{ansible_user_id}}' dest: '/etc/sudoers.d/{{ansible_user_id}}'
owner: root owner: '{{sudo_owner}}'
group: root group: '{{sudo_group}}'
mode: '0440' mode: '0440'

View File

@@ -0,0 +1,3 @@
---
sudo_owner: root
sudo_group: wheel

View File

@@ -0,0 +1,3 @@
---
sudo_owner: root
sudo_group: root

View File

@@ -3,6 +3,21 @@
pacman: pacman:
name: name:
- tmux - tmux
- xclip
- urlscan - urlscan
state: latest state: latest
- name: install pacman package
when: '"WSL" not in ansible_kernel'
become: true
pacman:
name: xsel
state: latest
- name: remove pacman package
when: '"WSL" in ansible_kernel'
become: true
pacman:
name:
- xclip
- xsel
state: absent

View File

@@ -7,3 +7,38 @@
- reattach-to-user-namespace - reattach-to-user-namespace
- urlview - urlview
state: latest state: latest
- name: check terminal info description exists
command: /usr/bin/infocmp -x tmux-256color
changed_when: false
failed_when: false
register: terminfo_exists
- name: download latest terminal info descriptions
when: terminfo_exists.rc == 1
get_url:
url: https://invisible-island.net/datafiles/current/terminfo.src.gz
dest: ~/terminfo.src.gz
- name: extract latest terminfo info descriptions
when: terminfo_exists.rc == 1
command: /usr/bin/gunzip ~/terminfo.src.gz
- name: compile terminal info
when: terminfo_exists.rc == 1
command: /usr/bin/tic -xe tmux-256color ~/terminfo.src
- name: cleanup downloaded terminal info descriptions
when: terminfo_exists.rc == 1
file:
path: '{{item}}'
state: absent
with_items:
- ~/temrinfo.src.gz
- ~/terminfo.src
- name: check terminal info description exists
when: terminfo_exists.rc == 1
command: /usr/bin/infocmp -x tmux-256color
changed_when: false
register: terminfo_exists

View File

@@ -1,12 +1,26 @@
--- ---
- name: install apt packages - name: install apt packages
become: true become: true
package: apt:
name: name:
- tmux - tmux
- gawk - gawk
- jq
- sysstat - sysstat
- urlview - urlview
- xclip
state: latest state: latest
- name: install apt package
when: '"WSL" not in ansible_kernel'
become: true
apt:
name: xsel
state: latest
- name: remove apt package
when: '"WSL" in ansible_kernel'
become: true
apt:
name:
- xclip
- xsel
state: absent

View File

@@ -3,8 +3,22 @@
dnf: dnf:
name: name:
- tmux - tmux
- xclip
- urlscan - urlscan
- sysstat - sysstat
- jq
state: latest state: latest
- name: install dnf package
when: '"WSL" not in ansible_kernel'
become: true
dnf:
name: xsel
state: latest
- name: remove dnf package
when: '"WSL" in ansible_kernel'
become: true
dnf:
name:
- xclip
- xsel
state: absent

View File

@@ -0,0 +1,6 @@
---
- name: install homebrew package
when: ansible_os_family == "Darwin"
homebrew:
name: watch
state: latest