Compare commits

...

7 Commits

8 changed files with 206 additions and 198 deletions

9
.gitmodules vendored
View File

@@ -4,3 +4,12 @@
[submodule "ansible_roles/firefox"] [submodule "ansible_roles/firefox"]
path = ansible_roles/firefox path = ansible_roles/firefox
url = https://github.com/staticdev/ansible-role-firefox url = https://github.com/staticdev/ansible-role-firefox
[submodule "pkgbuilds/spotify"]
path = pkgbuilds/spotify
url = https://aur.archlinux.org/spotify.git
[submodule "pkgbuilds/archlinux-java-run"]
path = pkgbuilds/archlinux-java-run
url = https://aur.archlinux.org/archlinux-java-run.git
[submodule "pkgbuilds/portfolio"]
path = pkgbuilds/portfolio
url = https://aur.archlinux.org/portfolio.git

14
bin/pass Executable file
View File

@@ -0,0 +1,14 @@
#!/usr/bin/env bash
set -o nounset
set -o errexit
if [[ ! -e ~/.password-store ]] ; then
printf '%s\n' 'This is the first time running pass, initializting repository ...'
git clone ssh://git@code.hkoerber.de:2222/hannes/passwordstore.git ~/.password-store
printf '%s\n' 'Done'
fi
command -p pass "${@}"

1
pkgbuilds/portfolio Submodule

Submodule pkgbuilds/portfolio added at 81c063c618

1
pkgbuilds/spotify Submodule

Submodule pkgbuilds/spotify added at 6534d04e7a

View File

