From 4dc3e75de2268c9e3779e6ab9dc1aca4dbb3ae71 Mon Sep 17 00:00:00 2001 From: dspolleke Date: Sun, 11 Apr 2021 20:44:58 +0200 Subject: [PATCH] dock util from https://github.com/enlewof \n Fixed default value for variable, \ncreated block (for tags to work), \nFixed some strong language, \N fixed some shell / command preference (ansible-lint) --- default.config.yml | 2 ++ main.yml | 4 ++++ tasks/dock.yml | 23 +++++++++++++++++++++++ 3 files changed, 29 insertions(+) create mode 100644 tasks/dock.yml 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']