Ansible god!

Big rework!
Control stuffs with variables!
We still should do some movei'n around of roles before extending
features.
This commit is contained in:
2022-03-23 02:03:04 +01:00
parent 2c29be1b7b
commit a70d58f3f7
33 changed files with 447 additions and 104 deletions

View File

@@ -1,36 +1,67 @@
- name: Install and configure packages
- name: Install packages
when: update
block:
- name: Install the good stuff (pacman)
pacman: name={{ packages }} state=latest
- name: Install packages (pacman)
when: "'pacman' in group_names"
tags: pacman
- name: Install the good stuff (apk)
apk: name={{ packages }} state=latest
block:
- name: Install the good stuff (pacman)
pacman: name={{ item }} state=latest
ignore_errors: yes
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: "'apk' in group_names or 'alpine' in group_names"
tags: apk
- name: Install the good stuff (apt)
apt: package={{ packages }} state=latest
block:
- name: Install the good stuff (apk)
apk: name={{ item }} state=latest
ignore_errors: yes
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: "'apt' in group_names"
tags: apt
block:
- name: Install the good stuff (apt)
apt: package={{ item }} state=latest
ignore_errors: yes
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
rescue:
- name: Uninstall the good stuff (pacman)
pacman: name={{ packages }} state=absent
when: "'pacman' in group_names"
tags: pacman
- name: Uninstall the good stuff (apk)
apk: name={{ packages }} state=absent
when: "'apk' in group_names or 'alpine' in group_names"
tags: apk
- name: Uninstall the good stuff (apt)
apt: package={{ packages }} state=absent
when: "'apt' in group_names"
tags: apt
- name: Remove /etc/doas.conf
file: state=absent path=/etc/doas.conf
tags: system
- name: Configure user configs
when: "'user' in setup"
block:
- name: Add ~/.config/neofetch/
copy: src=neofetch dest=/home/{{ name }}/.config/neofetch owner={{ name }} group={{ name }} mode=0755
tags: config