Merge branch 'master' of github.com:dspolleke/mac-dev-playbook

This commit is contained in:
dspolleke 2021-04-11 20:03:50 +02:00
commit 58632588cd
9 changed files with 118 additions and 42 deletions

View file

@ -1,3 +1,5 @@
[defaults] [defaults]
nocows = True nocows = True
roles_path = ./roles:/etc/ansible/roles roles_path = ./roles:/etc/ansible/roles
inventory = inventory
become = true

31
bootstrap.sh Normal file
View file

@ -0,0 +1,31 @@
#!/bin/bash
alias python=python3
pyenv install --list | grep -Ev '[abc-]' | tail -1
python -V 2>&1 | awk '/Python/{ split($2, a, "."); print a[1]"."a[2] }'
if curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py ;
then
python get-pip.py
fi
export PATH="$HOME/Library/Python/${pyver}/bin/:$PATH"
python -m pip install --user ansible
xcode-select --install > /dev/null 2>&1
if [ "$?" == '0' ]; then
sleep 1
osascript <<EOD
tell application "System Events"
tell process "Install Command Line Developer Tools"
keystroke return
click button "Agree" of window "License Agreement"
end tell
end tell
EOD
else
echo "Command Line Developer Tools are already installed!"
fi
sudo systemsetup -setremotelogin on

View file

@ -2,8 +2,9 @@
downloads: ~/.ansible-downloads/ downloads: ~/.ansible-downloads/
configure_dotfiles: true configure_dotfiles: true
configure_terminal: true configure_terminal: false
configure_osx: true configure_osx: true
configure_dock: []
configure_sudoers: false configure_sudoers: false
sudoers_custom_config: '' sudoers_custom_config: ''
@ -12,7 +13,7 @@ sudoers_custom_config: ''
# # Allow users in admin group to use sudo with no password. # # Allow users in admin group to use sudo with no password.
# %admin ALL=(ALL) NOPASSWD: ALL # %admin ALL=(ALL) NOPASSWD: ALL
dotfiles_repo: https://github.com/geerlingguy/dotfiles.git dotfiles_repo: https://github.com/dspolleke/dotfiles.git
dotfiles_repo_accept_hostkey: true dotfiles_repo_accept_hostkey: true
dotfiles_repo_local_destination: ~/Development/GitHub/dotfiles dotfiles_repo_local_destination: ~/Development/GitHub/dotfiles
dotfiles_files: dotfiles_files:
@ -84,15 +85,15 @@ composer_packages: []
# - name: drush # - name: drush
# state: present # present/absent, default: present # state: present # present/absent, default: present
# version: "^8.1" # default: N/A # version: "^8.1" # default: N/A
gem_packages: [] gem_packages:
# - name: bundler - name: showoff
# state: present # present/absent/latest, default: present # state: present # present/absent/latest, default: present
# version: "~> 1.15.1" # default: N/A # version: "~> 1.15.1" # default: N/A
npm_packages: [] npm_packages: []
# - name: webpack # - name: webpack
# state: present # present/absent/latest, default: present # state: present # present/absent/latest, default: present
# version: "^2.6" # default: N/A # version: "^2.6" # default: N/A
pip_packages: [] #pip_packages: []
# - name: mkdocs # - name: mkdocs
# state: present # present/absent/latest, default: present # state: present # present/absent/latest, default: present
# version: "0.16.3" # default: N/A # version: "0.16.3" # default: N/A

View file

@ -1,2 +1,3 @@
[all] [all]
127.0.0.1 ansible_connection=local #127.0.0.1 ansible_connection=local
192.168.2.49

View file

@ -36,6 +36,14 @@
- include_tasks: tasks/extra-packages.yml - include_tasks: tasks/extra-packages.yml
tags: ['extra-packages'] tags: ['extra-packages']
- name: Install global Ruby gems.
gem:
name: "{{ item.name | default(item) }}"
state: "{{ item.state | default('present') }}"
version: "{{ item.version | default(omit) }}"
user_install: false
executable: "{{ item.executable | default(omit) }}"
loop: "{{ gem_packages }}"
- name: Run configured post-provision ansible task files. - name: Run configured post-provision ansible task files.
include_tasks: "{{ outer_item }}" include_tasks: "{{ outer_item }}"

View file

