master
Raw Download raw file
  1--- 
  2- name: mf main.yml
  3  hosts: localhost
  4  gather_facts: True
  5  vars: 
  6    install_dir: "{{ ansible_env.HOME }}/.config/mf"
  7    wifi_ifname: "wlp170s0"
  8
  9  tasks:
 10   - name: apt update cache
 11     apt: 
 12       update_cache: True
 13       cache_valid_time: 1800 #30m
 14     become: True
 15
 16   - name: apt upgrade
 17     apt: 
 18       name: "*" 
 19       state: latest
 20       update_cache: True
 21       cache_valid_time: 1800 #30m
 22     become: True
 23
 24   - name: apt install tools
 25     apt: 
 26       update_cache: True
 27       cache_valid_time: 1800 #30m
 28       state: latest
 29       pkg:
 30       # system
 31       - pciutils
 32       - gdisk
 33       - psmisc
 34       - unzip
 35       - strace
 36       # wm 
 37       - sway
 38       - grim
 39       - slurp
 40       - imv
 41       - wl-clipboard
 42       - pipewire-audio
 43       # cli
 44       - kitty
 45       - tmux
 46       - htop
 47       - vim
 48       - git
 49       - git-lfs
 50       - magic-wormhole
 51       - file
 52       - tree
 53       - shellcheck
 54       # network
 55       - curl
 56       - dnsutils
 57       - mtr-tiny
 58       - firmware-iwlwifi
 59       - wpasupplicant
 60       # browser
 61       - firefox-esr
 62       # yubikey
 63       - gnupg2 
 64       - gnupg-agent
 65       - scdaemon
 66       - pcscd
 67       - pinentry-gnome3
 68       # recording
 69       - obs-studio 
 70       - xdg-desktop-portal
 71       - xdg-desktop-portal-wlr
 72     become: True
 73
 74   - name: home directory dirs
 75     file:
 76       path: "{{ ansible_env.HOME }}/{{ item }}"
 77       state: directory
 78     loop:
 79       - ".ssh"
 80       - ".config"
 81       - ".config/sway"
 82       - ".config/kitty"
 83       - ".local"
 84       - ".local/bin"
 85       - ".gnupg"
 86       - ".mozilla"
 87       - ".mozilla/firefox"
 88       - ".mozilla/firefox/{{ ansible_env.USER }}"
 89       - "git"
 90
 91   - name: binary installs (archives)
 92     unarchive:
 93       src: "{{ item.src }}"
 94       dest: "{{ item.dest }}"
 95       creates: "{{ item.creates }}"
 96       extra_opts: "{{ item.extra_opts | default([]) }}"
 97       include: "{{ item.include | default([]) }}"
 98       remote_src: True
 99     loop: 
100     - src: "https://github.com/charmbracelet/gum/releases/download/v0.12.0/gum_0.12.0_Linux_x86_64.tar.gz"
101       dest: "{{ ansible_env.HOME }}/.local/bin"
102       creates: "{{ ansible_env.HOME }}/.local/bin/gum"
103       include: 
104         - "gum"
105     - src: "https://github.com/neovim/neovim/releases/latest/download/nvim-linux64.tar.gz"
106       dest: "{{ ansible_env.HOME }}/.local"
107       creates: "{{ ansible_env.HOME }}/.local/bin/nvim"
108       extra_opts: 
109         - "--strip-components=1"
110     - src: "https://go.dev/dl/go1.22.0.linux-amd64.tar.gz"
111       dest: "{{ ansible_env.HOME }}/.local/"
112       creates: "{{ ansible_env.HOME }}/.local/go/bin/go"
113     - src: "https://github.com/casey/just/releases/download/1.24.0/just-1.24.0-x86_64-unknown-linux-musl.tar.gz"
114       dest: "{{ ansible_env.HOME }}/.local/bin"
115       creates: "{{ ansible_env.HOME }}/.local/bin/just"
116
117   - name: binary installs
118     get_url:
119       url: "{{ item.src }}"
120       dest: "{{ item.dest }}"
121     loop: 
122     - src: "https://dl.min.io/client/mc/release/linux-amd64/mc"
123       dest: "{{ ansible_env.HOME }}/.local/bin/mc"
124
125   - name: binary installs - chmod +x
126     file:
127       path: "{{ item.dest }}"
128       state: touch
129       mode: a+x
130     loop: 
131     - dest: "{{ ansible_env.HOME }}/.local/bin/mc"
132
133   - name: install nvm
134     shell: >
135       curl -o - https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
136     environment:
137       PROFILE: "/dev/null"
138     args:
139       executable: "/bin/bash"
140       chdir: "{{ ansible_env.HOME }}"
141       creates: "{{ ansible_env.HOME }}/.nvm/nvm.sh"
142
143   - name: install nvm
144     shell: >
145       . {{ ansible_env.HOME }}/.nvm/nvm.sh && nvm install --lts && nvm use --lts
146     args:
147       executable: "/bin/bash"
148       chdir: "{{ ansible_env.HOME }}"
149       creates: "{{ ansible_env.HOME }}.nvm/versions/"
150
151   - name: git repos
152     git:
153       repo: "https://github.com/nvim-lua/kickstart.nvim"
154       dest: "{{ ansible_env.HOME }}/.config/nvim"
155     ignore_errors: True # local modifcations
156
157
158   - name: home directory symlinks
159     file:
160       src: "{{ install_dir }}/files/{{ item.src }}"
161       dest: "{{ ansible_env.HOME }}/{{ item.dest }}"
162       force: True
163       state: "link"
164     loop:
165      - src: "tmux.conf"
166        dest: ".tmux.conf"
167      - src: "ssh_config"
168        dest: ".ssh/config"
169      - src: "fonts"
170        dest: ".fonts"
171      - src: "gpg-agent.conf"
172        dest: ".gnupg/gpg-agent.conf"
173      - src: "sway_config"
174        dest: ".config/sway/config"
175      - src: "sway_status.sh"
176        dest: ".config/sway/status.sh"
177      - src: "kitty_kitty.conf"
178        dest: ".config/kitty/kitty.conf"
179      - src: "kitty_theme.conf"
180        dest: ".config/kitty/theme.conf"
181      - src: "bashrc"
182        dest: ".bashrc"
183      - src: "gitconfig"
184        dest: ".gitconfig"
185      - src: "firefox_profiles.ini"
186        dest: ".mozilla/firefox/profiles.ini"
187      - src: "firefox_user.js"
188        dest: ".mozilla/firefox/{{ ansible_env.USER }}/user.js"
189      - src: "nvim_kickstarter_init.lua"
190        dest: ".config/nvim/init.lua"
191      # all bashrc_d files
192      - src: "bashrc_d"
193        dest: ".bashrc.d"
194
195   - name: wifi - config
196     copy:
197       src: "files/wpa_supplicant.conf"
198       dest: "/etc/wpa_supplicant/wpa_supplicant-{{ wifi_ifname }}.conf"
199     become: True
200
201   - name: wifi - systemd
202     systemd:
203       name: "wpa_supplicant@{{ wifi_ifname }}.service"
204       enabled: True
205     become: True
206
207   - name: alternatives - editor
208     alternatives:
209       name: editor
210       link: /usr/bin/editor
211       path: /usr/bin/vim.basic
212     become: True
213
214       #- name: reboot
215