- hosts: all
  tasks:

  - name: update
    homebrew: update_homebrew=yes

  - name: install taps
    homebrew_tap:
      name:
        - homebrew/bundle
        - homebrew/cask
        - homebrew/cask-drivers
        - homebrew/cask-fonts
        - homebrew/cask-versions
        - homebrew/core
        - homebrew/services
        - kejadlen/tap
        - seattle-beach/tap

  - name: install formulae
    homebrew:
      name:
        - ansible
        - chruby
        - direnv
        - exa
        - fasd
        - fd
        - ffmpeg
        - fzf
        - git
        - git-lfs
        - hledger
        - jq
        - luarocks
        - mas
        - mosh
        - pandoc
        - reattach-to-user-namespace
        - ripgrep
        - ruby-install
        - svn # required for font-source-code-pro
        - syncthing
        - tmux
        - tree
        - watch
        - yarn
        - ykman
        - youtube-dl
        - zsh
        - fabianishere/personal/pam_reattach

  - name: install universal ctags
    homebrew:
      name: universal-ctags/universal-ctags/universal-ctags
      install_options: HEAD

  - name: start homebrew services
    command: brew services start {{ item }}
    with_items:
      - syncthing

  # Not sure if this is needed anymore - was used for installing casks
  - name: authenticate sudo
    ping:
    become: yes

  - name: install casks
    homebrew_cask:
      name:
        - 1password
        - 1password-cli
        - acorn
        - alfred
        - anki
        - arq
        - bartender
        - bitbar
        - daisydisk
        - dash
        - discord
        - fantastical
        - firefox-developer-edition
        - flotato
        # - font-atkinson-hyperlegible
        - font-fira-mono
        - font-hack
        - font-hasklig
        - font-source-code-pro
        - hammerspoon
        - kaleidoscope
        - macvim
        - mailmate
        # - netnewswire
        # - night-owl
        - obsidian
        - qlmarkdown
        - qlstephen
        - quicklook-csv
        - quicklook-json
        - signal
        - sf-symbols
        - slack
        - telegram
        - topnotch
        - transmit
        - twitterrific
        - vlc
        - zoom

  - name: fix QuickLook generators
    block:
      - command: xattr -cr ~/Library/QuickLook/{{ item }}.qlgenerator
        with_items:
          - QLMarkdown
          - QLStephen
      - command: qlmanage -r
      - command: qlmanage -r cache

  - name: install from app store
    command: mas install {{ item }}
    with_items:
      # - 451907568   # Paprika Recipe Manager
      # - 497799835   # Xcode
      - 904280696   # Things 3
      - 1028916583  # iPulse
      - 1522267256  # Shareful
      - 1529448980  # Reeder 5