Fixes #116: Switch from roles and dock tasks to geerlingguy.mac collection.

This commit is contained in:
Jeff Geerling 2021-05-30 22:25:53 -05:00
parent 254d657147
commit b3fd01c991
6 changed files with 11 additions and 71 deletions

View file

@ -4,16 +4,7 @@
[![CI][badge-gh-actions]][link-gh-actions]
This playbook installs and configures most of the software I use on my Mac for web and software development. Some things in macOS are slightly difficult to automate, so I still have some manual installation steps, but at least it's all documented here.
This is a work in progress, and is mostly a means for me to document my current Mac's setup. I'll be evolving this playbook over time.
*See also*:
- [Boxen](https://github.com/boxen)
- [Battleschool](http://spencer.gibb.us/blog/2014/02/03/introducing-battleschool)
- [osxc](https://github.com/osxc)
- [MWGriffin/ansible-playbooks](https://github.com/MWGriffin/ansible-playbooks) (the original inspiration for this project)
This playbook installs and configures most of the software I use on my Mac for web and software development. Some things in macOS are slightly difficult to automate, so I still have a few manual installation steps, but at least it's all documented here.
## Installation

View file

@ -12,14 +12,18 @@
tags: ['always']
roles:
- role: geerlingguy.homebrew
- role: elliotweiser.osx-command-line-tools
- role: geerlingguy.mac.homebrew
tags: ['homebrew']
- role: geerlingguy.dotfiles
when: configure_dotfiles
tags: ['dotfiles']
- role: geerlingguy.mas
- role: geerlingguy.mac.mas
when: mas_installed_apps or mas_installed_app_ids
tags: ['mas']
- role: geerlingguy.mac.dock
when: configure_dock
tags: ['dock']
tasks:
- import_tasks: tasks/ansible-setup.yml
@ -40,10 +44,6 @@
- import_tasks: tasks/extra-packages.yml
tags: ['extra-packages']
- import_tasks: tasks/dock.yml
when: configure_dock
tags: ['dock']
- import_tasks: tasks/sublime-text.yml
when: configure_sublime
tags: ['sublime-text']

View file

@ -1,5 +1,7 @@
---
roles:
- name: elliotweiser.osx-command-line-tools
- name: geerlingguy.dotfiles
- name: geerlingguy.homebrew
- name: geerlingguy.mas
collections:
- name: geerlingguy.mac

View file

@ -1,14 +0,0 @@
---
- name: See if Dock item {{ item.name | default(item) }} exists.
ansible.builtin.command: "dockutil --find '{{ item.name }}'"
register: dockitem_exists
failed_when: >
"No such file or directory" in dockitem_exists.stdout
or "command not found" in dockitem_exists.stdout
changed_when: false
tags: ['dock']
- name: Ensure Dock item {{ item.name | default(item) }} exists.
ansible.builtin.command: "dockutil --add '{{ item.path }}'"
when: dockitem_exists.rc >0
tags: ['dock']

View file

@ -1,16 +0,0 @@
---
- name: See if dock item {{ 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
or "command not found" in dockitem_exists.stdout
tags: ['dock']
- name: Ensure Dock item {{ item }} is removed.
ansible.builtin.command:
cmd: dockutil --remove '{{ item }}'
when: dockitem_exists.rc == 0
tags: ['dock']

View file

@ -1,23 +0,0 @@
---
- name: Install dockutil.
homebrew:
name: dockutil
state: present
notify:
- Clear homebrew cache
- 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/dock-add.yml
loop: "{{ dockitems_persist }}"
- name: Ensure correct Dock order.
ansible.builtin.command:
cmd: dockutil --move '{{ item.name }}' --position '{{ item.pos }}'
when:
- item.pos is defined
- item.pos > 0
loop: "{{ dockitems_persist }}"