From 934ba2ba2bc63ab1f52b821fd63f7472fcdf559d Mon Sep 17 00:00:00 2001 From: Hayato Date: Sun, 21 Apr 2024 23:48:24 +0900 Subject: [PATCH] Add make symlinks for macbook --- inventories/host_vars/macbook.yml | 88 +++++++++++++++++++++++++++++++ macbook.yml | 1 + tasks/macbook/symlinks.yml | 26 +++++++++ 3 files changed, 115 insertions(+) create mode 100644 tasks/macbook/symlinks.yml diff --git a/inventories/host_vars/macbook.yml b/inventories/host_vars/macbook.yml index f067f59..f7903d2 100644 --- a/inventories/host_vars/macbook.yml +++ b/inventories/host_vars/macbook.yml @@ -18,3 +18,91 @@ brew_taps: - 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: "/var/folders/fj/c3srpxpx41q080qnz4s_p1400000gn/C/com.apple.quicklook.ThumbnailsAgent" + owner: hayato + group: staff + +symlinks_system: + - src: /Volumes/RAMDisk/.logs + dest: /private/var/logs + owner: root + group: wheel diff --git a/macbook.yml b/macbook.yml index 34170df..e85391a 100644 --- a/macbook.yml +++ b/macbook.yml @@ -20,3 +20,4 @@ - network - import_tasks: tasks/macbook/brew.yml + - import_tasks: tasks/macbook/symlinks.yml diff --git a/tasks/macbook/symlinks.yml b/tasks/macbook/symlinks.yml new file mode 100644 index 0000000..a380f1f --- /dev/null +++ b/tasks/macbook/symlinks.yml @@ -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 + \ No newline at end of file