Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
fubarhouse committed Oct 31, 2016
0 parents commit 1c39f40
Show file tree
Hide file tree
Showing 9 changed files with 205 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
language: python
python: "2.7"

# Use the new container infrastructure
sudo: false

# Install ansible
addons:
apt:
packages:
- python-pip

install:
# Install ansible
- pip install ansible

# Check ansible version
- ansible --version

# Create ansible.cfg with correct roles_path
- printf '[defaults]\nroles_path=../' >ansible.cfg

script:
# Basic role syntax check
- ansible-playbook tests/test.yml -i tests/inventory --syntax-check

notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/
77 changes: 77 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Ansible Role: Dockutil

[![Build Status](https://travis-ci.org/fubarhouse/ansible-role-macdock.svg?branch=master)](https://travis-ci.org/fubarhouse/ansible-role-macdock)

Install [Dockutil](https://github.com/kcrawford/dockutil) and remove, add and and rotate items on OSX's dock on macOS.

## Requirements

- Homebrew

## Role Variables

Dock items to remove:

````
dockitems_disabled:
- Launchpad
- Mail
- Safari
- Contacts
- Notes
- Reminders
- Maps
- Photos
- Messages
- FaceTime
- iTunes
- iBooks
- App Store
- System Preferences
- Calendar
- Terminal
````

Dock items to add, including name, path and weight/position:

````
dockitems_enabled:
- name: Google Chrome
path: "/Applications/Google Chrome.app"
pos: 1
- name: Tower
path: "/Applications/Tower.app"
pos: 2
- name: FirefoxDeveloperEdition
path: "/Applications/FirefoxDeveloperEdition.app"
pos: 3
- name: Sublime Text
path: "/Applications/Sublime Text.app"
pos: 4
- name: iTerm
path: "/Applications/iTerm.app"
pos: 5
- name: TeamViewer
path: "/Applications/TeamViewer.app"
pos: 6
````

## Dependencies

None.

## Example Playbook

````
- hosts: localhost
roles:
- fubarhouse.macdock
````

## License

MIT / BSD

## Author Information

This role was created in 2016 by [Karl Hepworth](twitter.com/fubarhouse).
45 changes: 45 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---

#
# Dockutil
#
# To manage dock items.
#

dockitems_disabled:
- Launchpad
- Mail
- Safari
- Contacts
- Notes
- Reminders
- Maps
- Photos
- Messages
- FaceTime
- iTunes
- iBooks
- App Store
- System Preferences
- Calendar
- Terminal

dockitems_enabled:
- name: Google Chrome
path: "/Applications/Google Chrome.app"
pos: 1
- name: Tower
path: "/Applications/Tower.app"
pos: 2
- name: FirefoxDeveloperEdition
path: "/Applications/FirefoxDeveloperEdition.app"
pos: 3
- name: Sublime Text
path: "/Applications/Sublime Text.app"
pos: 4
- name: iTerm
path: "/Applications/iTerm.app"
pos: 5
- name: TeamViewer
path: "/Applications/TeamViewer.app"
pos: 6
2 changes: 2 additions & 0 deletions handlers/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
# handlers file for fubarhouse.macdock
22 changes: 22 additions & 0 deletions meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
galaxy_info:
author: Karl Hepworth
description: Installs and uses dockutil to remove, add and rearrange dock items
# issue_tracker_url: http://example.com/issue/tracker
license: MIT
min_ansible_version: 2.1
platforms:
- name: MacOSX
versions:
- all
- 10.10
- 10.11
- 10.12
- 10.7
- 10.8
- 10.9
galaxy_tags:
- mac
- apple
- dock
- dockutil
dependencies: []
22 changes: 22 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---

- name: Dockutil | Ensure installed.
homebrew:
name: "dockutil"
state: present

- name: Dockutil | Remove all unwanted dock items
shell: dockutil --remove "{{ item }}"
ignore_errors: true
with_items: "{{ dockitems_disabled }}"
when: "{{ dockitems_disabled | length > 0 }}"

- name: Dockutil | Adding items
shell: dockutil --find "{{ item.name }}" || dockutil --add "{{ item.path }}"
with_items: "{{ dockitems_enabled }}"
when: "{{ dockitems_enabled | length > 0 }}"

- name: Dockutil | Moving items
shell: dockutil --move "{{ item.name }}" --position "{{ item.pos }}"
with_items: "{{ dockitems_enabled }}"
when: "{{ dockitems_enabled | length > 0 }}"
1 change: 1 addition & 0 deletions tests/inventory
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
localhost
5 changes: 5 additions & 0 deletions tests/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
- hosts: localhost
remote_user: root
roles:
- fubarhouse.macdock
2 changes: 2 additions & 0 deletions vars/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
# vars file for fubarhouse.macdock

0 comments on commit 1c39f40

Please sign in to comment.