mirror of
https://github.com/geerlingguy/mac-dev-playbook
synced 2024-11-10 06:14:12 +00:00
PR #106 follow-up: More consistent docs and examples.
This commit is contained in:
parent
97956cdbdc
commit
f9f2d54e8c
9 changed files with 40 additions and 52 deletions
|
@ -81,6 +81,10 @@ You can override any of the defaults configured in `default.config.yml` by creat
|
||||||
|
|
||||||
pip_packages:
|
pip_packages:
|
||||||
- name: mkdocs
|
- 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.
|
Any variable can be overridden in `config.yml`; see the supporting roles' documentation for a complete list of available variables.
|
||||||
|
|
||||||
|
|
|
@ -2,4 +2,3 @@
|
||||||
nocows = True
|
nocows = True
|
||||||
roles_path = ./roles:/etc/ansible/roles
|
roles_path = ./roles:/etc/ansible/roles
|
||||||
stdout_callback = yaml
|
stdout_callback = yaml
|
||||||
|
|
||||||
|
|
|
@ -5,31 +5,17 @@ configure_dotfiles: true
|
||||||
configure_terminal: true
|
configure_terminal: true
|
||||||
configure_osx: true
|
configure_osx: true
|
||||||
|
|
||||||
configure_dock: []
|
# Set to 'true' to configure the Dock via dockutil.
|
||||||
dockitems_to_remove: []
|
configure_dock: false
|
||||||
# Example: to remove all / some items added by default on Big Sur uncomment use example below
|
dockitems_remove: []
|
||||||
# dockitems_to_remove:
|
# - Launchpad
|
||||||
# - Launchpad
|
# - TV
|
||||||
# - Safari
|
# - Podcasts
|
||||||
# - Messages
|
# - 'App Store'
|
||||||
# - Mail
|
dockitems_persist: []
|
||||||
# - Maps
|
# - name: "Sublime Text"
|
||||||
# - Photos
|
# path: "/Applications/Sublime Text.app/"
|
||||||
# - 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:
|
||||||
|
|
10
main.yml
10
main.yml
|
@ -22,19 +22,19 @@
|
||||||
tags: ['mas']
|
tags: ['mas']
|
||||||
|
|
||||||
tasks:
|
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
|
when: configure_sudoers
|
||||||
|
|
||||||
- include_tasks: tasks/terminal.yml
|
- import_tasks: tasks/terminal.yml
|
||||||
when: configure_terminal
|
when: configure_terminal
|
||||||
|
|
||||||
- include_tasks: tasks/osx.yml
|
- import_tasks: tasks/osx.yml
|
||||||
when: configure_osx
|
when: configure_osx
|
||||||
tags: ['osx']
|
tags: ['osx']
|
||||||
|
|
||||||
- include_tasks: tasks/extra-packages.yml
|
- import_tasks: tasks/extra-packages.yml
|
||||||
tags: ['extra-packages']
|
tags: ['extra-packages']
|
||||||
|
|
||||||
- import_tasks: tasks/dock.yml
|
- import_tasks: tasks/dock.yml
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
---
|
|
||||||
- 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']
|
|
12
tasks/dock-add.yml
Normal file
12
tasks/dock-add.yml
Normal file
|
@ -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']
|
|
@ -1,22 +1,23 @@
|
||||||
---
|
---
|
||||||
- name: Install dockutil
|
- name: Install dockutil.
|
||||||
homebrew:
|
homebrew:
|
||||||
name: dockutil
|
name: dockutil
|
||||||
state: present
|
state: present
|
||||||
notify:
|
notify:
|
||||||
- Clear homebrew cache
|
- Clear homebrew cache
|
||||||
- name: remove dockitems
|
|
||||||
ansible.builtin.include_tasks: tasks/remdock.yml
|
- name: Remove configured Dock items.
|
||||||
loop: "{{ dockitems_to_remove }}"
|
ansible.builtin.include_tasks: tasks/dock-remove.yml
|
||||||
|
loop: "{{ dockitems_remove }}"
|
||||||
|
|
||||||
- name: Ensure required dock items exist.
|
- name: Ensure required dock items exist.
|
||||||
ansible.builtin.include_tasks: tasks/adddock.yml
|
ansible.builtin.include_tasks: tasks/dock-add.yml
|
||||||
with_items: "{{ dockitems_to_persist }}"
|
loop: "{{ dockitems_persist }}"
|
||||||
|
|
||||||
- name: Ensure correct dock order
|
- name: Ensure correct Dock order.
|
||||||
ansible.builtin.command:
|
ansible.builtin.command:
|
||||||
cmd: dockutil --move '{{ item.name }}' --position '{{ item.pos }}'
|
cmd: dockutil --move '{{ item.name }}' --position '{{ item.pos }}'
|
||||||
when:
|
when:
|
||||||
- item.pos is defined
|
- item.pos is defined
|
||||||
- item.pos length >0
|
- item.pos length >0
|
||||||
loop: "{{ dockitems_to_persist }}"
|
loop: "{{ dockitems_persist }}"
|
||||||
|
|
|
@ -3,4 +3,3 @@
|
||||||
- name: Run .osx dotfiles.
|
- name: Run .osx dotfiles.
|
||||||
command: "{{ osx_script }}"
|
command: "{{ osx_script }}"
|
||||||
changed_when: false
|
changed_when: false
|
||||||
tags: ['osx']
|
|
||||||
|
|
Loading…
Reference in a new issue