Further improved setup
Can now install VS Code. Download tars from github. Uses a vault for storing sudo passwords.
This commit is contained in:
parent
5ee3eaa37b
commit
5fd24f447b
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -1,3 +1,3 @@
|
||||||
# ---> Ansible
|
# ---> Ansible
|
||||||
*.retry
|
*.retry
|
||||||
|
vault_pass.txt
|
||||||
|
|
|
||||||
19
ansible.cfg
19
ansible.cfg
|
|
@ -1,3 +1,20 @@
|
||||||
[defaults]
|
[defaults]
|
||||||
stdout_callback = dense
|
stdout_callback = dense
|
||||||
stderr_callback = dense
|
stderr_callback = dense
|
||||||
|
|
||||||
|
# (string) Sets the login user for the target machines
|
||||||
|
# When blank it uses the connection plugin's default, normally the user currently executing Ansible.
|
||||||
|
remote_user = hobbyadmin
|
||||||
|
|
||||||
|
# (path) Option for connections using a certificate or key file to authenticate, rather than an agent or passwords, you can set the default value here to avoid re-specifying --private-key with every invocation.
|
||||||
|
private_key_file=./ssh/hobbyadmin_pw
|
||||||
|
|
||||||
|
# (boolean) This controls whether an Ansible playbook should prompt for a vault password.
|
||||||
|
#ask_vault_pass=True
|
||||||
|
|
||||||
|
# (path) The vault password file to use. Equivalent to --vault-password-file or --vault-id
|
||||||
|
# If executable, it will be run and the resulting stdout will be used as the password.
|
||||||
|
vault_password_file=vault_pass.txt
|
||||||
|
|
||||||
|
# (boolean) Toggles debug output in Ansible. This is *very* verbose and can hinder multiprocessing. Debug output can also include secret information despite no_log settings being enabled, which means debug mode should not be used in production.
|
||||||
|
;debug=False
|
||||||
|
|
|
||||||
1
files/vscode.list
Normal file
1
files/vscode.list
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main
|
||||||
8
group_vars/all.yaml
Normal file
8
group_vars/all.yaml
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
|
||||||
|
# VS Code variables
|
||||||
|
# https://github.com/avnes/ansible-role-vscode
|
||||||
|
vscode_microsoft_asc_url: https://packages.microsoft.com/keys/microsoft.asc
|
||||||
|
vscode_ubuntu_required_software:
|
||||||
|
- gpg
|
||||||
|
- libasound2
|
||||||
|
- libxshmfence-dev
|
||||||
|
|
@ -1,8 +1,15 @@
|
||||||
werkstatt:
|
werkstatt_rechner:
|
||||||
hosts:
|
hosts:
|
||||||
plotter:
|
plotter:
|
||||||
ansible_host: 172.30.30.113
|
ansible_host: plotter-pc.fritz.box
|
||||||
|
werkstatt_notebooks:
|
||||||
|
hosts:
|
||||||
ArduinoKurs:
|
ArduinoKurs:
|
||||||
ansible_host: 172.30.30.200
|
ansible_host: 172.30.30.200
|
||||||
vars:
|
werkstatt:
|
||||||
ansible_user: hobbyadmin
|
children:
|
||||||
|
werkstatt_rechner:
|
||||||
|
werkstatt_notebooks:
|
||||||
|
it:
|
||||||
|
children:
|
||||||
|
werkstatt:
|
||||||
|
|
|
||||||
|
|
@ -1,81 +1,75 @@
|
||||||
---
|
---
|
||||||
- name: Allgemeine Software Installieren
|
- name: Allgemeine Software Installieren
|
||||||
hosts: werkstatt
|
hosts: "{{ variable_host | default('all') }}"
|
||||||
become: yes
|
become: yes
|
||||||
|
vars_files: secrets.yaml
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
|
- name: Setup apt-transport-https (needed by Microsoft PPA)
|
||||||
|
apt:
|
||||||
|
name: apt-transport-https
|
||||||
|
state: latest
|
||||||
- name: Add Microsoft PPA Key
|
- name: Add Microsoft PPA Key
|
||||||
apt_key:
|
import_tasks: ./tasks/setup_vscode_ppa.yaml
|
||||||
url: https://packages.microsoft.com/keys/microsoft.asc
|
|
||||||
state: present
|
|
||||||
- name: Add github PPA Key
|
- name: Add github PPA Key
|
||||||
apt_key:
|
apt_key:
|
||||||
url: https://cli.github.com/packages/githubcli-archive-keyring.gpg
|
url: https://cli.github.com/packages/githubcli-archive-keyring.gpg
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: Add PPAs
|
- name: Add PPAs
|
||||||
ansible.builtin.apt_repository:
|
apt_repository:
|
||||||
repo: "{{ item }}"
|
repo: "{{ item }}"
|
||||||
|
update_cache: false
|
||||||
state: present
|
state: present
|
||||||
loop:
|
loop:
|
||||||
- ppa:inkscape.dev/stable
|
|
||||||
- ppa:freecad-maintainers/freecad-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:git-core/ppa
|
||||||
|
- ppa:inkscape.dev/stable
|
||||||
|
- ppa:libreoffice/ppa
|
||||||
|
- ppa:mozillateam/ppa
|
||||||
- ppa:neovim-ppa/stable
|
- ppa:neovim-ppa/stable
|
||||||
|
- ppa:nextcloud-devs/client
|
||||||
|
- ppa:ubuntu-mozilla-security/ppa
|
||||||
|
|
||||||
- name: Software installieren (apt)
|
- name: Software installieren (apt)
|
||||||
apt:
|
apt:
|
||||||
name:
|
name:
|
||||||
- zsh
|
|
||||||
- inkscape
|
|
||||||
- git
|
|
||||||
- gimp
|
|
||||||
- gimp-help-de
|
|
||||||
- freecad
|
|
||||||
- code
|
- code
|
||||||
- firefox
|
- firefox
|
||||||
- nextcloud-desktop
|
- freecad
|
||||||
- libreoffice
|
|
||||||
- git
|
|
||||||
- gh
|
- gh
|
||||||
|
- gimp
|
||||||
|
- gimp-help-de
|
||||||
|
- git
|
||||||
|
- inkscape
|
||||||
|
- libreoffice
|
||||||
- neovim
|
- neovim
|
||||||
state: present
|
- nextcloud-desktop
|
||||||
|
- zsh
|
||||||
|
state: latest
|
||||||
|
update_cache: true
|
||||||
- name: Software installieren (Flatpak)
|
- name: Software installieren (Flatpak)
|
||||||
community.general.flatpak:
|
community.general.flatpak:
|
||||||
name:
|
name:
|
||||||
- com.prusa3d.PrusaSlicer
|
- com.prusa3d.PrusaSlicer
|
||||||
|
- org.filezillaproject.Filezilla
|
||||||
state: latest
|
state: latest
|
||||||
|
- name: Setup OpenRobertaConnectior
|
||||||
|
import_tasks: ./tasks/openrobertaconnector.yaml
|
||||||
- name: cups_browserd deaktivieren
|
- name: cups_browserd deaktivieren
|
||||||
import_tasks: ./pb_disable_browsed.yaml
|
import_tasks: ./tasks/disable_browsed.yaml
|
||||||
#- name: zsh
|
# done - name: Firefox installieren
|
||||||
#- name:
|
# - name: ublock Installieren
|
||||||
#- name: GIMP Installieren
|
# - name: DSGVO deny Installieren
|
||||||
#- name: FreeCad Installieren
|
# - name: ecosia
|
||||||
#- name: Prusa Slicer Installieren
|
# - name: do not translate
|
||||||
#- name: VS Code installieren
|
# - name: Fonts installieren
|
||||||
#- name: Firefox installieren
|
# - name: Links zu Benutzerdaten in Nextcloud installieren
|
||||||
# todo - name: ublock Installieren
|
# - name: HobbyEngel und roberta anlegen
|
||||||
# todo - name: DSGVO deny Installieren
|
# - name: alle User in Dialout hinzufügen
|
||||||
# todo - name: ecosia
|
# - name: Hintergrund setzen
|
||||||
# todo - name: do not translate
|
# - name: LaserSoftware installieren
|
||||||
#- name: NextCloud nstallieren
|
# - name: Grafiktreiber installieren
|
||||||
# todo - name: Fonts installieren
|
|
||||||
# todo - name: Links zu Benutzerdaten in Nextcloud installieren
|
# Stop firefox from snap: https://balintreczey.hu/blog/firefox-on-ubuntu-22-04-from-deb-not-from-snap/
|
||||||
# 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
|
|
||||||
|
|
||||||
|
|
@ -4,11 +4,16 @@
|
||||||
become: yes
|
become: yes
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- name: Update
|
|
||||||
apt:
|
|
||||||
update_cache: true
|
|
||||||
|
|
||||||
- name: Upgrade
|
- name: Upgrade
|
||||||
apt:
|
apt:
|
||||||
upgrade: yes
|
upgrade: yes
|
||||||
|
update_cache: true
|
||||||
|
|
||||||
|
- name: Software Aktualisieren (Flatpak)
|
||||||
|
community.general.flatpak:
|
||||||
|
state: latest
|
||||||
|
- name: Setup OpenRobertaConnectior
|
||||||
|
import_tasks: ./tasks/openrobertaconnector.yaml
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
8
ssh/hobbyadmin_pw
Normal file
8
ssh/hobbyadmin_pw
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
-----BEGIN OPENSSH PRIVATE KEY-----
|
||||||
|
b3BlbnNzaC1rZXktdjEAAAAACmFlczI1Ni1jdHIAAAAGYmNyeXB0AAAAGAAAABCIivX8hZ
|
||||||
|
yAq6uM6AvZwigjAAAAZAAAAAEAAAAzAAAAC3NzaC1lZDI1NTE5AAAAIM61PoKt9DU/oVig
|
||||||
|
jEKilZi25hROBiPP6X460Nhf995zAAAAoB0IhgSmq0HWQsLu7jHyU7MBGpZUw5bhDN+Iur
|
||||||
|
3nv5SDQu55/K0keGIB5obgXmR3Wxzf9AsLg7PL+pAuOp4w1WgKf2+kZkUsI8b9jDcFEJxP
|
||||||
|
A0fKVC7vY7z1rVq/z+GdVQ3Tc/XEplrN7E7tPvuh+1nO2FOhdXHaldQjgW4CEkn1EIue0h
|
||||||
|
4lv3zGo8ZV5xMfipj2FqWT6AeauH06v3QLAPA=
|
||||||
|
-----END OPENSSH PRIVATE KEY-----
|
||||||
1
ssh/hobbyadmin_pw.pub
Normal file
1
ssh/hobbyadmin_pw.pub
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIM61PoKt9DU/oVigjEKilZi25hROBiPP6X460Nhf995z gui@RedX-Linux
|
||||||
|
|
@ -1,4 +1,10 @@
|
||||||
# Source https://sysadmin.info.pl/en/blog/disabling-the-cups-browsed-service-on-multiple-systems-using-ansible/
|
# Source https://sysadmin.info.pl/en/blog/disabling-the-cups-browsed-service-on-multiple-systems-using-ansible/
|
||||||
|
# Step 1: Check if systemctl is available (for systemd systems)
|
||||||
|
- name: Check if systemctl is available (neutral Python)
|
||||||
|
raw: "which systemctl"
|
||||||
|
register: systemctl_check
|
||||||
|
changed_when: False
|
||||||
|
ignore_errors: yes
|
||||||
- name: Check if cups-browsed service exists (systemd)
|
- name: Check if cups-browsed service exists (systemd)
|
||||||
command: systemctl cat cups-browsed
|
command: systemctl cat cups-browsed
|
||||||
register: cups_browsed_exists
|
register: cups_browsed_exists
|
||||||
|
|
@ -21,7 +27,6 @@
|
||||||
msg: |
|
msg: |
|
||||||
{
|
{
|
||||||
"Machine": "{{ inventory_hostname }}",
|
"Machine": "{{ inventory_hostname }}",
|
||||||
"Python binary": "{{ ansible_python_interpreter }}",
|
|
||||||
"Systemd used": "{{ 'Yes' if systemctl_check.rc == 0 else 'No' }}",
|
"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 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' }}"
|
"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' }}"
|
||||||
21
tasks/github_latest_tar.yaml
Normal file
21
tasks/github_latest_tar.yaml
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
|
||||||
|
- name: Create bin
|
||||||
|
file:
|
||||||
|
path: "{{ bin_folder }}"
|
||||||
|
state: directory
|
||||||
|
- name: Check latest version available
|
||||||
|
uri:
|
||||||
|
url: "https://api.github.com/repos/{{ app_repo_name }}/releases/latest"
|
||||||
|
return_content: true
|
||||||
|
register: app_gh_latest
|
||||||
|
|
||||||
|
- name: "Unpacking latest version available"
|
||||||
|
loop: "{{ app_gh_latest.json.assets }}"
|
||||||
|
when: app_package_pattern in item.name
|
||||||
|
unarchive:
|
||||||
|
remote_src: yes
|
||||||
|
src: "{{ item.browser_download_url }}"
|
||||||
|
dest: "{{ bin_folder }}"
|
||||||
|
keep_newer: yes
|
||||||
|
extra_opts:
|
||||||
|
- --strip=1
|
||||||
13
tasks/openrobertaconnector.yaml
Normal file
13
tasks/openrobertaconnector.yaml
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
- name: Download OpenRobertaConnectior
|
||||||
|
import_tasks: ./github_latest_tar.yaml
|
||||||
|
vars:
|
||||||
|
- app_name: OpenRobertaConnector
|
||||||
|
- app_repo_name: OpenRoberta/openroberta-connector
|
||||||
|
- app_package_pattern: OpenRobertaConnectorLinux-
|
||||||
|
- bin_folder: "{{ansible_env.HOME}}/OpenRobertaConnector"
|
||||||
|
- name: Install OpenRobertaConnector
|
||||||
|
debug:
|
||||||
|
msg: "tbd"
|
||||||
|
# become hobbyuser
|
||||||
|
# do not add user to dialout because then no admin is needed
|
||||||
|
# use different task to add user to dialout
|
||||||
16
tasks/setup_vscode_ppa.yaml
Normal file
16
tasks/setup_vscode_ppa.yaml
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
- name: Install required software
|
||||||
|
ansible.builtin.apt:
|
||||||
|
name: "{{ item }}"
|
||||||
|
state: present
|
||||||
|
loop: "{{ vscode_ubuntu_required_software | flatten }}"
|
||||||
|
|
||||||
|
- name: Download ASC file
|
||||||
|
ansible.builtin.apt_key:
|
||||||
|
url: "{{ vscode_microsoft_asc_url }}"
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: Copy repo list
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: vscode.list
|
||||||
|
dest: /etc/apt/sources.list.d/vscode.list
|
||||||
|
mode: '0644'
|
||||||
8
vars/secrets.yaml
Normal file
8
vars/secrets.yaml
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
$ANSIBLE_VAULT;1.1;AES256
|
||||||
|
32326636373263356465613364303233623238336130373766303133363366326661313134306232
|
||||||
|
6138323132396334353535393738306463653532343533380a323838386439376233616636636165
|
||||||
|
33666439386631376232383236386362356465353130346131383830613331306434663066336566
|
||||||
|
6335336464333531310a386566333930653035343734316262363161353763383663656337366561
|
||||||
|
65383461633133363131333365306531613934383164666339616433363337313030336630626162
|
||||||
|
66353863363539643333666630343030376434363737653434313138623637346366626636316135
|
||||||
|
623037623831613737636433653039323035
|
||||||
Loading…
Reference in New Issue
Block a user