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]
nocows = True
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/
configure_dotfiles: true
configure_terminal: true
configure_terminal: false
configure_osx: true
configure_dock: []
configure_sudoers: false
sudoers_custom_config: ''
@ -12,7 +13,7 @@ sudoers_custom_config: ''
# # Allow users in admin group to use sudo with no password.
# %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_local_destination: ~/Development/GitHub/dotfiles
dotfiles_files:
@ -84,15 +85,15 @@ composer_packages: []
# - name: drush
# state: present # present/absent, default: present
# version: "^8.1" # default: N/A
gem_packages: []
# - name: bundler
gem_packages:
- name: showoff
# state: present # present/absent/latest, default: present
# version: "~> 1.15.1" # default: N/A
npm_packages: []
# - name: webpack
# state: present # present/absent/latest, default: present
# version: "^2.6" # default: N/A
pip_packages: []
#pip_packages: []
# - name: mkdocs
# state: present # present/absent/latest, default: present
# version: "0.16.3" # default: N/A

View file

@ -1,2 +1,3 @@
[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
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.
include_tasks: "{{ outer_item }}"

View file

@ -3,3 +3,5 @@ roles:
- name: geerlingguy.dotfiles
- name: geerlingguy.homebrew
- 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.
composer:
command: "{{ (item.state | default('present') == 'absent') | ternary('remove', 'require') }}"
arguments: "{{ item.name | default(item) }} {{ item.version | default('@stable') }}"
# Ansible 2.4 supports `global_command` making `working_dir` optional.
working_dir: "{{ lookup('env', 'COMPOSER_HOME') | default('~/.composer', true) }}"
with_items: "{{ composer_packages }}"
- name: Install global NPM packages.
npm:
name: "{{ item.name | default(item) }}"
state: "{{ item.state | default('present') }}"
version: "{{ item.version | default(omit) }}"
global: true
executable: "{{ item.executable | default(omit) }}"
with_items: "{{ npm_packages }}"
- name: Install global Pip packages.
pip:
name: "{{ item.name | default(item) }}"
state: "{{ item.state | default('present') }}"
version: "{{ item.version | default(omit) }}"
executable: "{{ item.executable | default(omit) }}"
with_items: "{{ pip_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) }}"
with_items: "{{ gem_packages }}"
- name: Ensure extra packages are installed
block:
- name: Install global Composer packages.
composer:
command: "{{ (item.state | default('present') == 'absent') | ternary('remove', 'require') }}"
arguments: "{{ item.name | default(item) }} {{ item.version | default('@stable') }}"
# Ansible 2.4 supports `global_command` making `working_dir` optional.
working_dir: "{{ lookup('env', 'COMPOSER_HOME') | default('~/.composer', true) }}"
loop: "{{ composer_packages }}"
- name: Install global NPM packages.
ansible.builtin.npm:
name: "{{ item.name | default(item) }}"
state: "{{ item.state | default('present') }}"
version: "{{ item.version | default(omit) }}"
global: true
executable: "{{ item.executable | default(omit) }}"
loop: "{{ npm_packages }}"
- name: Install global Pip packages.
ansible.builtin.pip:
name: "{{ item.name | default(item) }}"
state: "{{ item.state | default('present') }}"
version: "{{ item.version | default(omit) }}"
executable: "{{ pip_executable | default(omit) }}"
loop: "{{ pip_packages }}"
- name: Install global Ruby gems.
ansible.builtin.gem:
name: "{{ item.name | default(item) }}"
state: "{{ item.state | default('present') }}"
version: "{{ item.version | default(omit) }}"
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
check_mode: false
- name: Ensure custom Terminal profile is added.
command: open files/terminal/JJG-Term.terminal
changed_when: false
- name: ensure JJG-Term
block:
- 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"
# TODO: This doesn't work in Yosemite. Consider a different solution?