From c8de512a98462327b909311d2f89c90c32fb9246 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Gon=C3=A7alves?= Date: Sat, 1 Oct 2022 22:28:22 +0200 Subject: chore: migrate package install in distinct roles --- roles/workstation/tasks/dockerd.yml | 13 +++++++++ roles/workstation/tasks/libvirt.yml | 4 +++ roles/workstation/tasks/main.yml | 33 ++++------------------ roles/workstation/tasks/os_archlinux.yml | 48 ++++++++++---------------------- roles/workstation/tasks/pipewire.yml | 21 ++++++++++++++ roles/workstation/tasks/pkgs.yml | 2 +- 6 files changed, 59 insertions(+), 62 deletions(-) create mode 100644 roles/workstation/tasks/pipewire.yml (limited to 'roles/workstation/tasks') diff --git a/roles/workstation/tasks/dockerd.yml b/roles/workstation/tasks/dockerd.yml index dc1c268..df85dd5 100644 --- a/roles/workstation/tasks/dockerd.yml +++ b/roles/workstation/tasks/dockerd.yml @@ -1,3 +1,16 @@ +- name: install docker + package: + name: + - docker + - docker-compose + state: present + +- name: append current user to docker group + user: + name: "{{ workstation_user }}" + groups: "{{ workstation_docker_group }}" + append: true + - name: create docker directory file: path: /etc/docker diff --git a/roles/workstation/tasks/libvirt.yml b/roles/workstation/tasks/libvirt.yml index 36d3fa5..ef9e85b 100644 --- a/roles/workstation/tasks/libvirt.yml +++ b/roles/workstation/tasks/libvirt.yml @@ -1,3 +1,7 @@ +- name: install iptables-nft + shell: yes | pacman --noprogressbar --needed --sync iptables-nft + when: ansible_distribution == "Archlinux" + - name: install libvirt package: name: diff --git a/roles/workstation/tasks/main.yml b/roles/workstation/tasks/main.yml index 205834f..ea772d6 100644 --- a/roles/workstation/tasks/main.yml +++ b/roles/workstation/tasks/main.yml @@ -2,46 +2,23 @@ include_vars: "os_{{ ansible_distribution | lower }}.yml" - name: include packages - tags: always - include_tasks: - file: pkgs.yml - apply: - tags: task_pkgs + include_tasks: pkgs.yml - name: include operating system setup - tags: always - include_tasks: - file: "os_{{ ansible_distribution | lower }}.yml" - apply: - tags: task_system + include_tasks: "os_{{ ansible_distribution | lower }}.yml" - name: include shell setup - tags: always - include_tasks: - file: shell.yml - apply: - tags: task_shell + include_tasks: shell.yml - name: include doas setup - tags: always - include_tasks: - file: doas.yml - apply: - tags: task_doas + include_tasks: doas.yml - name: include smartcard setup - tags: always - include_tasks: - file: smartcard.yml - apply: - tags: task_smartcard + include_tasks: smartcard.yml - name: include ssh setup - tags: always include_tasks: file: ssh.yml - apply: - tags: task_ssh args: apply: become: true diff --git a/roles/workstation/tasks/os_archlinux.yml b/roles/workstation/tasks/os_archlinux.yml index 70d7abd..76d78c5 100644 --- a/roles/workstation/tasks/os_archlinux.yml +++ b/roles/workstation/tasks/os_archlinux.yml @@ -1,35 +1,4 @@ -- name: append current user to system groups - user: - name: "{{ workstation_user }}" - groups: "{{ item }}" - append: true - loop: - - docker - - wheel - - video - - audio - -- name: enable and start pipewire - systemd: - name: "{{ item }}" - scope: user - enabled: true - state: started - become: true - become_method: su - become_user: "{{ workstation_user }}" - loop: - - pipewire - - pipewire-pulse - when: ansible_service_mgr == "systemd" - -- name: ensure that dhcpcd is started - service: - name: dhcpcd - state: started - enabled: true - -- name: enable battery optimization +- name: include battery optimization include_tasks: tlp.yml when: ansible_form_factor in ["Laptop", "Notebook"] @@ -39,12 +8,25 @@ - name: include dockerd setup include_tasks: dockerd.yml +- name: include pipewire + include_tasks: pipewire.yml + - name: retrieve installed packages package_facts: register: package_facts -- name: install yay +- name: include yay include_tasks: yay.yml when: - "'yay' not in package_facts.ansible_facts.packages" - "'yay-bin' not in package_facts.ansible_facts.packages" + +- name: append current user to system groups + user: + name: "{{ workstation_user }}" + groups: "{{ item }}" + append: true + loop: + - wheel + - video + - audio diff --git a/roles/workstation/tasks/pipewire.yml b/roles/workstation/tasks/pipewire.yml new file mode 100644 index 0000000..1192563 --- /dev/null +++ b/roles/workstation/tasks/pipewire.yml @@ -0,0 +1,21 @@ +- name: install pipewire + package: + name: + - pipewire + - pipewire-alsa + - pipewire-pulse + state: present + +- name: enable and start pipewire + systemd: + name: "{{ item }}" + scope: user + enabled: true + state: started + become: true + become_method: su + become_user: "{{ workstation_user }}" + loop: + - pipewire + - pipewire-pulse + when: ansible_service_mgr == "systemd" diff --git a/roles/workstation/tasks/pkgs.yml b/roles/workstation/tasks/pkgs.yml index f4f2f44..abc583e 100644 --- a/roles/workstation/tasks/pkgs.yml +++ b/roles/workstation/tasks/pkgs.yml @@ -2,6 +2,6 @@ package: name: "{{ item }}" state: present - loop: + loop: - "{{ workstation_pkgs_common }}" - "{{ workstation_pkgs }}" -- cgit v1.2.3