Skip to content

Commit

Permalink
Merge pull request #73 from cradle8810/mac_20240421
Browse files Browse the repository at this point in the history
Mac用Ansible playbook
  • Loading branch information
cradle8810 authored Apr 21, 2024
2 parents 8435f91 + 081bb83 commit 58d9b9a
Show file tree
Hide file tree
Showing 6 changed files with 169 additions and 0 deletions.
109 changes: 109 additions & 0 deletions inventories/host_vars/macbook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
---

brew_taps:
- ansible
- cmigemo
- figlet
- gnupg
- htop
- imagemagick
- libaacs
- libde265
- libheif
- nkf
- p7zip
- pdftoipe
- toilet
- wget
- x264
- x265
- yt-dlp
- zsh

symlinks_user:
- src: /Volumes/RAMDisk
dest: ~/Downloads
owner: hayato
group: staff
- src: /Volumes/RAMDisk
dest: ~/RAMDisk
owner: hayato
group: staff
- src: "/Volumes/RAMDisk/.logs/"
dest: "~/Library/Logs"
owner: hayato
group: staff
- src: "/Volumes/RAMDisk/.Saved Application State"
dest: "~/Library/Saved Application State"
owner: hayato
group: staff
- src: "/Volumes/RAMDisk/.cache/com.overmacs.photosweeperpaddle/"
dest: "~/Library/Application Support/com.overmacs.photosweeperpaddle"
owner: hayato
group: staff
- src: "/Volumes/RAMDisk"
dest: "~/Library/Application Support/iMazing/Library/Apps"
owner: hayato
group: staff
- src: "/Volumes/RAMDisk/.cache/Chrome/Sync Data/"
dest: "~/Library/Application Support/Google/Chrome/Default/Sync Data"
owner: hayato
group: staff
- src: "/Volumes/RAMDisk/.cache/com.overmacs.photosweeperpaddle/"
dest: "~/Library/Application Support/PhotoSweeper X"
owner: hayato
group: staff
- src: "/Volumes/RAMDisk/.Saved Application State"
dest: "~/Library/Saved Application State"
owner: hayato
group: staff
- src: "/Volumes/RAMDisk/.logs/"
dest: "~/Library/Logs"
owner: hayato
group: staff
- src: "/Volumes/RAMDisk/.cache/QuickLook"
dest: "~/Library/Caches/QuickLook32"
owner: hayato
group: staff
- src: "/Volumes/RAMDisk/.cache/com.overmacs.photosweeperpaddle"
dest: "~/Library/Caches/com.overmacs.photosweeperpaddle"
owner: hayato
group: staff
- src: "/Volumes/RAMDisk/.cache/QuickLook"
dest: "~/Library/Caches/QuickLook"
owner: hayato
group: staff
- src: "/Volumes/RAMDisk/.cache/Chrome/"
dest: "~/Library/Caches/Google/Chrome"
owner: hayato
group: staff
- src: "/Volumes/RAMDisk/.cache/Homebrew/"
dest: "~/Library/Caches/Homebrew/downloads"
owner: hayato
group: staff
- src: "/Volumes/Home/Symlinks/BookMaker/"
dest: "~/Library/Application Support/Plustek/BookMaker"
owner: hayato
group: staff
- src: "/Volumes/Home/Symlinks/Sessions/"
dest: "~/Library/Application Support/Google/Chrome/Default/Sessions"
owner: hayato
group: staff
- src: "/Volumes/Home/Symlinks/CDAT/"
dest: "~/Documents/.CDAT"
owner: hayato
group: staff
- src: "/Volumes/RAMDisk/.cache/Homebrew/"
dest: "~/Library/Caches/Homebrew/Downloads"
owner: hayato
group: staff
- src: "/Volumes/RAMDisk/.cache/qlmanage/"
dest: "$TMPDIR/../C/com.apple.quicklook.ThumbnailsAgent"
owner: hayato
group: staff

symlinks_system:
- src: /Volumes/RAMDisk/.logs
dest: /private/var/logs
owner: root
group: wheel
2 changes: 2 additions & 0 deletions inventories/host_vars/networks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ network:
hostname: skylark.hayaworld.local
interface: ens160
ipv4: 192.168.1.200
macbook:
hostname: HayabookAir2023.hayaworld.local
subnet: 24
gw4: 192.168.1.1
dns4:
Expand Down
3 changes: 3 additions & 0 deletions inventories/hosts
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@

[skylark]
192.168.1.200 ansible_user=hayato

[macbook]
HayabookAir2023.hayaworld.local ansible_user=hayato
23 changes: 23 additions & 0 deletions macbook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
- hosts: macbook
connection: local
remote_user: hayato
gather_facts: false

vars_files:
- inventories/host_vars/macbook.yml
- inventories/host_vars/networks.yml

handlers:
- include: handlers/main.yml

tasks:
- name: Set Hostname
ansible.builtin.hostname:
name: "{{ network.macbook.hostname }}"
become: true
tags:
- network

- import_tasks: tasks/macbook/brew.yml
- import_tasks: tasks/macbook/symlinks.yml
6 changes: 6 additions & 0 deletions tasks/macbook/brew.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
- name: Install Macbook brew taps
ansible.builtin.homebrew:
name: "{{ item }}"
state: present
with_items: "{{ brew_taps }}"
26 changes: 26 additions & 0 deletions tasks/macbook/symlinks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
- name: Make symlinks for User
ansible.builtin.file:
src: "{{ item['src'] }}"
dest: "{{ item['dest'] }}"
owner: "{{ item['owner'] }}"
group: "{{ item['group'] }}"
state: link
follow: false
loop: "{{ symlinks_user }}"
tags:
- symlink

- name: Make symlinks for System (BECOME)
ansible.builtin.file:
src: "{{ item['src'] }}"
dest: "{{ item['dest'] }}"
owner: "{{ item['owner'] }}"
group: "{{ item['group'] }}"
state: link
follow: false
loop: "{{ symlinks_system }}"
become: true
tags:
- symlink

0 comments on commit 58d9b9a

Please sign in to comment.