@ -3,3 +3,5 @@ roles:
- name: geerlingguy.dotfiles - name: geerlingguy.dotfiles
- name: geerlingguy.homebrew - name: geerlingguy.homebrew
- name: geerlingguy.mas - name: geerlingguy.mas
collections:
- name: community.general

20
tasks/dock.yml Normal file
View file

@ -0,0 +1,20 @@
---
- name: Install dockutil
homebrew:
name: dockutil
state: present
notify:
- Clear homebrew cache
- name: Remove all crap from Dock
shell: dockutil --remove '{{ item }}'
ignore_errors: true
with_items: "{{ dockitems_to_remove }}"
- name: Check if items in dock exist
shell: dockutil --find '{{ item.name }}' || dockutil --add '{{ item.path }}'
with_items: "{{ dockitems_to_persist }}"
- name: Fix order
shell: dockutil --move '{{ item.name }}' --position '{{ item.pos }}'
with_items: "{{ dockitems_to_persist }}"

View file

@ -1,34 +1,38 @@
--- ---
- name: Install global Composer packages. - name: Ensure extra packages are installed
composer: block:
command: "{{ (item.state | default('present') == 'absent') | ternary('remove', 'require') }}" - name: Install global Composer packages.
arguments: "{{ item.name | default(item) }} {{ item.version | default('@stable') }}" composer:
# Ansible 2.4 supports `global_command` making `working_dir` optional. command: "{{ (item.state | default('present') == 'absent') | ternary('remove', 'require') }}"
working_dir: "{{ lookup('env', 'COMPOSER_HOME') | default('~/.composer', true) }}" arguments: "{{ item.name | default(item) }} {{ item.version | default('@stable') }}"
with_items: "{{ composer_packages }}" # Ansible 2.4 supports `global_command` making `working_dir` optional.
working_dir: "{{ lookup('env', 'COMPOSER_HOME') | default('~/.composer', true) }}"
- name: Install global NPM packages. loop: "{{ composer_packages }}"
npm:
name: "{{ item.name | default(item) }}" - name: Install global NPM packages.
state: "{{ item.state | default('present') }}" ansible.builtin.npm:
version: "{{ item.version | default(omit) }}" name: "{{ item.name | default(item) }}"
global: true state: "{{ item.state | default('present') }}"
executable: "{{ item.executable | default(omit) }}" version: "{{ item.version | default(omit) }}"
with_items: "{{ npm_packages }}" global: true
executable: "{{ item.executable | default(omit) }}"
- name: Install global Pip packages. loop: "{{ npm_packages }}"
pip:
name: "{{ item.name | default(item) }}" - name: Install global Pip packages.
state: "{{ item.state | default('present') }}" ansible.builtin.pip:
version: "{{ item.version | default(omit) }}" name: "{{ item.name | default(item) }}"
executable: "{{ item.executable | default(omit) }}" state: "{{ item.state | default('present') }}"
with_items: "{{ pip_packages }}" version: "{{ item.version | default(omit) }}"
executable: "{{ pip_executable | default(omit) }}"
- name: Install global Ruby gems. loop: "{{ pip_packages }}"
gem:
name: "{{ item.name | default(item) }}" - name: Install global Ruby gems.
state: "{{ item.state | default('present') }}" ansible.builtin.gem:
version: "{{ item.version | default(omit) }}" name: "{{ item.name | default(item) }}"
user_install: false state: "{{ item.state | default('present') }}"
executable: "{{ item.executable | default(omit) }}" version: "{{ item.version | default(omit) }}"
with_items: "{{ gem_packages }}" user_install: false
install_dir: "{{ gem_dir }}"
executable: "{{ gem_executable | default(omit) }}"
loop: "{{ gem_packages }}"
tags: ['extra-packages']

View file

@ -6,9 +6,16 @@
changed_when: false changed_when: false
check_mode: false check_mode: false
- name: Ensure custom Terminal profile is added. - name: ensure JJG-Term
command: open files/terminal/JJG-Term.terminal block:
changed_when: false - name: transfer the file
copy:
src: files/terminal/JJG-Term.terminal
dest: /tmp/JJG-Term.terminal
- name: Ensure custom Terminal profile is added.
command: open /tmp/JJG-Term.terminal
changed_when: false
when: "'JJG-Term' not in terminal_theme.stdout" when: "'JJG-Term' not in terminal_theme.stdout"
# TODO: This doesn't work in Yosemite. Consider a different solution? # TODO: This doesn't work in Yosemite. Consider a different solution?