Drop hardcoded packages to remove
This commit is contained in:
21
packages.yml
21
packages.yml
@@ -1,5 +1,4 @@
|
|||||||
packages:
|
packages:
|
||||||
list:
|
|
||||||
kernel:
|
kernel:
|
||||||
archlinux:
|
archlinux:
|
||||||
- linux-zen
|
- linux-zen
|
||||||
@@ -451,23 +450,3 @@ packages:
|
|||||||
watchexec:
|
watchexec:
|
||||||
archlinux:
|
archlinux:
|
||||||
- watchexec
|
- watchexec
|
||||||
|
|
||||||
remove:
|
|
||||||
mousepad:
|
|
||||||
archlinux: ["mousepad"]
|
|
||||||
vim:
|
|
||||||
archlinux: ["gvim"]
|
|
||||||
rust:
|
|
||||||
archlinux: ["rust"]
|
|
||||||
screen:
|
|
||||||
archlinux: ["screen"]
|
|
||||||
lxc:
|
|
||||||
archlinux: ["lxc"]
|
|
||||||
autorandr:
|
|
||||||
archlinux: ["autorandr"]
|
|
||||||
openvpn:
|
|
||||||
archlinux: ["openvpn"]
|
|
||||||
bluetooth:
|
|
||||||
archlinux: ["bluez", "bluez-tools", "blueman"]
|
|
||||||
borgbackup:
|
|
||||||
archlinux: ["borg"]
|
|
||||||
|
|||||||
22
playbook.yml
22
playbook.yml
@@ -165,33 +165,15 @@
|
|||||||
become: true
|
become: true
|
||||||
|
|
||||||
- set_fact:
|
- set_fact:
|
||||||
defined_packages: "{{ packages|json_query('keys(list)') }}"
|
defined_packages: "{{ packages }}"
|
||||||
|
|
||||||
- set_fact:
|
- set_fact:
|
||||||
distro_packages: "{{ packages|json_query('list.*.%s'|format(distro)) }}"
|
distro_packages: "{{ packages|json_query('*.%s'|format(distro)) }}"
|
||||||
|
|
||||||
- name: check list
|
- name: check list
|
||||||
assert:
|
assert:
|
||||||
that: "defined_packages|length == distro_packages|length"
|
that: "defined_packages|length == distro_packages|length"
|
||||||
|
|
||||||
- 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"
|
|
||||||
|
|
||||||
- name: remove packages
|
|
||||||
package:
|
|
||||||
name: "{{ packages|json_query(query) }}"
|
|
||||||
state: absent
|
|
||||||
become: true
|
|
||||||
vars:
|
|
||||||
query: "{{ 'remove.*.%s[]'|format(distro) }}"
|
|
||||||
|
|
||||||
- name: install packages
|
- name: install packages
|
||||||
package:
|
package:
|
||||||
name: "{{ packages|json_query(query) }}"
|
name: "{{ packages|json_query(query) }}"
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ packages_to_remove=()
|
|||||||
|
|
||||||
readarray -d $'\0' -t packages_to_remove < <(comm --zero-terminated -13 \
|
readarray -d $'\0' -t packages_to_remove < <(comm --zero-terminated -13 \
|
||||||
<(cat \
|
<(cat \
|
||||||
<(<packages.yml yaml2json | jq --raw-output0 '.packages.list | map(.archlinux) | flatten[]') \
|
<(<packages.yml yaml2json | jq --raw-output0 '.packages | map(.archlinux) | flatten[]') \
|
||||||
<(for dep in "${aurdeps[@]}" ; do printf '%s\0' "${dep}" ; done) \
|
<(for dep in "${aurdeps[@]}" ; do printf '%s\0' "${dep}" ; done) \
|
||||||
| sort -zu) \
|
| sort -zu) \
|
||||||
<(pacman -Qq --explicit | xargs -I "{}" printf '%s\0' "{}" | sort -zu) \
|
<(pacman -Qq --explicit | xargs -I "{}" printf '%s\0' "{}" | sort -zu) \
|
||||||
|
|||||||
Reference in New Issue
Block a user