rolle: apt_install_packages umgebaut + Pakete entfernen eingebaut (#237)

Co-authored-by: Michael Grote <michael.grote@posteo.de>
Reviewed-on: mg/ansible#237
Co-authored-by: mg <michael.grote@posteo.de>
Co-committed-by: mg <michael.grote@posteo.de>
This commit is contained in:
Michael Grote 2021-11-05 21:10:27 +01:00
parent d5ecd4f2d1
commit 10bc3a7f98
14 changed files with 47 additions and 38 deletions

View file

@ -174,8 +174,8 @@
- production
- test
- laptop
### mgrote.apt_install_packages
programs_common:
### mgrote.apt_manage_packages
apt_packages_common:
- locales
- python3
- build-essential
@ -203,16 +203,18 @@
- rsync
- at
- ripgrep
programs_only_physical:
apt_packages_physical:
- hddtemp
- ipmitool
- s-tui
- smartmontools
- lm-sensors
- ethtool
programs_only_vms:
apt_packages_vm:
- qemu-guest-agent
- open-vm-tools
apt_packages_absent:
- nano

View file

@ -12,6 +12,6 @@
ansible_install_version_pip: '2.10'
### mgrote.restic
restic_folders_to_backup: "/usr/local /etc /root /home"
### mgrote.apt_install_packages
programs_extra:
### mgrote.apt_manage_packages
apt_packages_extra:
- sshpass

View file

@ -35,7 +35,7 @@
### geerlingguy.ansible
ansible_install_method: pip
ansible_install_version_pip: '2.10'
### mgrote.apt_install_packages
programs_extra:
### mgrote.apt_manage_packages
apt_packages_extra:
- graphviz # für ansible-playbook-grapher
- sshpass

View file

@ -31,8 +31,8 @@
- path: /home/mg/.config/flameshot
dotfiles_owner: mg
### mgrote.apt_install_packages
programs_extra:
### mgrote.apt_manage_packages
apt_packages_extra:
- bmon
- hddtemp
- s-tui

View file

@ -1,6 +1,6 @@
---
### mgrote.apt_install_packages
programs_extra:
### mgrote.apt_manage_packages
apt_packages_extra:
- ifupdown2
- bmon
### mgrote.smart

View file

@ -1,5 +1,5 @@
---
### mgrote.apt_install_packages
programs_extra:
### mgrote.apt_manage_packages
apt_packages_extra:
- qemu-guest-agent
- open-vm-tools

View file

@ -80,8 +80,8 @@
tmux_conf_destination: "/home/mg/.tmux.conf"
tmux_bashrc_destination: "/home/mg/.bashrc"
tmux_standardsession_name: "default"
### mgrote.apt_install_packages
programs_extra:
### mgrote.apt_manage_packages
apt_packages_extra:
- python3-stem # für munin-tor_
- geoip-bin # für munin-tor_
- geoip-database # für munin-tor_

View file

@ -41,8 +41,8 @@
protocol: tcp
comment: 'munin'
from_ip: 0.0.0.0/0
### mgrote.apt_install_packages
programs_extra:
### mgrote.apt_manage_packages
apt_packages_extra:
- libwww-curl-perl # für munin-plugin: unifi
- libjson-perl # für munin-plugin: unifi
### mgrote.munin-node

View file

@ -1,6 +1,6 @@
---
- import_playbook: base/apt_sources.yml
- import_playbook: base/install_packages.yml
- import_playbook: base/packages.yml
- import_playbook: base/ntp_client.yml
- import_playbook: base/restic.yml
- import_playbook: base/users.yml

View file

@ -1,5 +0,0 @@
---
- hosts: all
serial: 3
roles:
- { role: mgrote.apt_install_packages, tags: "install"}

View file

@ -0,0 +1,5 @@
---
- hosts: all
serial: 3
roles:
- { role: mgrote.apt_manage_packages, tags: "install"}

View file

@ -1,20 +1,20 @@
## mgrote.apt_install_packages
## mgrote.apt_manage_packages
### Beschreibung
Fuehrt:
`apt install {{ programme }}`
aus.
```yaml
programs_common:
apt_packages_common:
- locales
- wird überall installiert
programs_only_physical:
apt_packages_physical:
- hddtemp
- nur auf Hardware-Maschinen
programs_only_vms:
apt_packages_vm:
- qemu-guest-agent
- nur in VMs
programs_extra:
apt_packages_extra:
- Extra-Parameter für einzelne Hosts
```
Es wird unterschieden ob das Ziel eine VM ist oder nicht.

View file

@ -1,5 +1,5 @@
---
programs_common:
apt_packages_common:
- locales
- build-essential
- ntp
@ -22,12 +22,13 @@
- acl
- python3
- vim
programs_only_physical:
apt_packages_physical:
- hddtemp
- ipmitool
- powertop
- s-tui
programs_only_vms:
apt_packages_vm:
- qemu-guest-agent
- open-vm-tools
programs_extra:
apt_packages_extra:
apt_packages_absent:

View file

@ -2,26 +2,32 @@
- name: install common-packages
become: yes
ansible.builtin.package:
name: "{{ programs_common }}"
name: "{{ apt_packages_common }}"
state: present
- name: install extra-packages
become: yes
ansible.builtin.package:
name: "{{ programs_extra }}"
name: "{{ apt_packages_extra }}"
state: present
when: programs_extra is defined
when: apt_packages_extra is defined
- name: install vm-packages
become: yes
ansible.builtin.package:
name: "{{ programs_only_vms }}"
name: "{{ apt_packages_vm }}"
state: present
when: ansible_virtualization_role == 'guest'
- name: install physical-packages
become: yes
ansible.builtin.package:
name: "{{ programs_only_physical }}"
name: "{{ apt_packages_physical }}"
state: present
when: ansible_virtualization_role != 'guest'
- name: remove packages
become: yes
ansible.builtin.package:
name: "{{ apt_packages_absent }}"
state: absent