diff --git a/ansible/configuration/fail2ban/config-f2b-protect-sshd.yaml b/ansible/configuration/fail2ban/config-f2b-protect-sshd.yaml index ceabe4e..747a007 100644 --- a/ansible/configuration/fail2ban/config-f2b-protect-sshd.yaml +++ b/ansible/configuration/fail2ban/config-f2b-protect-sshd.yaml @@ -4,16 +4,16 @@ become: yes tasks: - name: install fail2ban - apt: + ansible.builtin.apt: name: - fail2ban update_cache: yes - name: copy fail2ban configfiles - copy: + ansible.builtin.copy: src: configfiles/debian-sshd-default.conf dest: /etc/fail2ban/jail.d/debian-sshd-default.conf - name: restart fail2ban - systemd: + ansible.builtin.systemd_service: state: restarted daemon_reload: yes name: fail2ban diff --git a/ansible/configuration/ssh/config-add-sshkey.yaml b/ansible/configuration/ssh/config-add-sshkey.yaml index 023ed04..7cb376f 100644 --- a/ansible/configuration/ssh/config-add-sshkey.yaml +++ b/ansible/configuration/ssh/config-add-sshkey.yaml @@ -9,7 +9,7 @@ state: present key: "{{ lookup('file', '~/.ssh/id_rsa.pub') }}" - name: change sudoers file - lineinfile: + ansible.builtin.lineinfile: path: /etc/sudoers state: present regexp: '^%sudo' diff --git a/ansible/installation/inst-core.yaml b/ansible/installation/inst-core.yaml index c08a782..c69a839 100644 --- a/ansible/installation/inst-core.yaml +++ b/ansible/installation/inst-core.yaml @@ -3,7 +3,7 @@ become: yes tasks: - name: install core packages - apt: + ansible.builtin.apt: name: - prometheus-node-exporter - nfs-common diff --git a/ansible/installation/inst-docker-ubuntu.yaml b/ansible/installation/inst-docker-ubuntu.yaml index 0d31101..af64193 100644 --- a/ansible/installation/inst-docker-ubuntu.yaml +++ b/ansible/installation/inst-docker-ubuntu.yaml @@ -4,7 +4,7 @@ become: yes tasks: - name: install docker dependencies - apt: + ansible.builtin.apt: name: - apt-transport-https - ca-certificates @@ -13,17 +13,17 @@ - software-properties-common update_cache: yes - name: add docker gpg key - apt_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 - apt_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 - apt: + ansible.builtin.apt: name: - docker-ce - docker-ce-cli diff --git a/ansible/installation/inst-microk8s.yaml b/ansible/installation/inst-microk8s.yaml index 7db7ec8..d7533f3 100644 --- a/ansible/installation/inst-microk8s.yaml +++ b/ansible/installation/inst-microk8s.yaml @@ -4,8 +4,8 @@ become: yes tasks: - name: install microk8s - snap: + community.general.snap: classic: yes name: microk8s - name: add userpermissions - shell: "usermod -aG microk8s {{ lookup('env','USER') }}" + ansible.builtin.shell: "usermod -aG microk8s {{ lookup('env','USER') }}" diff --git a/ansible/installation/inst-qemu-agent.yaml b/ansible/installation/inst-qemu-agent.yaml index 73b9f89..1ebfce0 100644 --- a/ansible/installation/inst-qemu-agent.yaml +++ b/ansible/installation/inst-qemu-agent.yaml @@ -5,6 +5,6 @@ become_method: sudo tasks: - name: Install qemu-guest-agent - apt: + ansible.builtin.apt: name: qemu-guest-agent state: present diff --git a/ansible/installation/inst-vm-core.yaml b/ansible/installation/inst-vm-core.yaml index 52b2767..4cfeaac 100644 --- a/ansible/installation/inst-vm-core.yaml +++ b/ansible/installation/inst-vm-core.yaml @@ -4,14 +4,14 @@ become: yes tasks: - name: install packages - apt: + ansible.builtin.apt: name: - prometheus-node-exporter - nfs-common - qemu-guest-agent update_cache: yes - name: start guest qemu-guest-agent - service: + ansible.builtin.service: name: qemu-guest-agent state: started enabled: yes diff --git a/ansible/installation/inst-wireguard.yaml b/ansible/installation/inst-wireguard.yaml index ce2067c..90f1a5f 100644 --- a/ansible/installation/inst-wireguard.yaml +++ b/ansible/installation/inst-wireguard.yaml @@ -4,11 +4,11 @@ become: yes tasks: - name: install wireguard - apt: + ansible.builtin.apt: name: wireguard update_cache: yes - name: generate private and public keypair - shell: | + ansible.builtin.shell: | wg genkey | tee privatekey | wg pubkey > publickey chmod 0400 privatekey chmod 0400 publickey diff --git a/ansible/installation/inst-zsh.yaml b/ansible/installation/inst-zsh.yaml index 781ada1..68d570e 100644 --- a/ansible/installation/inst-zsh.yaml +++ b/ansible/installation/inst-zsh.yaml @@ -4,7 +4,7 @@ become: yes tasks: - name: install zsh - apt: + ansible.builtin.apt: name: zsh state: present update_cache: true diff --git a/ansible/maintenance/maint-diskspace.yaml b/ansible/maintenance/maint-diskspace.yaml index 81b9a58..fb17ad6 100644 --- a/ansible/maintenance/maint-diskspace.yaml +++ b/ansible/maintenance/maint-diskspace.yaml @@ -3,10 +3,10 @@ hosts: "{{ hosts }}" tasks: - name: get disk usage - command: df -h + ansible.builtin.command: df -h register: disk_usage - name: check disk space available - shell: df -Ph / | awk 'NR==2 {print $5}' + ansible.builtin.shell: df -Ph / | awk 'NR==2 {print $5}' register: disk_usage # - name: send discord message when disk space is over 80% # uri: diff --git a/ansible/maintenance/maint-reboot-required.yaml b/ansible/maintenance/maint-reboot-required.yaml index f6b87ca..6ef1e4e 100644 --- a/ansible/maintenance/maint-reboot-required.yaml +++ b/ansible/maintenance/maint-reboot-required.yaml @@ -5,9 +5,9 @@ tasks: - name: check if system reboot is required become: true - stat: + ansible.builtin.stat: path: /var/run/reboot-required register: reboot_required - - debug: + - ansible.builtin.debug: msg: "Reboot is required" when: reboot_required.stat.exists diff --git a/ansible/maintenance/maint-reboot.yaml b/ansible/maintenance/maint-reboot.yaml index 723f95f..4aa1913 100644 --- a/ansible/maintenance/maint-reboot.yaml +++ b/ansible/maintenance/maint-reboot.yaml @@ -4,5 +4,5 @@ become: yes tasks: - name: reboot machine - reboot: + ansible.builtin.reboot: reboot_timeout: 3600 diff --git a/ansible/notification/notify-discord.yaml b/ansible/notification/notify-discord.yaml index 7d04775..f930707 100644 --- a/ansible/notification/notify-discord.yaml +++ b/ansible/notification/notify-discord.yaml @@ -3,7 +3,7 @@ hosts: "{{ hosts }}" tasks: - name: send discord message - uri: + ansible.builtin.uri: url: "your-webhook" method: POST body_format: json diff --git a/ansible/update/upd-apt.yaml b/ansible/update/upd-apt.yaml index d689830..6371aa9 100644 --- a/ansible/update/upd-apt.yaml +++ b/ansible/update/upd-apt.yaml @@ -4,23 +4,23 @@ tasks: - name: Update packages with apt when: ansible_pkg_mgr == 'apt' - apt: + ansible.builtin.apt: update_cache: yes - name: Update packages with yum when: ansible_pkg_mgr == 'yum' - yum: + ansible.builtin.yum: name: '*' state: latest - name: Upgrade packages with apt when: ansible_pkg_mgr == 'apt' - apt: + ansible.builtin.apt: upgrade: dist - name: Upgrade packages with yum when: ansible_pkg_mgr == 'yum' - yum: + ansible.builtin.yum: name: '*' state: latest exclude: kernel* diff --git a/vagrant/hyperv/ubuntu/docker/playbook.yaml b/vagrant/hyperv/ubuntu/docker/playbook.yaml index f2f1566..7ce0fa5 100644 --- a/vagrant/hyperv/ubuntu/docker/playbook.yaml +++ b/vagrant/hyperv/ubuntu/docker/playbook.yaml @@ -3,7 +3,7 @@ become: yes tasks: - name: install prerequisites - apt: + ansible.builtin.apt: name: - apt-transport-https - ca-certificates @@ -12,13 +12,13 @@ - software-properties-common update_cache: yes - name: add apt-key - apt_key: + ansible.builtin.apt_key: url: https://download.docker.com/linux/ubuntu/gpg - name: add docker repo - apt_repository: + ansible.builtin.apt_repository: repo: deb https://download.docker.com/linux/ubuntu focal stable - name: install docker - apt: + ansible.builtin.apt: name: - docker-ce - docker-ce-cli @@ -26,4 +26,4 @@ - docker-compose update_cache: yes - name: add userpermissions - shell: "usermod -aG docker vagrant" + ansible.builtin.shell: "usermod -aG docker vagrant" diff --git a/vagrant/hyperv/ubuntu/microk8s-installed/playbook.yaml b/vagrant/hyperv/ubuntu/microk8s-installed/playbook.yaml index 8412079..0c050c6 100644 --- a/vagrant/hyperv/ubuntu/microk8s-installed/playbook.yaml +++ b/vagrant/hyperv/ubuntu/microk8s-installed/playbook.yaml @@ -3,9 +3,9 @@ become: yes tasks: - name: install microk8s - snap: + community.general.snap: classic: yes name: microk8s - name: add userpermissions - shell: "usermod -aG microk8s vagrant" + ansible.builtin.shell: "usermod -aG microk8s vagrant" diff --git a/vagrant/hyperv/ubuntu/plain-with-cockpit/playbook.yaml b/vagrant/hyperv/ubuntu/plain-with-cockpit/playbook.yaml index fad86e6..993f17e 100755 --- a/vagrant/hyperv/ubuntu/plain-with-cockpit/playbook.yaml +++ b/vagrant/hyperv/ubuntu/plain-with-cockpit/playbook.yaml @@ -3,6 +3,6 @@ become: yes tasks: - name: install cockpit - apt: + ansible.builtin.apt: name: cockpit update_cache: yes