From 14b2718b5c0ad360abaf0587d0afd91d10b36a5f Mon Sep 17 00:00:00 2001 From: Alpha Chen Date: Sun, 19 Nov 2023 14:11:07 -0800 Subject: [PATCH] lint macos playbook --- dev/macos.yml | 118 ++++++++++++++++++++++++++++---------------------- 1 file changed, 67 insertions(+), 51 deletions(-) diff --git a/dev/macos.yml b/dev/macos.yml index 86a047d..79161d0 100644 --- a/dev/macos.yml +++ b/dev/macos.yml @@ -1,54 +1,70 @@ -- hosts: all +- name: Set up macOS + hosts: all tasks: - - file: path=~/Library/KeyBindings state=directory - - name: Symlink Emacs-style keybindings for OS X - file: - src: ~/.dotfiles/macos/DefaultKeyBinding.dict - dest: ~/Library/KeyBindings/DefaultKeyBinding.dict - state: link - - - file: path=~/Library/Colors state=directory - - name: symlink OS X colors palettes - file: src={{ item }} dest=~/Library/Colors/{{ item | basename }} state=link - with_fileglob: ~/.dotfiles/macos/colors/* - - - file: path=~/Library/Dictionaries state=directory - - name: Install Webster's 1913 dictionary - copy: - src: ~/.dotfiles/macos/websters-1913.dictionary/ - dest: ~/Library/Dictionaries/websters-1913.dictionary - - - name: Enable Touch ID for sudo - become: yes - lineinfile: - path: /etc/pam.d/sudo - insertafter: '^auth\s+sufficient' - regexp: '^auth\s+sufficient\s+pam_tid.so$' - line: "auth\tsufficient\tpam_tid.so" - - - name: Enable Touch ID for sudo in tmux - become: yes - lineinfile: - path: /etc/pam.d/sudo - insertbefore: '^auth\tsufficient\tpam_tid.so' - regexp: '^auth\s+optional\s+.*pam_reattach.so$' - line: "auth\toptional\t/opt/homebrew/lib/pam/pam_reattach.so" - - # https://github.com/tmux/tmux/issues/2262 - - name: Fix tmux-256color terminfo - block: - - name: Create temporary file - ansible.builtin.tempfile: - state: file - register: tempfile - - name: Create terminfo source file - ansible.builtin.copy: - src: macos/tmux-256color - dest: "{{ tempfile.path }}" - - name: Install terminfo - command: /usr/bin/tic -x {{ tempfile.path }} - - name: Delete temporary file + - name: Create ~/Library directories + ansible.builtin.file: + path: ~/Library/{{ item }} + state: directory + mode: '0755' + loop: + - Colors + - Dictionaries + - KeyBindings + + - name: Symlink Emacs-style keybindings for OS X ansible.builtin.file: - path: "{{ tempfile.path }}" - state: absent + src: ~/.dotfiles/macos/DefaultKeyBinding.dict + dest: ~/Library/KeyBindings/DefaultKeyBinding.dict + state: link + + - name: Symlink OS X colors palettes + ansible.builtin.file: + src: "{{ item }}" + dest: ~/Library/Colors/{{ item | basename }} + state: link + with_fileglob: ~/.dotfiles/macos/colors/* + + - name: Install Webster's 1913 dictionary + ansible.builtin.copy: + src: ~/.dotfiles/macos/websters-1913.dictionary/ + dest: ~/Library/Dictionaries/websters-1913.dictionary + mode: '644' + + - name: Enable Touch ID for sudo + become: true + ansible.builtin.lineinfile: + path: /etc/pam.d/sudo + insertafter: '^auth\s+sufficient' + regexp: '^auth\s+sufficient\s+pam_tid.so$' + line: "auth\tsufficient\tpam_tid.so" + + - name: Enable Touch ID for sudo in tmux + become: true + ansible.builtin.lineinfile: + path: /etc/pam.d/sudo + insertbefore: '^auth\tsufficient\tpam_tid.so' + regexp: '^auth\s+optional\s+.*pam_reattach.so$' + line: "auth\toptional\t/opt/homebrew/lib/pam/pam_reattach.so" + + # https://github.com/tmux/tmux/issues/2262 + - name: Fix tmux-256color terminfo + block: + - name: Create temporary file + ansible.builtin.tempfile: + state: file + register: tempfile + - name: Create terminfo source file + ansible.builtin.copy: + src: macos/tmux-256color + dest: "{{ tempfile.path }}" + mode: '644' + - name: Install terminfo + ansible.builtin.command: /usr/bin/tic -x {{ tempfile.path }} + changed_when: true + - name: Delete temporary file + ansible.builtin.file: + path: "{{ tempfile.path }}" + state: absent + +# vim: ft=yaml.ansible