fix: add and remove blank lines

Add blank lines where it helps with readability (e.g., between each
task) but also remove needless one.
This commit is contained in:
Christoph Schug 2024-03-03 16:34:29 +01:00
parent 6e52db9cf6
commit 70a8bea0ed
19 changed files with 37 additions and 1 deletions

View File

@ -2,16 +2,19 @@
- name: install fail2ban and configure sshd
hosts: "{{ my_hosts | d([]) }}"
become: true
tasks:
- name: install fail2ban
ansible.builtin.apt:
name:
- fail2ban
update_cache: true
- name: copy fail2ban configfiles
ansible.builtin.copy:
src: configfiles/debian-sshd-default.conf
dest: /etc/fail2ban/jail.d/debian-sshd-default.conf
- name: restart fail2ban
ansible.builtin.systemd_service:
state: restarted

View File

@ -2,12 +2,14 @@
- name: add ssh key
hosts: "{{ my_hosts | d([]) }}"
become: true
tasks:
- name: install public keys
ansible.posix.authorized_key:
user: "{{ lookup('env','USER') }}"
state: present
key: "{{ lookup('file', '~/.ssh/id_rsa.pub') }}"
- name: change sudoers file
ansible.builtin.lineinfile:
path: /etc/sudoers

View File

@ -3,10 +3,12 @@
hosts: "{{ my_hosts | d([]) }}"
become: true
become_user: "{{ lookup('env','USER') }}"
tasks:
- name: create new volume
community.docker.docker_volume:
name: portainer-data
- name: deploy portainer
community.docker.docker_container:
name: portainer

View File

@ -2,6 +2,7 @@
- name: deploy traefik v2.5
hosts: "{{ my_hosts | d([]) }}"
become: true
tasks:
- name: deploy traefik
become_user: "{{ lookup('env','USER') }}"

View File

@ -2,6 +2,7 @@
- name: install core packages
hosts: "{{ my_hosts | d([]) }}"
become: true
tasks:
- name: install core packages
ansible.builtin.apt:

View File

@ -2,6 +2,7 @@
- name: install docker
hosts: "{{ my_hosts | d([]) }}"
become: true
tasks:
- name: install docker dependencies
ansible.builtin.apt:
@ -12,16 +13,19 @@
- gnupg-agent
- software-properties-common
update_cache: true
- name: add docker gpg key
ansible.builtin.apt_key:
url: https://download.docker.com/linux/ubuntu/gpg
state: present
keyring: /etc/apt/keyrings/docker.gpg
- name: add docker repository
ansible.builtin.apt_repository:
filename: docker
repo: deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu {{ ansible_lsb.codename|lower }} stable
state: present
- name: install docker engine
ansible.builtin.apt:
name:

View File

@ -2,10 +2,12 @@
- name: install microk8s
hosts: "{{ my_hosts | d([]) }}"
become: true
tasks:
- name: install microk8s
community.general.snap:
classic: true
name: microk8s
- name: add userpermissions
ansible.builtin.shell: "usermod -aG microk8s {{ lookup('env','USER') }}"

View File

@ -3,6 +3,7 @@
hosts: all
become: true
become_method: sudo
tasks:
- name: Install qemu-guest-agent
ansible.builtin.apt:

View File

@ -2,6 +2,7 @@
- name: install core packages for virtual machines
hosts: "{{ my_hosts | d([]) }}"
become: true
tasks:
- name: install packages
ansible.builtin.apt:
@ -10,6 +11,7 @@
- nfs-common
- qemu-guest-agent
update_cache: true
- name: start guest qemu-guest-agent
ansible.builtin.service:
name: qemu-guest-agent

View File

@ -2,11 +2,13 @@
- name: install wireguard
hosts: "{{ my_hosts | d([]) }}"
become: true
tasks:
- name: install wireguard
ansible.builtin.apt:
name: wireguard
update_cache: true
- name: generate private and public keypair
ansible.builtin.shell: |
wg genkey | tee privatekey | wg pubkey > publickey

View File

@ -2,6 +2,7 @@
- name: install zsh
hosts: "{{ my_hosts | d([]) }}"
become: true
tasks:
- name: install zsh
ansible.builtin.apt:

View File

@ -1,13 +1,16 @@
---
- name: check disk space
hosts: "{{ my_hosts | d([]) }}"
tasks:
- name: get disk usage
ansible.builtin.command: df -h
register: disk_usage
- name: check disk space available
ansible.builtin.shell: df -Ph / | awk 'NR==2 {print $5}'
register: disk_usage
# - name: send discord message when disk space is over 80%
# uri:
# url: "your-webhook"

View File

@ -1,6 +1,7 @@
---
- name: clean docker
hosts: "{{ my_hosts | d([]) }}"
tasks:
- name: prune non-dangling images
community.docker.docker_prune:

View File

@ -2,12 +2,14 @@
- name: check if system reboot is required
hosts: "{{ my_hosts | d([]) }}"
become: true
tasks:
- name: check if system reboot is required
become: true
ansible.builtin.stat:
path: /var/run/reboot-required
register: reboot_required
- ansible.builtin.debug:
msg: "Reboot is required"
when: reboot_required.stat.exists

View File

@ -2,6 +2,7 @@
- name: reboot machine
hosts: "{{ my_hosts | d([]) }}"
become: true
tasks:
- name: reboot machine
ansible.builtin.reboot:

View File

@ -1,6 +1,7 @@
---
- name: Update and upgrade apt packages
hosts: all
tasks:
- name: Update packages with apt
when: ansible_pkg_mgr == 'apt'

View File

@ -1,6 +1,7 @@
---
- hosts: all
become: true
tasks:
- name: install prerequisites
ansible.builtin.apt:
@ -11,12 +12,15 @@
- gnupg-agent
- software-properties-common
update_cache: true
- name: add apt-key
ansible.builtin.apt_key:
url: https://download.docker.com/linux/ubuntu/gpg
- name: add docker repo
ansible.builtin.apt_repository:
repo: deb https://download.docker.com/linux/ubuntu focal stable
- name: install docker
ansible.builtin.apt:
name:
@ -25,5 +29,6 @@
- containerd.io
- docker-compose
update_cache: true
- name: add userpermissions
ansible.builtin.shell: "usermod -aG docker vagrant"

View File

@ -1,11 +1,12 @@
---
- hosts: all
become: true
tasks:
- name: install microk8s
community.general.snap:
classic: true
name: microk8s
- name: add userpermissions
ansible.builtin.shell: "usermod -aG microk8s vagrant"

View File

@ -1,6 +1,7 @@
---
- hosts: all
become: true
tasks:
- name: install cockpit
ansible.builtin.apt: