- hosts: all
  tasks:
    - name: register keyboard_id
      shell: ioreg -n IOHIDKeyboard -r | grep -e VendorID\" -e ProductID | ruby -e 'print ARGF.read.scan(/\d+/).join(?-)'
      register: keyboard_id

    - name: s/caps lock/ctrl/
      command: defaults -currentHost write -g com.apple.keyboard.modifiermapping.{{ keyboard_id.stdout }}-0 -array-add '<dict><key>HIDKeyboardModifierMappingDst</key><integer>2</integer><key>HIDKeyboardModifierMappingSrc</key><integer>0</integer></dict>'

- hosts: all
  tasks:
    - name: register keyboard_id
      shell: ioreg -n IOHIDKeyboard -r | grep -e VendorID\" -e ProductID | ruby -e 'print ARGF.read.scan(/\d+/).join(?-)'
      register: keyboard_id

    - name: s/caps lock/ctrl/
      command: defaults -currentHost write -g com.apple.keyboard.modifiermapping.{{ keyboard_id.stdout }}-0 -array-add '<dict><key>HIDKeyboardModifierMappingDst</key><integer>2</integer><key>HIDKeyboardModifierMappingSrc</key><integer>0</integer></dict>'

    - name: install logitech options
      homebrew_cask: name=logitech-options state=installed

Install Logitech Options on the MBP
[ansible] Install Logitech Options on the MBP