@@ -161,19 +161,6 @@
tags: [dotfiles-directory] tags: [dotfiles-directory]
- block: - block:
- name: install sudo
package:
state: present
name: sudo
- name: install dependencies for paru
package:
state: present
name:
- base-devel
- git
become: true
- name: create build user on arch - name: create build user on arch
user: user:
name: makepkg name: makepkg
@@ -183,71 +170,153 @@
system: true system: true
become: true become: true
- name: create paru user on arch - set_fact:
user: aur_packages:
name: paru # dependency of portfolio
home: /var/lib/paru - name: archlinux-java-run
create_home: true dependencies:
shell: /bin/bash - 'bash'
system: true - 'java-runtime-common'
version: 10-1
arch: any
- name: portfolio
dependencies:
- 'maven'
- 'java-environment=17'
- 'gendesk'
- 'webkit2gtk'
version: 0.68.3-1
arch: x86_64
- name: spotify
dependencies:
- 'alsa-lib>=1.0.14'
- 'gtk3'
- 'libxss'
- 'desktop-file-utils'
- 'openssl'
- 'nss'
- 'at-spi2-atk'
- 'libcurl-gnutls'
- 'libsm'
- 'libayatana-appindicator'
version: 1:1.2.31.1205-2
arch: x86_64
preexec: |
#!/usr/bin/env bash
curl -sS https://download.spotify.com/debian/pubkey_6224F9941A8AA6D1.gpg | gpg --import -
- name: install dependencies
package:
name: "{{ aur_packages | map(attribute='dependencies') | flatten }}"
state: present
become: true become: true
- name: configure passwordless sudo for paru user - name: check preexec script
copy: stat:
owner: root path: /var/lib/makepkg/{{ item.name }}/preexec
group: root
mode: "0600"
dest: /etc/sudoers.d/paru
content: |
paru ALL=(ALL) NOPASSWD: /usr/bin/pacman
become: true
- name: check if paru is already installed
shell: |
set -o errexit
if pacman -Qi paru-bin >/dev/null 2>&1; then
exit 100
fi
exit 0
args:
executable: /bin/bash
changed_when: false
check_mode: false
failed_when: result.rc not in (0, 100)
register: result
- name: build paru on arch
shell: |
set -o errexit
mkdir -p /tmp/paru-build
cd /tmp/paru-build
curl -L -O https://aur.archlinux.org/cgit/aur.git/snapshot/paru-bin.tar.gz
tar xvf paru-bin.tar.gz
cd paru-bin
makepkg
args:
executable: /bin/bash
become: true # do not build as root!
become_user: makepkg become_user: makepkg
when: result.rc != 100
- name: install paru
shell: |
set -o errexit
pacman --noconfirm -U /tmp/paru-build/paru-bin/paru-bin-*.pkg.tar.zst
rm -rf /tmp/paru-build
args:
executable: /bin/bash
become: true become: true
when: result.rc != 100 when: item.preexec is defined
loop: "{{ aur_packages }}"
register: preexec_before
loop_control:
label: "{{ item.name }}"
- name: create build root directory
file:
path: "/var/lib/makepkg/{{ item.name }}/"
state: directory
mode: '0700'
owner: makepkg
group: makepkg
become_user: makepkg
become: true
loop: "{{ aur_packages }}"
loop_control:
label: "{{ item.name }}"
- name: install preexec script
copy:
dest: /var/lib/makepkg/{{ item.name }}/preexec
owner: makepkg
group: makepkg
mode: "0700"
content: "{{ item.preexec }}"
become_user: makepkg
become: true
when: item.preexec is defined
loop: "{{ aur_packages }}"
loop_control:
label: "{{ item.name }}"
- name: check preexec script
stat:
path: /var/lib/makepkg/{{ item.name }}/preexec
become_user: makepkg
become: true
when: item.preexec is defined
loop: "{{ aur_packages }}"
register: preexec_after
loop_control:
label: "{{ item.name }}"
- name: run preexec script
command: "{{ item.1.stat.path }}"
become_user: makepkg
become: true
when:
- not item[0].stat.exists
- item[0].stat.checksum|default('') != item[1].stat.checksum
loop: "{{ preexec_before.results| reject('skipped')|zip(preexec_after.results| reject('skipped')) }}"
loop_control:
label: "{{ item.1.stat.path }}"
- name: build AUR packages
command:
cmd: >
env
PKGEXT='.pkg.tar.zst'
BUILDDIR=/var/lib/makepkg/{{ item.name }}/build/
SRCDEST=/var/lib/makepkg/{{ item.name }}/src/
PKGDEST=/var/lib/makepkg/{{ item.name }}/
makepkg
--clean
--nosign
creates: /var/lib/makepkg/{{ item.name }}/{{ item.name }}-{{ item.version}}-{{ item.arch }}.pkg.tar.zst
chdir: "pkgbuilds/{{ item.name }}"
become_user: makepkg
become: true
loop: "{{ aur_packages }}"
loop_control:
label: "{{ item.name }}"
- name: clean up build leftovers
file:
path: /var/lib/makepkg/{{ item[0].name }}/{{ item[1] }}/
state: absent
become_user: makepkg
become: true
with_nested:
- "{{ aur_packages }}"
-
- build
- src
loop_control:
label: "{{ item[0].name }}/{{ item[1] }}"
- name: install AUR packages
pacman:
state: installed
name: /var/lib/makepkg/{{ item.name }}/{{ item.name }}-{{ item.version }}-{{ item.arch }}.pkg.tar.zst
become: true
loop: "{{ aur_packages }}"
loop_control:
label: "{{ item.name }}"
tags: ["aur"]
when: distro == 'archlinux' when: distro == 'archlinux'
- block: - block:
- name: load package list - name: load package list
include_vars: include_vars:
@@ -392,6 +461,15 @@
line: 'HandlePowerKey=suspend' line: 'HandlePowerKey=suspend'
become: true become: true
- name: limit journald size
lineinfile:
path: /etc/systemd/journald.conf
regexp: '^#?SystemMaxUse=.*$'
line: 'SystemMaxUse=50M'
become: true
notify:
- restart journald
- name: create sudonopw group - name: create sudonopw group
group: group:
name: sudonopw name: sudonopw
@@ -442,19 +520,6 @@
- distro == 'archlinux' - distro == 'archlinux'
- machine.gpu is defined and machine.gpu == 'amd' - machine.gpu is defined and machine.gpu == 'amd'
- block:
- block:
- name: install spotify from AUR via paru
shell: |
curl -sS https://download.spotify.com/debian/pubkey_5E3C45D7B312C643.gpg | gpg --import
yes 1 | paru --skipreview --aur --batchinstall --noconfirm -S spotify
become: true
become_user: paru
args:
creates: /usr/bin/spotify
tags: [spotify]
- set_fact: - set_fact:
users: "{{ machine.users }}" users: "{{ machine.users }}"
tags: tags:
@@ -481,3 +546,9 @@
mkinitcpio_cmd.rc != 0 mkinitcpio_cmd.rc != 0
and and
not (mkinitcpio_cmd.rc == 1 and "file not found: `fsck.overlay'" in mkinitcpio_cmd.stderr) not (mkinitcpio_cmd.rc == 1 and "file not found: `fsck.overlay'" in mkinitcpio_cmd.stderr)
- name: restart journald
service:
name: systemd-journald
state: restarted
become: true

