2020-04-11 14:07:51 +02:00
|
|
|
- name: configure system
|
|
|
|
|
hosts: localhost
|
2018-02-05 20:09:05 +01:00
|
|
|
connection: local
|
|
|
|
|
become: false
|
|
|
|
|
tasks:
|
2018-08-17 19:44:31 +02:00
|
|
|
- name: read machine-specific variables
|
|
|
|
|
include_vars:
|
|
|
|
|
file: _machines/{{ ansible_hostname }}.yml
|
|
|
|
|
name: machine
|
|
|
|
|
tags:
|
|
|
|
|
- always
|
|
|
|
|
|
2018-02-08 21:45:02 +01:00
|
|
|
- set_fact:
|
|
|
|
|
distro: "{{ ansible_distribution|lower }}"
|
2018-08-17 19:44:31 +02:00
|
|
|
tags:
|
|
|
|
|
- always
|
2018-02-08 21:45:02 +01:00
|
|
|
|
2020-03-02 11:52:45 +01:00
|
|
|
- name: Check for valid distro
|
|
|
|
|
assert:
|
2021-02-09 21:00:57 +01:00
|
|
|
that: distro in ('ubuntu', 'archlinux')
|
2020-03-02 11:52:45 +01:00
|
|
|
|
2020-03-02 11:52:45 +01:00
|
|
|
- block:
|
|
|
|
|
- block:
|
|
|
|
|
- name: Update apt cache
|
|
|
|
|
apt:
|
|
|
|
|
update_cache: true
|
|
|
|
|
become: true
|
2020-03-31 16:24:24 +02:00
|
|
|
changed_when: false
|
2020-03-02 11:52:45 +01:00
|
|
|
|
|
|
|
|
- name: Upgrade system
|
|
|
|
|
apt:
|
|
|
|
|
upgrade: dist
|
|
|
|
|
become: true
|
|
|
|
|
|
|
|
|
|
- name: Remove unused packages
|
|
|
|
|
apt:
|
|
|
|
|
autoremove: true
|
|
|
|
|
become: true
|
|
|
|
|
|
|
|
|
|
- name: Clean apt cache
|
|
|
|
|
apt:
|
|
|
|
|
autoclean: true
|
|
|
|
|
become: true
|
|
|
|
|
when: distro == 'ubuntu'
|
2020-03-03 23:33:14 +01:00
|
|
|
|
2020-12-08 22:00:44 +01:00
|
|
|
- block:
|
|
|
|
|
- name: enable multilib repository
|
|
|
|
|
blockinfile:
|
|
|
|
|
path: /etc/pacman.conf
|
|
|
|
|
block: |
|
|
|
|
|
[multilib]
|
|
|
|
|
Include = /etc/pacman.d/mirrorlist
|
|
|
|
|
become: true
|
|
|
|
|
|
|
|
|
|
- name: Upgrade system
|
|
|
|
|
pacman:
|
|
|
|
|
upgrade: true
|
|
|
|
|
update_cache: true
|
|
|
|
|
become: true
|
|
|
|
|
changed_when: false
|
|
|
|
|
|
|
|
|
|
- name: install pacman-contrib for paccache
|
|
|
|
|
package:
|
|
|
|
|
name: pacman-contrib
|
2021-10-02 11:04:22 +02:00
|
|
|
state: present
|
2020-12-08 22:00:44 +01:00
|
|
|
become: true
|
|
|
|
|
|
|
|
|
|
- name: Clean cache
|
|
|
|
|
command: paccache -rk2 -ruk0
|
|
|
|
|
become: true
|
2020-12-10 00:11:45 +01:00
|
|
|
changed_when: false
|
2020-12-08 22:00:44 +01:00
|
|
|
|
|
|
|
|
when: distro == 'archlinux'
|
2020-03-02 11:52:45 +01:00
|
|
|
tags: [update_system]
|
|
|
|
|
|
2020-12-09 23:58:24 +01:00
|
|
|
- block:
|
2020-12-11 18:04:14 +01:00
|
|
|
- name: install sudo
|
|
|
|
|
package:
|
2021-10-02 11:04:22 +02:00
|
|
|
state: present
|
2020-12-11 18:04:14 +01:00
|
|
|
name: sudo
|
|
|
|
|
|
2020-12-11 18:18:15 +01:00
|
|
|
- name: install dependencies for paru
|
|
|
|
|
package:
|
2021-10-02 11:04:22 +02:00
|
|
|
state: present
|
2020-12-11 18:18:15 +01:00
|
|
|
name:
|
|
|
|
|
- base-devel
|
|
|
|
|
- git
|
|
|
|
|
- cargo
|
|
|
|
|
- asp
|
|
|
|
|
- bat
|
2020-12-11 20:08:14 +01:00
|
|
|
become: true
|
2020-12-11 18:18:15 +01:00
|
|
|
|
2020-12-11 17:53:32 +01:00
|
|
|
- name: create build user on arch
|
|
|
|
|
user:
|
|
|
|
|
name: makepkg
|
|
|
|
|
home: /var/lib/makepkg
|
|
|
|
|
create_home: true
|
|
|
|
|
shell: /bin/bash
|
|
|
|
|
system: true
|
|
|
|
|
|
2020-12-20 20:37:43 +01:00
|
|
|
- name: check if paru is already installed
|
2020-12-09 23:58:24 +01:00
|
|
|
shell: |
|
|
|
|
|
set -o errexit
|
|
|
|
|
|
|
|
|
|
if pacman -Qi paru >/dev/null 2>&1; then
|
|
|
|
|
exit 100
|
|
|
|
|
fi
|
2020-12-20 20:37:43 +01:00
|
|
|
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
|
2020-12-09 23:58:24 +01:00
|
|
|
|
|
|
|
|
mkdir -p /tmp/paru-build
|
|
|
|
|
cd /tmp/paru-build
|
|
|
|
|
|
|
|
|
|
curl -L -O https://aur.archlinux.org/cgit/aur.git/snapshot/paru.tar.gz
|
|
|
|
|
tar xvf paru.tar.gz
|
|
|
|
|
cd paru
|
|
|
|
|
makepkg
|
|
|
|
|
args:
|
|
|
|
|
executable: /bin/bash
|
2020-12-11 17:53:32 +01:00
|
|
|
become: true # do not build as root!
|
|
|
|
|
become_user: makepkg
|
2020-12-20 20:37:43 +01:00
|
|
|
when: result.rc != 100
|
2020-12-09 23:58:24 +01:00
|
|
|
|
|
|
|
|
- name: install paru
|
|
|
|
|
shell: |
|
|
|
|
|
set -o errexit
|
|
|
|
|
|
|
|
|
|
pacman --noconfirm -U /tmp/paru-build/paru/paru-*.pkg.tar.zst
|
|
|
|
|
rm -rf /tmp/paru-build
|
|
|
|
|
args:
|
|
|
|
|
executable: /bin/bash
|
|
|
|
|
become: true
|
|
|
|
|
when: result.rc != 100
|
|
|
|
|
|
|
|
|
|
when: distro == 'archlinux'
|
|
|
|
|
|
|
|
|
|
|
2020-03-03 17:31:48 +01:00
|
|
|
- block:
|
|
|
|
|
- name: load package list
|
|
|
|
|
include_vars:
|
|
|
|
|
file: packages.yml
|
|
|
|
|
|
2021-10-02 12:54:11 +02:00
|
|
|
- name: force-update iptables to iptables-nft on arch
|
|
|
|
|
shell: pacman -Q iptables-nft || yes | pacman -S iptables-nft
|
|
|
|
|
changed_when: false
|
2018-02-05 20:09:05 +01:00
|
|
|
|
2020-03-03 17:31:48 +01:00
|
|
|
- set_fact:
|
|
|
|
|
defined_packages: "{{ packages|json_query('keys(list)') }}"
|
2018-02-05 20:09:05 +01:00
|
|
|
|
2020-03-03 17:31:48 +01:00
|
|
|
- set_fact:
|
|
|
|
|
distro_packages: "{{ packages|json_query('list.*.%s'|format(distro)) }}"
|
2018-02-05 20:09:05 +01:00
|
|
|
|
2020-03-03 17:31:48 +01:00
|
|
|
- name: check list
|
|
|
|
|
assert:
|
|
|
|
|
that: "defined_packages|length == distro_packages|length"
|
2018-02-05 20:09:05 +01:00
|
|
|
|
2020-10-05 22:03:05 +02:00
|
|
|
- set_fact:
|
|
|
|
|
defined_packages_remove: "{{ packages|json_query('keys(remove)') }}"
|
|
|
|
|
|
|
|
|
|
- set_fact:
|
|
|
|
|
distro_packages_remove: "{{ packages|json_query('remove.*.%s'|format(distro)) }}"
|
|
|
|
|
|
|
|
|
|
- name: check list
|
|
|
|
|
assert:
|
|
|
|
|
that: "defined_packages_remove|length == distro_packages_remove|length"
|
|
|
|
|
|
2020-03-03 17:31:48 +01:00
|
|
|
- name: install packages
|
|
|
|
|
package:
|
|
|
|
|
name: "{{ packages|json_query(query) }}"
|
2021-10-02 11:04:22 +02:00
|
|
|
state: present
|
2020-03-03 17:31:48 +01:00
|
|
|
become: true
|
|
|
|
|
vars:
|
|
|
|
|
query: "{{ 'list.*.%s[]'|format(distro) }}"
|
2020-10-05 22:03:05 +02:00
|
|
|
|
|
|
|
|
- name: remove packages
|
|
|
|
|
package:
|
|
|
|
|
name: "{{ packages|json_query(query) }}"
|
|
|
|
|
state: absent
|
|
|
|
|
become: true
|
|
|
|
|
vars:
|
|
|
|
|
query: "{{ 'remove.*.%s[]'|format(distro) }}"
|
2020-12-09 00:15:54 +01:00
|
|
|
|
|
|
|
|
- name: install machine-specific packages
|
|
|
|
|
package:
|
|
|
|
|
name: "{{ machine.packages }}"
|
|
|
|
|
state: present
|
|
|
|
|
when: machine.packages is defined
|
|
|
|
|
become: true
|
|
|
|
|
|
2020-03-03 17:31:48 +01:00
|
|
|
tags: [packages]
|
2018-02-05 20:09:05 +01:00
|
|
|
|
2020-12-08 22:00:44 +01:00
|
|
|
- block:
|
|
|
|
|
- name: configure timesyncd on arch
|
|
|
|
|
copy:
|
|
|
|
|
owner: root
|
|
|
|
|
group: root
|
|
|
|
|
mode: "0644"
|
|
|
|
|
dest: /etc/systemd/timesyncd.conf
|
|
|
|
|
content: |
|
|
|
|
|
[Time]
|
|
|
|
|
NTP=0.arch.pool.ntp.org 1.arch.pool.ntp.org 2.arch.pool.ntp.org 3.arch.pool.ntp.org
|
|
|
|
|
FallbackNTP=0.pool.ntp.org 1.pool.ntp.org 2.pool.ntp.org 3.pool.ntp.org
|
2020-12-09 19:36:41 +01:00
|
|
|
become: true
|
2020-12-09 21:43:57 +01:00
|
|
|
|
|
|
|
|
- name: install lz4
|
|
|
|
|
package:
|
|
|
|
|
name: lz4
|
2021-10-02 11:04:22 +02:00
|
|
|
state: present
|
2020-12-09 21:43:57 +01:00
|
|
|
become: true
|
|
|
|
|
|
|
|
|
|
- name: use lz4 for mkinitcpio compression
|
|
|
|
|
lineinfile:
|
|
|
|
|
path: /etc/mkinitcpio.conf
|
|
|
|
|
regexp: '^#?COMPRESSION=.*$'
|
|
|
|
|
line: 'COMPRESSION="lz4"'
|
|
|
|
|
become: true
|
2020-12-09 21:48:20 +01:00
|
|
|
notify:
|
|
|
|
|
- rebuild initrd
|
2020-12-09 19:36:41 +01:00
|
|
|
when: distro == 'archlinux'
|
2020-12-08 22:00:44 +01:00
|
|
|
|
2019-05-20 21:29:26 +02:00
|
|
|
- set_fact:
|
|
|
|
|
disable_services:
|
|
|
|
|
- ssh
|
2020-12-08 22:00:44 +01:00
|
|
|
when: distro == 'ubuntu'
|
|
|
|
|
|
|
|
|
|
- set_fact:
|
|
|
|
|
disable_services:
|
|
|
|
|
- sshd
|
|
|
|
|
when: distro == 'archlinux'
|
2019-05-20 21:29:26 +02:00
|
|
|
|
2018-02-09 17:56:43 +01:00
|
|
|
- name: disable services
|
|
|
|
|
service:
|
|
|
|
|
state: stopped
|
|
|
|
|
enabled: false
|
|
|
|
|
name: "{{ item }}"
|
2019-05-20 21:29:26 +02:00
|
|
|
with_items: "{{ disable_services }}"
|
2018-02-09 17:56:43 +01:00
|
|
|
become: true
|
2020-12-08 23:41:35 +01:00
|
|
|
when: manage_services|default(true)|bool
|
2020-12-08 22:00:44 +01:00
|
|
|
|
|
|
|
|
- set_fact:
|
|
|
|
|
enable_services:
|
|
|
|
|
- NetworkManager
|
|
|
|
|
- docker
|
|
|
|
|
- libvirtd
|
|
|
|
|
when: distro == 'ubuntu'
|
|
|
|
|
|
|
|
|
|
- set_fact:
|
|
|
|
|
enable_services:
|
|
|
|
|
- NetworkManager
|
|
|
|
|
- docker
|
|
|
|
|
- libvirtd
|
|
|
|
|
- systemd-timesyncd
|
2020-12-11 20:08:25 +01:00
|
|
|
- pcscd
|
2020-12-08 22:00:44 +01:00
|
|
|
when: distro == 'archlinux'
|
2018-02-09 17:56:43 +01:00
|
|
|
|
|
|
|
|
- name: enable services
|
|
|
|
|
service:
|
|
|
|
|
state: started
|
|
|
|
|
enabled: true
|
|
|
|
|
name: "{{ item }}"
|
2020-12-08 22:00:44 +01:00
|
|
|
with_items: "{{ enable_services }}"
|
2020-02-23 14:56:14 +01:00
|
|
|
become: true
|
2020-12-08 23:41:35 +01:00
|
|
|
when: manage_services|default(true)|bool
|
2020-02-23 14:56:14 +01:00
|
|
|
|
2018-02-09 17:56:43 +01:00
|
|
|
- name: get systemd boot target
|
|
|
|
|
command: systemctl get-default
|
|
|
|
|
register: systemd_target
|
|
|
|
|
changed_when: false
|
2020-04-01 10:15:58 +02:00
|
|
|
check_mode: false
|
2018-02-09 17:56:43 +01:00
|
|
|
|
|
|
|
|
- set_fact:
|
|
|
|
|
default_target: multi-user.target
|
|
|
|
|
|
|
|
|
|
- name: set systemd boot target
|
|
|
|
|
command: systemctl set-default {{ default_target }}
|
|
|
|
|
when: systemd_target.stdout != default_target
|
|
|
|
|
become: true
|
|
|
|
|
|
|
|
|
|
- name: handle lid switch
|
|
|
|
|
lineinfile:
|
|
|
|
|
path: /etc/systemd/logind.conf
|
|
|
|
|
regexp: '^HandleLidSwitch='
|
|
|
|
|
line: 'HandleLidSwitch=ignore'
|
|
|
|
|
become: true
|
|
|
|
|
|
|
|
|
|
- name: handle power key
|
|
|
|
|
lineinfile:
|
|
|
|
|
path: /etc/systemd/logind.conf
|
|
|
|
|
regexp: '^HandlePowerKey='
|
|
|
|
|
line: 'HandlePowerKey=suspend'
|
|
|
|
|
become: true
|
|
|
|
|
|
2020-12-08 22:00:44 +01:00
|
|
|
- block:
|
|
|
|
|
- name: create sudonopw group
|
|
|
|
|
group:
|
|
|
|
|
name: sudonopw
|
|
|
|
|
system: true
|
|
|
|
|
|
|
|
|
|
- name: configure passwordless sudo
|
|
|
|
|
copy:
|
|
|
|
|
owner: root
|
|
|
|
|
group: root
|
|
|
|
|
mode: "0600"
|
|
|
|
|
dest: /etc/sudoers.d/sudonopw
|
|
|
|
|
content: |
|
|
|
|
|
%sudonopw ALL=(ALL) NOPASSWD: ALL
|
|
|
|
|
become: true
|
|
|
|
|
|
|
|
|
|
when: distro == 'archlinux'
|
|
|
|
|
|
|
|
|
|
- block:
|
|
|
|
|
- name: install AMDGPU packages
|
|
|
|
|
package:
|
|
|
|
|
name:
|
|
|
|
|
- mesa
|
|
|
|
|
- lib32-mesa
|
|
|
|
|
- xf86-video-amdgpu
|
|
|
|
|
- vulkan-radeon
|
|
|
|
|
- lib32-vulkan-radeon
|
|
|
|
|
- libva-mesa-driver
|
|
|
|
|
- lib32-libva-mesa-driver
|
|
|
|
|
- mesa-vdpau
|
|
|
|
|
- lib32-mesa-vdpau
|
2021-10-02 11:04:22 +02:00
|
|
|
state: present
|
2020-12-08 22:00:44 +01:00
|
|
|
become: true
|
|
|
|
|
|
|
|
|
|
- name: set AMDGPU options
|
|
|
|
|
copy:
|
|
|
|
|
owner: root
|
|
|
|
|
group: root
|
|
|
|
|
mode: "0600"
|
|
|
|
|
dest: /etc/X11/xorg.conf.d/20-amdgpu.conf
|
|
|
|
|
content: |
|
|
|
|
|
Section "Device"
|
|
|
|
|
Identifier "AMD"
|
|
|
|
|
Driver "amdgpu"
|
|
|
|
|
Option "VariableRefresh" "true"
|
|
|
|
|
Option "TearFree" "true"
|
|
|
|
|
EndSection
|
2020-12-09 15:27:47 +01:00
|
|
|
become: true
|
2020-12-08 22:00:44 +01:00
|
|
|
|
|
|
|
|
when:
|
|
|
|
|
- distro == 'archlinux'
|
|
|
|
|
- machine.gpu is defined and machine.gpu == 'amd'
|
|
|
|
|
|
2021-10-02 11:06:08 +02:00
|
|
|
- block:
|
|
|
|
|
- name: install alacritty build dependencies
|
|
|
|
|
package:
|
|
|
|
|
state: present
|
|
|
|
|
# https://github.com/alacritty/alacritty/blob/master/INSTALL.md#debianubuntu
|
|
|
|
|
name:
|
|
|
|
|
- cmake
|
|
|
|
|
- pkg-config
|
|
|
|
|
- libfreetype6-dev
|
|
|
|
|
- libfontconfig1-dev
|
|
|
|
|
- libxcb-xfixes0-dev
|
|
|
|
|
- libxkbcommon-dev
|
|
|
|
|
- python3
|
|
|
|
|
become: true
|
|
|
|
|
|
|
|
|
|
- name: stat alacritty binary
|
|
|
|
|
stat:
|
|
|
|
|
path: /usr/local/bin/alacritty
|
|
|
|
|
register: alacritty_binary
|
|
|
|
|
|
|
|
|
|
- name: create temporary directory for alacritty build
|
|
|
|
|
tempfile:
|
|
|
|
|
state: directory
|
|
|
|
|
register: alacritty_build_tempdir
|
|
|
|
|
when: not alacritty_binary.stat.exists
|
|
|
|
|
|
|
|
|
|
- name: build alacritty
|
|
|
|
|
command: cargo install alacritty --root ./out
|
|
|
|
|
args:
|
|
|
|
|
chdir: "{{ alacritty_build_tempdir.path }}"
|
|
|
|
|
when: not alacritty_binary.stat.exists
|
|
|
|
|
|
|
|
|
|
- name: install alacritty
|
|
|
|
|
command: mv "{{ alacritty_build_tempdir.path }}/out/bin/alacritty" /usr/local/bin/alacritty
|
|
|
|
|
become: true
|
|
|
|
|
when: not alacritty_binary.stat.exists
|
|
|
|
|
|
|
|
|
|
- name: clean up build directory
|
|
|
|
|
file:
|
|
|
|
|
path: "{{ alacritty_build_tempdir.path }}"
|
|
|
|
|
state: absent
|
|
|
|
|
when: not alacritty_binary.stat.exists
|
|
|
|
|
|
|
|
|
|
when: distro == 'ubuntu'
|
|
|
|
|
tags: [alacritty]
|
2020-12-08 22:00:44 +01:00
|
|
|
|
2021-10-02 11:06:49 +02:00
|
|
|
- block:
|
|
|
|
|
- name: stat yubikey-touch-detector binary
|
|
|
|
|
stat:
|
|
|
|
|
path: /usr/local/bin/yubikey-touch-detector
|
|
|
|
|
register: yubikey_touch_detector_binary
|
|
|
|
|
|
|
|
|
|
- name: create temporary directory for yubikey-touch-detector build
|
|
|
|
|
tempfile:
|
|
|
|
|
state: directory
|
|
|
|
|
register: yubikey_touch_detector_build_tempdir
|
|
|
|
|
when: not yubikey_touch_detector_binary.stat.exists
|
|
|
|
|
|
|
|
|
|
- name: build yubikey-touch-detector
|
|
|
|
|
shell: env GOPATH=$(pwd) go get -u github.com/maximbaz/yubikey-touch-detector
|
|
|
|
|
args:
|
|
|
|
|
chdir: "{{ yubikey_touch_detector_build_tempdir.path }}"
|
|
|
|
|
when: not yubikey_touch_detector_binary.stat.exists
|
|
|
|
|
|
|
|
|
|
- name: install yubikey-touch-detector
|
|
|
|
|
command: >
|
|
|
|
|
mv
|
|
|
|
|
"{{ yubikey_touch_detector_build_tempdir.path }}/bin/yubikey-touch-detector"
|
|
|
|
|
/usr/local/bin/yubikey-touch-detector
|
|
|
|
|
become: true
|
|
|
|
|
when: not yubikey_touch_detector_binary.stat.exists
|
|
|
|
|
|
|
|
|
|
- name: clean up build directory
|
|
|
|
|
file:
|
|
|
|
|
path: "{{ yubikey_touch_detector_build_tempdir.path }}"
|
|
|
|
|
state: absent
|
|
|
|
|
when: not yubikey_touch_detector_binary.stat.exists
|
|
|
|
|
|
|
|
|
|
when: distro == 'ubuntu'
|
|
|
|
|
tags: [yubikey-touch-detector]
|
|
|
|
|
|
2021-10-02 11:07:14 +02:00
|
|
|
- block:
|
|
|
|
|
- name: add spotify apt key
|
|
|
|
|
apt_key:
|
|
|
|
|
url: "https://download.spotify.com/debian/pubkey_0D811D58.gpg"
|
|
|
|
|
id: "D1742AD60D811D58"
|
|
|
|
|
become: true
|
|
|
|
|
|
|
|
|
|
- name: add spotify repository
|
|
|
|
|
apt_repository:
|
|
|
|
|
repo: "deb http://repository.spotify.com stable non-free"
|
|
|
|
|
filename: spotify
|
|
|
|
|
become: true
|
|
|
|
|
|
|
|
|
|
- name: install spotify
|
|
|
|
|
apt:
|
|
|
|
|
name: spotify-client
|
|
|
|
|
update_cache: true
|
|
|
|
|
become: true
|
|
|
|
|
when: distro == 'ubuntu'
|
|
|
|
|
tags: [spotify]
|
|
|
|
|
|
2021-10-02 11:07:19 +02:00
|
|
|
- block:
|
|
|
|
|
- name: add signal apt key
|
|
|
|
|
apt_key:
|
|
|
|
|
url: "https://updates.signal.org/desktop/apt/keys.asc"
|
|
|
|
|
id: "D980A17457F6FB06"
|
|
|
|
|
become: true
|
|
|
|
|
|
|
|
|
|
- name: add signal repository
|
|
|
|
|
apt_repository:
|
|
|
|
|
repo: "deb https://updates.signal.org/desktop/apt xenial main"
|
|
|
|
|
filename: spotify
|
|
|
|
|
become: true
|
|
|
|
|
|
|
|
|
|
- name: install signal
|
|
|
|
|
apt:
|
|
|
|
|
name: signal-desktop
|
|
|
|
|
update_cache: true
|
|
|
|
|
become: true
|
|
|
|
|
when: distro == 'ubuntu'
|
|
|
|
|
tags: [signal]
|
|
|
|
|
|
2019-11-14 10:40:16 +01:00
|
|
|
- name: create dotfiles group
|
|
|
|
|
group:
|
|
|
|
|
name: dotfiles
|
|
|
|
|
state: present
|
|
|
|
|
become: true
|
|
|
|
|
become_user: root
|
|
|
|
|
|
2021-10-02 11:32:17 +02:00
|
|
|
- name: create dotfiles user
|
|
|
|
|
user:
|
|
|
|
|
name: dotfiles
|
|
|
|
|
home: /var/lib/dotfiles
|
|
|
|
|
create_home: false
|
|
|
|
|
shell: /bin/bash
|
|
|
|
|
system: true
|
|
|
|
|
become: true
|
|
|
|
|
become_user: root
|
|
|
|
|
|
2019-11-14 10:40:16 +01:00
|
|
|
- name: create dotfiles directory
|
|
|
|
|
file:
|
|
|
|
|
state: directory
|
|
|
|
|
path: /var/lib/dotfiles
|
2021-10-02 11:32:17 +02:00
|
|
|
owner: dotfiles
|
2019-11-14 10:40:16 +01:00
|
|
|
group: dotfiles
|
2020-02-23 15:19:28 +01:00
|
|
|
mode: '0775' # group needs write access!
|
2019-11-14 10:40:16 +01:00
|
|
|
become: true
|
|
|
|
|
become_user: root
|
|
|
|
|
|
2019-11-14 09:16:55 +01:00
|
|
|
- set_fact:
|
|
|
|
|
users: "{{ machine.users }}"
|
2018-08-17 21:16:54 +02:00
|
|
|
tags:
|
2019-11-14 09:16:55 +01:00
|
|
|
- always
|
2018-08-17 21:16:54 +02:00
|
|
|
|
2019-11-14 09:16:55 +01:00
|
|
|
- include_tasks: user.yml
|
2018-08-17 21:16:54 +02:00
|
|
|
args:
|
2019-11-14 09:16:55 +01:00
|
|
|
apply:
|
|
|
|
|
become: true
|
|
|
|
|
become_user: "{{ user.name }}"
|
|
|
|
|
with_items: "{{ users }}"
|
|
|
|
|
loop_control:
|
|
|
|
|
loop_var: user
|
2020-03-03 17:31:48 +01:00
|
|
|
tags:
|
|
|
|
|
- always
|
2020-12-09 21:48:20 +01:00
|
|
|
|
|
|
|
|
handlers:
|
|
|
|
|
- name: rebuild initrd
|
|
|
|
|
command: mkinitcpio -P
|
|
|
|
|
become: true
|