mirror of
https://github.com/geerlingguy/mac-dev-playbook
synced 2024-11-21 19:33:03 +00:00
working dockutil
This commit is contained in:
parent
4dc3e75de2
commit
299c9b7b69
5 changed files with 62 additions and 9 deletions
|
@ -1,3 +1,5 @@
|
|||
[defaults]
|
||||
nocows = True
|
||||
roles_path = ./roles:/etc/ansible/roles
|
||||
stdout_callback = yaml
|
||||
|
||||
|
|
|
@ -5,8 +5,29 @@ configure_dotfiles: true
|
|||
configure_terminal: true
|
||||
configure_osx: true
|
||||
|
||||
configure_dock: []
|
||||
|
||||
configure_dock: True
|
||||
dockitems_to_remove:
|
||||
- Launchpad
|
||||
- Safari
|
||||
- Messages
|
||||
- Mail
|
||||
- Maps
|
||||
- Photos
|
||||
- FaceTime
|
||||
- Calendar
|
||||
- Contacts
|
||||
- Reminders
|
||||
- Notes
|
||||
- TV
|
||||
- Music
|
||||
- Podcasts
|
||||
- 'App Store'
|
||||
remove_spacers: true
|
||||
dockitems_to_persist:
|
||||
- name: iTerm
|
||||
path: "/Applications/iTerm.app/"
|
||||
- name: "Google Chrome"
|
||||
path: "/Applications/Google Chrome.app/"
|
||||
configure_sudoers: false
|
||||
sudoers_custom_config: ''
|
||||
# Example:
|
||||
|
|
13
tasks/adddock.yml
Normal file
13
tasks/adddock.yml
Normal file
|
@ -0,0 +1,13 @@
|
|||
---
|
||||
- name: find if dock {{ item }} exists
|
||||
ansible.builtin.command:
|
||||
cmd: dockutil --find '{{ item.name }}'
|
||||
register: dockitem_exists
|
||||
failed_when: '"No such file or directory" in dockitem_exists.stdout'
|
||||
changed_when: false
|
||||
tags: ['dock']
|
||||
- name: Ensure dock {{ item }} exists
|
||||
ansible.builtin.command:
|
||||
cmd: dockutil --add '{{ item.path }}'
|
||||
when: dockitem_exists.rc >0
|
||||
tags: ['dock']
|
|
@ -7,17 +7,20 @@
|
|||
state: present
|
||||
notify:
|
||||
- Clear homebrew cache
|
||||
|
||||
- name: Ensure unwanted dock items removed.
|
||||
command: dockutil --remove '{{ item }}'
|
||||
ignore_errors: true
|
||||
- name: remove dockitems
|
||||
ansible.builtin.include_tasks: tasks/remdock.yml
|
||||
loop: "{{ dockitems_to_remove }}"
|
||||
|
||||
- name: Ensure required dock items exist.
|
||||
shell: dockutil --find '{{ item.name }}' || dockutil --add '{{ item.path }}'
|
||||
loop: "{{ dockitems_to_persist }}"
|
||||
ansible.builtin.include_tasks: tasks/adddock.yml
|
||||
with_items: "{{ dockitems_to_persist }}"
|
||||
|
||||
- name: Ensure correct dock order
|
||||
command: dockutil --move '{{ item.name }}' --position '{{ item.pos }}'
|
||||
ansible.builtin.command:
|
||||
cmd: dockutil --move '{{ item.name }}' --position '{{ item.pos }}'
|
||||
when:
|
||||
- item.pos is defined
|
||||
- item.pos length >0
|
||||
loop: "{{ dockitems_to_persist }}"
|
||||
|
||||
tags: ['dock']
|
||||
|
|
14
tasks/remdock.yml
Normal file
14
tasks/remdock.yml
Normal file
|
@ -0,0 +1,14 @@
|
|||
---
|
||||
- name: find if dock item exists
|
||||
ansible.builtin.command:
|
||||
cmd: dockutil --find '{{ item }}'
|
||||
register: dockitem_exists
|
||||
changed_when: false
|
||||
failed_when: '"No such file or directory" in dockitem_exists.stdout'
|
||||
tags: ['dock']
|
||||
- name: Ensure unwanted dock items removed.
|
||||
ansible.builtin.command:
|
||||
cmd: dockutil --remove '{{ item }}'
|
||||
when: dockitem_exists.rc == 0
|
||||
tags: ['dock']
|
||||
|
Loading…
Reference in a new issue