mirror of
https://github.com/geerlingguy/mac-dev-playbook
synced 2025-02-16 12:38:28 +00:00
commit
97956cdbdc
8 changed files with 85 additions and 4 deletions
|
@ -1,3 +1,5 @@
|
||||||
[defaults]
|
[defaults]
|
||||||
nocows = True
|
nocows = True
|
||||||
roles_path = ./roles:/etc/ansible/roles
|
roles_path = ./roles:/etc/ansible/roles
|
||||||
|
stdout_callback = yaml
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,31 @@ configure_dotfiles: true
|
||||||
configure_terminal: true
|
configure_terminal: true
|
||||||
configure_osx: 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'
|
||||||
|
|
||||||
|
dockitems_to_persist:
|
||||||
|
- name: "Google Chrome"
|
||||||
|
path: "/Applications/Google Chrome.app/"
|
||||||
|
- name: "Sublime Text"
|
||||||
|
path: "/Applications/Sublime Text.app/"
|
||||||
configure_sudoers: false
|
configure_sudoers: false
|
||||||
sudoers_custom_config: ''
|
sudoers_custom_config: ''
|
||||||
# Example:
|
# Example:
|
||||||
|
|
4
main.yml
4
main.yml
|
@ -37,6 +37,10 @@
|
||||||
- include_tasks: tasks/extra-packages.yml
|
- include_tasks: tasks/extra-packages.yml
|
||||||
tags: ['extra-packages']
|
tags: ['extra-packages']
|
||||||
|
|
||||||
|
- import_tasks: tasks/dock.yml
|
||||||
|
when: configure_dock
|
||||||
|
tags: ['dock']
|
||||||
|
|
||||||
- name: Run configured post-provision ansible task files.
|
- name: Run configured post-provision ansible task files.
|
||||||
include_tasks: "{{ outer_item }}"
|
include_tasks: "{{ outer_item }}"
|
||||||
loop_control:
|
loop_control:
|
||||||
|
|
13
tasks/adddock.yml
Normal file
13
tasks/adddock.yml
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
---
|
||||||
|
- name: find if dock {{ item }} exists
|
||||||
|
ansible.builtin.command:
|
||||||
|
cmd: 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 }} exists
|
||||||
|
ansible.builtin.command:
|
||||||
|
cmd: dockutil --add '{{ item.path }}'
|
||||||
|
when: dockitem_exists.rc >0
|
||||||
|
tags: ['dock']
|
22
tasks/dock.yml
Normal file
22
tasks/dock.yml
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
---
|
||||||
|
- 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: Ensure required dock items exist.
|
||||||
|
ansible.builtin.include_tasks: tasks/adddock.yml
|
||||||
|
with_items: "{{ dockitems_to_persist }}"
|
||||||
|
|
||||||
|
- 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 }}"
|
|
@ -5,7 +5,7 @@
|
||||||
arguments: "{{ item.name | default(item) }} {{ item.version | default('@stable') }}"
|
arguments: "{{ item.name | default(item) }} {{ item.version | default('@stable') }}"
|
||||||
# Ansible 2.4 supports `global_command` making `working_dir` optional.
|
# Ansible 2.4 supports `global_command` making `working_dir` optional.
|
||||||
working_dir: "{{ lookup('env', 'COMPOSER_HOME') | default('~/.composer', true) }}"
|
working_dir: "{{ lookup('env', 'COMPOSER_HOME') | default('~/.composer', true) }}"
|
||||||
with_items: "{{ composer_packages }}"
|
loop: "{{ composer_packages }}"
|
||||||
|
|
||||||
- name: Install global NPM packages.
|
- name: Install global NPM packages.
|
||||||
npm:
|
npm:
|
||||||
|
@ -14,7 +14,7 @@
|
||||||
version: "{{ item.version | default(omit) }}"
|
version: "{{ item.version | default(omit) }}"
|
||||||
global: true
|
global: true
|
||||||
executable: "{{ item.executable | default(omit) }}"
|
executable: "{{ item.executable | default(omit) }}"
|
||||||
with_items: "{{ npm_packages }}"
|
loop: "{{ npm_packages }}"
|
||||||
|
|
||||||
- name: Install global Pip packages.
|
- name: Install global Pip packages.
|
||||||
pip:
|
pip:
|
||||||
|
@ -22,7 +22,7 @@
|
||||||
state: "{{ item.state | default('present') }}"
|
state: "{{ item.state | default('present') }}"
|
||||||
version: "{{ item.version | default(omit) }}"
|
version: "{{ item.version | default(omit) }}"
|
||||||
executable: "{{ item.executable | default(omit) }}"
|
executable: "{{ item.executable | default(omit) }}"
|
||||||
with_items: "{{ pip_packages }}"
|
loop: "{{ pip_packages }}"
|
||||||
|
|
||||||
- name: Install global Ruby gems.
|
- name: Install global Ruby gems.
|
||||||
gem:
|
gem:
|
||||||
|
@ -31,4 +31,4 @@
|
||||||
version: "{{ item.version | default(omit) }}"
|
version: "{{ item.version | default(omit) }}"
|
||||||
user_install: false
|
user_install: false
|
||||||
executable: "{{ item.executable | default(omit) }}"
|
executable: "{{ item.executable | default(omit) }}"
|
||||||
with_items: "{{ gem_packages }}"
|
loop: "{{ gem_packages }}"
|
||||||
|
|
|
@ -3,3 +3,4 @@
|
||||||
- name: Run .osx dotfiles.
|
- name: Run .osx dotfiles.
|
||||||
command: "{{ osx_script }}"
|
command: "{{ osx_script }}"
|
||||||
changed_when: false
|
changed_when: false
|
||||||
|
tags: ['osx']
|
||||||
|
|
14
tasks/remdock.yml
Normal file
14
tasks/remdock.yml
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
---
|
||||||
|
- name: find if dock 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'
|
||||||
|
tags: ['dock']
|
||||||
|
|
||||||
|
- name: Ensure unwanted dock items removed.
|
||||||
|
ansible.builtin.command:
|
||||||
|
cmd: dockutil --remove '{{ item }}'
|
||||||
|
when: dockitem_exists.rc == 0
|
||||||
|
tags: ['dock']
|
Loading…
Add table
Reference in a new issue