prepared for update printerserver

This commit is contained in:
krumel
2022-02-26 22:05:37 +01:00
parent 7adcf81c0d
commit de05b7e312
4 changed files with 65 additions and 38 deletions

View File

@ -1,19 +1,34 @@
---
all:
children:
single-hosts:
rpi:
# Hosts without special groups
single-hosts:
hosts:
srv-print:
ansible_host: 192.168.2.95
ansible_user: ansible
# All RPI hosts
rpi:
hosts:
children:
rpi:
hosts:
children:
rpi_ubuntu:
rpi_rpios:
vars:
ansible_user: pi
hosts:
octopi:
ansible_host: 192.168.2.99
pihole:
ansible_host: 192.168.2.20
naspi:
ansible_host: 192.168.2.75
piprint:
ansible_host: 192.168.2.95
rpi_ubuntu:
rpi_rpios:
# RPI hosts with RPIOS
rpi_rpios:
vars:
ansible_user: pi
hosts:
octopi:
ansible_host: 192.168.2.99
pihole:
ansible_host: 192.168.2.20
naspi:
ansible_host: 192.168.2.75
# piprint:
# ansible_host: 192.168.2.95

24
playbooks/patches.yml Executable file
View File

@ -0,0 +1,24 @@
- hosts: all
tasks:
- name: Update Debian-based systems
block:
- name: Apt Update
apt:
update_cache: yes
- name: Apt Upgrade
apt:
upgrade: safe
- name: Check if reboot required
stat:
path: /var/run/reboot-required
register: reboot_required_file
- name: Reboot if required
reboot:
when: reboot_required_file.stat.exists == true
become: yes
when: ansible_facts['ansible_os_family'] == 'Debian'

View File

@ -1,19 +0,0 @@
- hosts: rpi
become: yes
tasks:
- name: Apt Update
apt:
update_cache: yes
- name: Apt Upgrade
apt:
upgrade: safe
- name: Check if reboot required
stat:
path: /var/run/reboot-required
register: reboot_required_file
- name: Reboot if required
reboot:
when: reboot_required_file.stat.exists == true

View File

@ -1,9 +1,16 @@
- hosts: rpi
become: yes
- become: yes
tasks:
- name: add ansible@septentrion to authorized keys
- name: add ansible@septentrion to authorized keys for RaspberryPis
hosts: rpi
ansible.posix.authorized_key:
user: pi
state: present
key: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCcB6Y1KvYdK2T4Ewg5ATE7dp67O+0RtPLWvfaiHfJoSJlipcgPKWcbFhxyAlKwQXYqILF03cfoaHXjMtNjiZpCWtUqlZVklNlQNtqyjYghn45PX1m+nmU4bMuBQw+b+J4N8KM5XfL5BAWlpFBMsWjTFEherkKCZs5ABMx6r9MiHaIb9gwjzsQBF+oqkqXAOLXd4kaSSYPHJcxfcWtKCW2S083+lfj+iwc3zwzwNoLcMeiE9eKpTXvDldCXZ5pvd762llNn24Zsa/O1i+HOGm3EkeoeBSW08sj5nGSV8CmjzM1eQI8FZzcteaTkL916Ny+NwgsZ7NogDtpZCBwdwnNE+APG060Mq1ul1sX6KblCOAXUIDyhmJCV2XuJZNd74pzTs4jZKTXjwYmG4Tq0pATw6lKaHQSC2DlwWWkToaFd+ewQ2Mct43vfPFUIGWJHxciLEALb1ZTomOkmG5v2ZTfqp9cUtCkX90ZaYa3ADk5afjKf/2lKgr0ffL0BQjvnZ5M= ansible@Septentrion"
- name: add ansible@septentrion to authorized keys for single hosts
hosts: single-hosts
ansible.posix.authorized_key:
user: ansible
state: present
key: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCcB6Y1KvYdK2T4Ewg5ATE7dp67O+0RtPLWvfaiHfJoSJlipcgPKWcbFhxyAlKwQXYqILF03cfoaHXjMtNjiZpCWtUqlZVklNlQNtqyjYghn45PX1m+nmU4bMuBQw+b+J4N8KM5XfL5BAWlpFBMsWjTFEherkKCZs5ABMx6r9MiHaIb9gwjzsQBF+oqkqXAOLXd4kaSSYPHJcxfcWtKCW2S083+lfj+iwc3zwzwNoLcMeiE9eKpTXvDldCXZ5pvd762llNn24Zsa/O1i+HOGm3EkeoeBSW08sj5nGSV8CmjzM1eQI8FZzcteaTkL916Ny+NwgsZ7NogDtpZCBwdwnNE+APG060Mq1ul1sX6KblCOAXUIDyhmJCV2XuJZNd74pzTs4jZKTXjwYmG4Tq0pATw6lKaHQSC2DlwWWkToaFd+ewQ2Mct43vfPFUIGWJHxciLEALb1ZTomOkmG5v2ZTfqp9cUtCkX90ZaYa3ADk5afjKf/2lKgr0ffL0BQjvnZ5M= ansible@Septentrion"