Skip to content

Commit

Permalink
PR geerlingguy#106 follow-up: More consistent docs and examples.
Browse files Browse the repository at this point in the history
  • Loading branch information
geerlingguy committed May 7, 2021
1 parent 0065e5a commit 4c11406
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 52 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ You can override any of the defaults configured in `default.config.yml` by creat

pip_packages:
- name: mkdocs

configure_dock: true
dockitems_remove: []
dockitems_persist: []

Any variable can be overridden in `config.yml`; see the supporting roles' documentation for a complete list of available variables.

Expand Down
1 change: 0 additions & 1 deletion ansible.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@
nocows = True
roles_path = ./roles:/etc/ansible/roles
stdout_callback = yaml

34 changes: 10 additions & 24 deletions default.config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,17 @@ configure_dotfiles: true
configure_terminal: true
configure_osx: true

configure_dock: []
dockitems_to_remove: []
# Example: to remove all / some items added by default on Big Sur uncomment use example below
# dockitems_to_remove:
# - Launchpad
# - Safari
# - Messages
# - Mail
# - Maps
# - Photos
# - FaceTime
# - Calendar
# - Contacts
# - Reminders
# - Notes
# - TV
# - Music
# - Podcasts
# - 'App Store'
# Set to 'true' to configure the Dock via dockutil.
configure_dock: false
dockitems_remove: []
# - Launchpad
# - TV
# - Podcasts
# - 'App Store'
dockitems_persist: []
# - name: "Sublime Text"
# path: "/Applications/Sublime Text.app/"

dockitems_to_persist:
- name: "Google Chrome"
path: "/Applications/Google Chrome.app/"
- name: "Sublime Text"
path: "/Applications/Sublime Text.app/"
configure_sudoers: false
sudoers_custom_config: ''
# Example:
Expand Down
10 changes: 5 additions & 5 deletions main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,19 @@
tags: ['mas']

tasks:
- include_tasks: tasks/ansible-setup.yml
- import_tasks: tasks/ansible-setup.yml

- include_tasks: tasks/sudoers.yml
- import_tasks: tasks/sudoers.yml
when: configure_sudoers

- include_tasks: tasks/terminal.yml
- import_tasks: tasks/terminal.yml
when: configure_terminal

- include_tasks: tasks/osx.yml
- import_tasks: tasks/osx.yml
when: configure_osx
tags: ['osx']

- include_tasks: tasks/extra-packages.yml
- import_tasks: tasks/extra-packages.yml
tags: ['extra-packages']

- import_tasks: tasks/dock.yml
Expand Down
13 changes: 0 additions & 13 deletions tasks/adddock.yml

This file was deleted.

12 changes: 12 additions & 0 deletions tasks/dock-add.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
- name: See if Dock item {{ item }} exists.
ansible.builtin.command: "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 {{ item }} exists.
ansible.builtin.command: "dockutil --add '{{ item.path }}'"
when: dockitem_exists.rc >0
tags: ['dock']
File renamed without changes.
17 changes: 9 additions & 8 deletions tasks/dock.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
---
- name: Install dockutil
- name: Install dockutil.
homebrew:
name: dockutil
state: present
notify:
- Clear homebrew cache
- name: remove dockitems
ansible.builtin.include_tasks: tasks/remdock.yml
loop: "{{ dockitems_to_remove }}"

- name: Remove configured Dock items.
ansible.builtin.include_tasks: tasks/dock-remove.yml
loop: "{{ dockitems_remove }}"

- name: Ensure required dock items exist.
ansible.builtin.include_tasks: tasks/adddock.yml
with_items: "{{ dockitems_to_persist }}"
ansible.builtin.include_tasks: tasks/dock-add.yml
loop: "{{ dockitems_persist }}"

- name: Ensure correct dock order
- name: Ensure correct Dock order.
ansible.builtin.command:
cmd: dockutil --move '{{ item.name }}' --position '{{ item.pos }}'
when:
- item.pos is defined
- item.pos length >0
loop: "{{ dockitems_to_persist }}"
loop: "{{ dockitems_persist }}"
1 change: 0 additions & 1 deletion tasks/osx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@
- name: Run .osx dotfiles.
command: "{{ osx_script }}"
changed_when: false
tags: ['osx']

0 comments on commit 4c11406

Please sign in to comment.