Initial scripts

This commit is contained in:
Guilherme 2025-01-08 21:43:42 +01:00
parent 5b9134ddbb
commit 5ee3eaa37b
5 changed files with 134 additions and 0 deletions

3
ansible.cfg Normal file
View File

@ -0,0 +1,3 @@
[defaults]
stdout_callback = dense
stderr_callback = dense

8
inventory.yaml Normal file
View File

@ -0,0 +1,8 @@
werkstatt:
hosts:
plotter:
ansible_host: 172.30.30.113
ArduinoKurs:
ansible_host: 172.30.30.200
vars:
ansible_user: hobbyadmin

28
pb_disable_browsed.yaml Normal file
View File

@ -0,0 +1,28 @@
# Source https://sysadmin.info.pl/en/blog/disabling-the-cups-browsed-service-on-multiple-systems-using-ansible/
- name: Check if cups-browsed service exists (systemd)
command: systemctl cat cups-browsed
register: cups_browsed_exists
changed_when: False
failed_when: cups_browsed_exists.rc not in [0, 1]
when: systemctl_check.rc == 0
ignore_errors: yes
- name: Stop cups-browsed service (systemd)
systemd:
name: cups-browsed
state: stopped
when: cups_browsed_exists is defined and cups_browsed_exists.rc is defined and cups_browsed_exists.rc == 0
- name: Disable cups-browsed service (systemd)
systemd:
name: cups-browsed
enabled: no
when: cups_browsed_exists is defined and cups_browsed_exists.rc is defined and cups_browsed_exists.rc == 0
- name: Display cups-browsed service status in JSON format
debug:
msg: |
{
"Machine": "{{ inventory_hostname }}",
"Python binary": "{{ ansible_python_interpreter }}",
"Systemd used": "{{ 'Yes' if systemctl_check.rc == 0 else 'No' }}",
"Cups-browsed service exists": "{{ 'Yes' if (systemctl_check.rc == 0 and cups_browsed_exists is defined and cups_browsed_exists.rc == 0) else 'No' }}",
"Cups-browsed service stopped and disabled": "{{ 'Stopped and Disabled' if (systemctl_check.rc == 0 and cups_browsed_exists is defined and cups_browsed_exists.rc == 0) else 'Not applicable' }}"
}

81
pb_setup.yaml Normal file
View File

@ -0,0 +1,81 @@
---
- name: Allgemeine Software Installieren
hosts: werkstatt
become: yes
tasks:
- name: Add Microsoft PPA Key
apt_key:
url: https://packages.microsoft.com/keys/microsoft.asc
state: present
- name: Add github PPA Key
apt_key:
url: https://cli.github.com/packages/githubcli-archive-keyring.gpg
state: present
- name: Add PPAs
ansible.builtin.apt_repository:
repo: "{{ item }}"
state: present
loop:
- ppa:inkscape.dev/stable
- ppa:freecad-maintainers/freecad-stable
- https://packages.microsoft.com/repos/code stable main
- ppa:ubuntu-mozilla-security/ppa
- ppa:nextcloud-devs/client
- ppa:libreoffice/ppa
- ppa:git-core/ppa
- ppa:neovim-ppa/stable
- name: Software installieren (apt)
apt:
name:
- zsh
- inkscape
- git
- gimp
- gimp-help-de
- freecad
- code
- firefox
- nextcloud-desktop
- libreoffice
- git
- gh
- neovim
state: present
- name: Software installieren (Flatpak)
community.general.flatpak:
name:
- com.prusa3d.PrusaSlicer
state: latest
- name: cups_browserd deaktivieren
import_tasks: ./pb_disable_browsed.yaml
#- name: zsh
#- name:
#- name: GIMP Installieren
#- name: FreeCad Installieren
#- name: Prusa Slicer Installieren
#- name: VS Code installieren
#- name: Firefox installieren
# todo - name: ublock Installieren
# todo - name: DSGVO deny Installieren
# todo - name: ecosia
# todo - name: do not translate
#- name: NextCloud nstallieren
# todo - name: Fonts installieren
# todo - name: Links zu Benutzerdaten in Nextcloud installieren
# todo - name: HobbyEngel und roberta anlegen
# todo - name: alle User in Dialout hinzufügen
# todo - name: ssh passwort zugang stilllegen
# todo - name: Hintergrund setzen
# todo - name: LaserSoftware installieren
#- name: Paket cups-browsed deinstallieren
# todo - name: Grafiktreiber installieren
#- name: LibreOffice installieren
#- name: git
#- name: gh
# todo - name: OpenRobertaConnector
# todo - name: Filezilla installieren

14
pb_update.yaml Normal file
View File

@ -0,0 +1,14 @@
---
- name: Aktualisieren
hosts: werkstatt
become: yes
tasks:
- name: Update
apt:
update_cache: true
- name: Upgrade
apt:
upgrade: yes