138
user.yml
View File

@@ -101,13 +101,17 @@
register: empty_dir_stat register: empty_dir_stat
with_items: "{{ empty_directories }}" with_items: "{{ empty_directories }}"
check_mode: false check_mode: false
loop_control:
label: "{{ item.name }}"
- name: remove sysmlinks - name: remove symlinks
file: file:
path: "{{ item.stat.path }}" path: "{{ item.stat.path }}"
state: absent state: absent
when: item.stat.exists and item.stat.islnk when: item.stat.exists and item.stat.islnk
with_items: "{{ empty_dir_stat.results }}" with_items: "{{ empty_dir_stat.results }}"
loop_control:
label: "{{ item.item.name }}"
- name: create empty directories for dotfiles - name: create empty directories for dotfiles
file: file:
@@ -115,6 +119,8 @@
path: ~/{{ item.name }} path: ~/{{ item.name }}
mode: "{{ item.mode | default('0755') }}" mode: "{{ item.mode | default('0755') }}"
with_items: "{{ empty_directories }}" with_items: "{{ empty_directories }}"
loop_control:
label: "{{ item.name }}"
- name: link this folder to ~/.dotfiles - name: link this folder to ~/.dotfiles
file: file:
@@ -135,6 +141,8 @@
when: not item.template|default(false) when: not item.template|default(false)
with_items: "{{ dotfiles }}" with_items: "{{ dotfiles }}"
check_mode: false check_mode: false
loop_control:
label: "{{ item.to }}"
- name: remove invalid copy target (directories) - name: remove invalid copy target (directories)
file: file:
@@ -145,6 +153,8 @@
- item.stat.exists - item.stat.exists
- item.stat.isdir - item.stat.isdir
with_items: "{{ copy_stat.results }}" with_items: "{{ copy_stat.results }}"
loop_control:
label: "{{ item.item.from }}"
- name: make sure target directories exist - name: make sure target directories exist
file: file:
@@ -155,6 +165,8 @@
with_items: "{{ dotfiles }}" with_items: "{{ dotfiles }}"
become: true become: true
become_user: root become_user: root
loop_control:
label: "{{ item.to }}"
- name: link dotfiles - name: link dotfiles
file: file:
@@ -169,6 +181,8 @@
with_items: "{{ dotfiles }}" with_items: "{{ dotfiles }}"
become: true become: true
become_user: root become_user: root
loop_control:
label: "{{ item.to }}"
- name: get state of template targets - name: get state of template targets
stat: stat:
@@ -177,6 +191,8 @@
when: item.template|default(false) when: item.template|default(false)
with_items: "{{ dotfiles }}" with_items: "{{ dotfiles }}"
check_mode: false check_mode: false
loop_control:
label: "{{ item.to }}"
- name: remove invalid template target (directory or symlink) - name: remove invalid template target (directory or symlink)
file: file:
@@ -187,6 +203,8 @@
- item.stat.exists - item.stat.exists
- not item.stat.isreg - not item.stat.isreg
with_items: "{{ template_stat.results }}" with_items: "{{ template_stat.results }}"
loop_control:
label: "{{ item.item.to }}"
- name: deploy dotfiles templates - name: deploy dotfiles templates
template: template:
@@ -199,6 +217,8 @@
become_user: root become_user: root
when: item.template|default(false) when: item.template|default(false)
with_items: "{{ dotfiles }}" with_items: "{{ dotfiles }}"
loop_control:
label: "{{ item.to }}"
- name: create directories - name: create directories
file: file:
@@ -225,29 +245,6 @@
- bin_stat.stat.exists - bin_stat.stat.exists
- not bin_stat.stat.islnk - not bin_stat.stat.islnk
- name: create ~/.opt and ~/.optbin
file:
path: "{{ item }}"
state: directory
with_items:
- ~/.opt/
- ~/.optbin/
- name: symlink opt programs
file:
state: link
force: true
follow: false
path: "/home/{{ user.name }}/.optbin/{{ item.name }}"
src: "/home/{{ user.name }}/.opt/{{ item.optpath }}"
owner: "{{ user.name }}"
group: "{{ user_group_name }}"
with_items:
- name: hugo
optpath: hugo
- name: drone
optpath: drone
- name: link bin directory - name: link bin directory
file: file:
state: link state: link
@@ -346,9 +343,6 @@
# remove this camera / microphone overlay when in calls or similar # remove this camera / microphone overlay when in calls or similar
privacy.webrtc.legacyGlobalIndicator: false privacy.webrtc.legacyGlobalIndicator: false
# use distro updates instead
app.update.auto: false
- include_role: - include_role:
name: firefox name: firefox
vars: vars:
@@ -363,6 +357,8 @@
mode: '0755' mode: '0755'
with_items: "{{ firefox_profile_names.results }}" with_items: "{{ firefox_profile_names.results }}"
when: not ansible_check_mode when: not ansible_check_mode
loop_control:
label: "{{ item.profile_path }}"
- name: firefox - configure firefox custom css - name: firefox - configure firefox custom css
copy: copy:
@@ -381,70 +377,11 @@
- not ansible_check_mode - not ansible_check_mode
- user.firefox_profiles[item.profile_name].manage_css is sameas True - user.firefox_profiles[item.profile_name].manage_css is sameas True
with_items: "{{ firefox_profile_names.results }}" with_items: "{{ firefox_profile_names.results }}"
loop_control:
label: "{{ item.profile_path }}"
tags: tags:
- firefox - firefox
- block:
- name: look of current installation
stat:
path: /home/{{ user.name }}/.opt/portfolio-performance-{{ portfolio_performace_version }}
register: stat_portfolio_performance_installation
- block:
- name: create temporary directory
tempfile:
state: directory
register: tempdir
- name: download portfolio performance
get_url:
url: https://github.com/buchen/portfolio/releases/download/{{ portfolio_performace_version }}/PortfolioPerformance-{{ portfolio_performace_version }}-linux.gtk.x86_64.tar.gz
dest: "{{ tempdir.path }}/PortfolioPerformance.{{ portfolio_performace_version }}.tar.gz"
force: false
- name: create destination directory
file:
state: directory
path: "{{ tempdir.path }}/PortfolioPerformance"
when: not stat_portfolio_performance_installation.stat.exists
- name: unpack portfolio performance
unarchive:
src: "{{ tempdir.path }}/PortfolioPerformance.{{ portfolio_performace_version }}.tar.gz"
owner: "{{ user.name }}"
group: "{{ user_group_name }}"
mode: '0755'
dest: "{{ tempdir.path }}/PortfolioPerformance"
remote_src: true
- name: install portfolio performance
synchronize:
src: "{{ tempdir.path }}/PortfolioPerformance"
dest: /home/{{ user.name }}/.opt/portfolio-performance-{{ portfolio_performace_version }}
recursive: true
checksum: true
delete: true
- name: clean up temp directory
file:
path: "{{ tempdir.path }}"
state: absent
when:
- not stat_portfolio_performance_installation.stat.exists
- not ansible_check_mode
- name: link portfolio performance
file:
src: /home/{{ user.name }}/.opt/portfolio-performance-{{ portfolio_performace_version }}/PortfolioPerformance/portfolio/PortfolioPerformance
dest: /home/{{ user.name }}/.optbin/portfolio-performance
owner: "{{ user.name }}"
group: "{{ user_group_name }}"
state: link
force: true
tags:
- portfolio-performance
- name: handle autostart units - name: handle autostart units
block: block:
- name: create systemd user directory - name: create systemd user directory
@@ -507,28 +444,3 @@
when: user.gpg_key is defined when: user.gpg_key is defined
tags: [gpg] tags: [gpg]
- block:
- name: add passwordstore init script
copy:
dest: /home/{{ user.name }}/.optbin/pass
owner: "{{ user.name }}"
group: "{{ user_group_name }}"
mode: '0755'
content: |
#!/usr/bin/env bash
set -o nounset
set -o errexit
if [[ ! -e ~/.password-store ]] ; then
printf '%s\n' 'This is the first time running pass, initializting repository ...'
git clone ssh://git@code.hkoerber.de:2222/hannes/passwordstore.git ~/.password-store
printf '%s\n' 'Done'
fi
command -p pass "${@}"
when: user.enable_passwordstore|default(false) is sameas true
tags: [passwordstore]

View File

@@ -2,7 +2,6 @@ source /etc/profile
_path=( _path=(
"$HOME/bin" "$HOME/bin"
"$HOME/.optbin"
"$HOME/.cargo/bin" "$HOME/.cargo/bin"
) )