diff --git a/default.config.yml b/default.config.yml index 8293cc7..82effb6 100644 --- a/default.config.yml +++ b/default.config.yml @@ -5,6 +5,8 @@ configure_dotfiles: true configure_terminal: true configure_osx: true +configure_dock: [] + configure_sudoers: false sudoers_custom_config: '' # Example: diff --git a/main.yml b/main.yml index b35b077..75521fc 100644 --- a/main.yml +++ b/main.yml @@ -37,6 +37,10 @@ - include_tasks: tasks/extra-packages.yml tags: ['extra-packages'] + - include_tasks: tasks/dock.yml + when: configure_dock + tags: ['dock'] + - name: Run configured post-provision ansible task files. include_tasks: "{{ outer_item }}" loop_control: diff --git a/tasks/dock.yml b/tasks/dock.yml new file mode 100644 index 0000000..51c3a26 --- /dev/null +++ b/tasks/dock.yml @@ -0,0 +1,23 @@ +--- +- name: ensure dock items + block: + - name: Install dockutil + homebrew: + name: dockutil + state: present + notify: + - Clear homebrew cache + + - name: Ensure unwanted dock items removed. + command: dockutil --remove '{{ item }}' + ignore_errors: true + loop: "{{ dockitems_to_remove }}" + + - name: Ensure required dock items exist. + shell: dockutil --find '{{ item.name }}' || dockutil --add '{{ item.path }}' + loop: "{{ dockitems_to_persist }}" + + - name: Ensure correct dock order + command: dockutil --move '{{ item.name }}' --position '{{ item.pos }}' + loop: "{{ dockitems_to_persist }}" + tags: ['dock']