automated_device_setup-ansible/macos.yml

122 lines
3.1 KiB
YAML
Raw Normal View History

2024-03-29 14:01:50 +00:00
---
- name: Install MacOS Packages
hosts: localhost
become: false
vars:
brew_cask_packages:
- audacity
- bitwarden
- blender
- brave-browser
- calibre
- discord
- firefox
- gimp
- inkscape
- iterm2
- jellyfin-media-player
- joplin
- kiwix
- libreoffice
- monero-wallet
- mpv
- nextcloud
- obs
- protonvpn
- retroarch
- signal
- the-unarchiver
- tor-browser
- transmission
- ultimaker-cura
- via
brew_packages:
- ansible
- ffmpeg
- fzf
- git
- htop
- irssi
- neovim
- newsboat
- nmap
- tmux
- yt-dlp
# python_modules:
# - configparser
# - pylint
# - virtualenv
upgrade_homebrew_packages: false
pre_tasks:
- name: Ensuring Homebrew Is Installed
stat:
path: /opt/homebrew/bin/brew
register: homebrew_check
- name: Fail If Homebrew Is Not Installed and install_homebrew_if_missing Is False
fail:
msg: Homebrew is missing...Install from http://brew.sh/
when:
- not homebrew_check.stat.exists
- name: Installing Homebrew
shell: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
when:
- not homebrew_check.stat.exists
tasks:
- name: Updating Homebrew
homebrew:
update_homebrew: true
when: homebrew_check.stat.exists
- name: Upgrading Homebrew Packages
homebrew:
upgrade_all: "{{ upgrade_homebrew_packages }}"
register: result
until: result is successful
when: homebrew_check.stat.exists
- name: Installing Homebrew Cask Packages
homebrew_cask:
name: "{{ brew_cask_packages }}"
state: present
register: result
until: result is successful
when: homebrew_check.stat.exists
- name: Installing Homebrew Packages
homebrew:
name: "{{ brew_packages }}"
state: present
register: result
until: result is successful
when: homebrew_check.stat.exists
# - name: Installing Python Modules
# pip:
# name: "{{ item }}"
# state: present
# with_items: '{{ python_modules }}'
# - name: Install xcode
# ansible.builtin.shell:
# cmd: sudo xcode-select --install
- name: Add cronjob to run weekly
ansible.builtin.cron:
name: "ansible"
minute: "28"
hour: "21"
job: "ansible-playbook /Users/admin/macos2.yml"
- name: Dock
ansible.builtin.shell: |
dockutil --remove all
dockutil --add /Applications/Firefox.app --position 1
dockutil --add /Applications/Thunderbird.app --position 2
dockutil --add /Applications/Joplin.app --position 3
dockutil --add /Applications/Signal.app --position 4
dockutil --add /Applications/Discord.app --position 5
dockutil --add /Applications/Calculator.app --position 6
dockutil --add /Applications/iTerm.app --position 7
dockutil --add "/Applications/System Settings.app" --position 8