diff --git a/inventories/host_vars/macbook.yml b/inventories/host_vars/macbook.yml new file mode 100644 index 0000000..c09c6e0 --- /dev/null +++ b/inventories/host_vars/macbook.yml @@ -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 diff --git a/inventories/host_vars/networks.yml b/inventories/host_vars/networks.yml index 34967bc..a775fd2 100644 --- a/inventories/host_vars/networks.yml +++ b/inventories/host_vars/networks.yml @@ -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: diff --git a/inventories/hosts b/inventories/hosts index ad3bb92..6a8becc 100644 --- a/inventories/hosts +++ b/inventories/hosts @@ -18,3 +18,6 @@ [skylark] 192.168.1.200 ansible_user=hayato + +[macbook] +HayabookAir2023.hayaworld.local ansible_user=hayato diff --git a/macbook.yml b/macbook.yml new file mode 100644 index 0000000..e85391a --- /dev/null +++ b/macbook.yml @@ -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 diff --git a/tasks/macbook/brew.yml b/tasks/macbook/brew.yml new file mode 100644 index 0000000..e68a708 --- /dev/null +++ b/tasks/macbook/brew.yml @@ -0,0 +1,6 @@ +--- +- name: Install Macbook brew taps + ansible.builtin.homebrew: + name: "{{ item }}" + state: present + with_items: "{{ brew_taps }}" 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