ansible/roles/common/tasks/main.yml

69 lines
1.9 KiB
YAML

---
- name: Install packages
when: update
block:
- name: Install packages (pacman)
when: package_manager == 'pacman' or 'pacman' in group_names
tags: pacman
block:
- name: Install the good stuff (pacman)
pacman: name={{ item }} state=latest
ignore_errors: true
with_items:
- "{{ extra_packages }}"
- "{{ packages }}"
rescue:
- name: Uninstall the good stuff (pacman)
pacman: name={{ item }} state=absent
with_items:
- "{{ extra_packages }}"
- "{{ packages }}"
- name: Install packages (apk)
when: package_manager == 'apk' or 'apk' in group_names or 'alpine' in group_names
tags: apk
block:
- name: Install the good stuff (apk)
apk: name={{ item }} state=latest
ignore_errors: true
with_items:
- "{{ extra_packages }}"
- "{{ packages }}"
rescue:
- name: Uninstall the good stuff (apk)
apk: name={{ item }} state=absent
with_items:
- "{{ extra_packages }}"
- "{{ packages }}"
- name: Install packages (apt)
when: package_manager == 'apt' or 'apt' in group_names
tags: apt
block:
- name: Install the good stuff (apt)
apt: package={{ item }} state=latest
ignore_errors: true
with_items:
- "{{ extra_packages }}"
- "{{ packages }}"
rescue:
- name: Uninstall the good stuff (apt)
apt: package={{ item }} state=absent
with_items:
- "{{ extra_packages }}"
- "{{ packages }}"
- name: Configure system packages
when: "'system' in setup"
block:
- name: Add /etc/doas.conf
copy: src=doas.conf dest=/etc/doas.conf owner=root group=root mode=0644
tags: system
- name: Configure user configs
when: "'user' in setup and ('neofetch' in packages or 'neofetch' in extra_packages)"
block:
- name: Add ~/.config/neofetch/
copy: src=neofetch dest={{ home }}/.config owner={{ name }} group={{ group }} mode=0755
tags: config