Browse Source

tank roles und Playbook.

master
Olli Graf 4 years ago
parent
commit
76377beef8
  1. 4
      bin/blini.py
  2. 62
      hosts
  3. 7
      installk3s.yml
  4. 7
      portainer.yml
  5. 1
      resources/k3s/cmdline.txt
  6. 5
      roles/disableswap/tasks/main.yml
  7. 2
      roles/initpi/tasks/main.yml
  8. 30
      roles/installk3s/tasks/main.yml
  9. 16
      roles/installportainer/tasks/main.yml
  10. 10
      roles/log2ram/tasks/main.yml
  11. 7
      roles/showtemp/tasks/main.yml
  12. 5
      roles/touchtank/tasks/main.yml
  13. 2
      roles/updatepi/tasks/main.yml
  14. 7
      temp_status.yml
  15. 7
      touchtank.yml

4
bin/blini.py

@ -1,4 +1,4 @@
#!/usr/bin/env python
#! /usr/bin/python3
import random
import time
@ -14,7 +14,7 @@ to_led=6
def pixel_on():
hostname= get_hostname()
print hostname
print(hostname)
for i in range(from_led,to_led):
r = 255
b = 255

62
hosts

@ -1,7 +1,17 @@
pi-tanked:
hosts:
quimby:
willie:
kirk:
brandine:
hans:
cleatus:
clancy:
pi4:
hosts:
clancy:
martin:
willie:
quimby:
hans:
pye:
@ -11,22 +21,26 @@ pi4:
sherry:
carl:
barney:
kirk:
brandine:
martin:
pis:
hosts:
brandine:
clancy:
martin:
quimby:
kirk:
willie:
hans:
pye:
julius:
carl:
cleatus:
selma:
# barney:
clancy:
willie:
quimby:
hans:
pye:
julius:
cleatus:
mary:
sherry:
carl:
barney:
kirk:
brandine:
edna:
vars:
ansible_python_interpreter: /usr/bin/python3
ansible_connection: ssh
@ -37,7 +51,7 @@ pis:
ansible_ssh_private_key_file: ~/.ssh/id_rsa
blini:
hosts:
quimby:
192.168.178.24:
willie:
kirk:
brandine:
@ -71,6 +85,23 @@ servers:
vasmani.de:
ollital.net:
ashkente.de:
olliberry.de:
vars:
ansible_python_interpreter: /usr/bin/python3
ansible_connection: ssh
ansible_port: 1770
ansible_sudo: true
ansible_become: true
ansible_user: olli
ansible_ssh_common_args: '-o StrictHostKeyChecking=no'
ansible_ssh_private_key_file: ~/.ssh/id_rsa
serversip:
hosts:
81.169.195.18:
85.215.93.229:
62.75.191.218:
85.214.240.190:
85.214.129.239:
vars:
ansible_python_interpreter: /usr/bin/python3
ansible_connection: ssh
@ -81,3 +112,4 @@ servers:
ansible_ssh_common_args: '-o StrictHostKeyChecking=no'
ansible_ssh_private_key_file: ~/.ssh/id_rsa

7
installk3s.yml

@ -0,0 +1,7 @@
---
- hosts: "{{ target }}"
gather_facts: false
remote_user: pi
roles:
- installk3s

7
portainer.yml

@ -0,0 +1,7 @@
---
- hosts: "{{ target }}"
gather_facts: false
remote_user: pi
roles:
- installportainer

1
resources/k3s/cmdline.txt

@ -0,0 +1 @@
console=serial0,115200 console=tty1 root=PARTUUID=18f274fe-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait rfkill.default.state=1 systemd.restore_state=0 cgroup_memory=1 cgroup_enable=memory

5
roles/disableswap/tasks/main.yml

@ -1,7 +1,8 @@
- name: Disable swap.
become: true
shell: >
dphys-swapfile swapoff &&
dphys-swapfile uninstall &&
/usr/sbin/dphys-swapfile swapoff &&
/usr/sbin/dphys-swapfile uninstall &&
update-rc.d -f dphys-swapfile remove
systemctl disable dphys-swapfile
# when:

2
roles/initpi/tasks/main.yml

@ -31,7 +31,7 @@
- docker.io
- git
- locate
- yum
# - yum
- dnsutils
- nfs-kernel-server
update_cache: yes

30
roles/installk3s/tasks/main.yml

@ -0,0 +1,30 @@
- name: cmdline.txt
become: true
copy:
src: resources/k3s/{{ item }}
dest: /boot
owner: root
group: root
mode: '0755'
with_items:
- cmdline.txt
- name: iptables
become: true
shell: >
iptables -F
- name: create k3s dir
file:
path: ~/k3s-setup
state: directory
- name: Install k3s
become: true
shell: >
curl -sfL https://get.k3s.io | K3S_KUBECONFIG_MODE=”644” sh -
- name: Neustart
reboot:

16
roles/installportainer/tasks/main.yml

@ -0,0 +1,16 @@
- name: Portainer Data Dir
become: true
file:
path: /data
state: directory
- name: Install Portainer Container
docker_container:
name: portainer
image: portainer/portainer-ce:linux-arm
ports:
- "9000:9000"
restart_policy: always
volumes:
- portainer_data:/data
become: true

10
roles/log2ram/tasks/main.yml

@ -1,8 +1,8 @@
- name: PI Update
become: true
apt:
update_cache: yes
upgrade: dist
#- name: PI Update
# become: true
# apt:
# update_cache: yes
# upgrade: dist
- name: Key
become: true
apt_key:

7
roles/showtemp/tasks/main.yml

@ -0,0 +1,7 @@
- name: Temperatur Status
shell: >
vcgencmd measure_temp
register: command_output
- debug:
var: command_output.stdout_lines

5
roles/touchtank/tasks/main.yml

@ -0,0 +1,5 @@
- name: Touch Tank
ansible.builtin.file:
path: /tank/pis/{{ inventory_hostname }}
state: touch
mode: u=rw,g=r,o=r

2
roles/updatepi/tasks/main.yml

@ -3,6 +3,6 @@
apt:
upgrade: dist
update_cache: yes
cache_valid_time: 86400
cache_valid_time: 120
autoremove: yes

7
temp_status.yml

@ -0,0 +1,7 @@
---
- hosts: "{{ target }}"
gather_facts: false
remote_user: pi
roles:
- showtemp

7
touchtank.yml

@ -0,0 +1,7 @@
---
- hosts: "{{ target }}"
gather_facts: false
remote_user: pi
roles:
- touchtank
Loading…
Cancel
Save