diff --git a/prepeare_RHEL_Server.yml b/prepeare_RHEL_Server.yml new file mode 100644 index 0000000..1880247 --- /dev/null +++ b/prepeare_RHEL_Server.yml @@ -0,0 +1,32 @@ +- name: Prepeare OS Linux (Rocky + Ubuntu) after install + hosts: all + become: yes + + tasks: + - block: + - name: Remove soft + dnf: name="{{ item }}" state=absent autoremove=yes + loop: [qemu*, cockpit*, postfix*, libvirt*, podman*] + - name: Install soft + dnf: name="{{ item }}" state=latest + loop: [unzip, mtr, yum-utils, epel-release, net-tools, wget, tar, lsof, sysstat, smartmontools, which, iperf3, vim, htop, iftop, nethogs, tree] + - name: Remove services from firewall + firewalld: service="{{ item }}" state=disabled permanent=true immediate=true + loop: [cockpit, dhcpv6-client] + - name: Create aliases + lineinfile: path=/etc/bashrc line="{{ item }}" + loop: + - alias lll='ls -alh --color=auto' + - alias sss='ss -tulpn' + - alias df='df -h' + when: ansible_facts['os_family'] == "RedHat" + + - name: Disable SELinux + selinux: state=disabled + when: ansible_facts['selinux']['status']!="disabled" + + - name: Do not prompt for sudo password for zmaster + lineinfile: path="/etc/sudoers" line="{{ item }}" + loop: + - "zmaster ALL=(ALL) NOPASSWD: ALL" + diff --git a/update_RHEL_Server.yml b/update_RHEL_Server.yml new file mode 100644 index 0000000..a55d8b6 --- /dev/null +++ b/update_RHEL_Server.yml @@ -0,0 +1,20 @@ +- name: Update all system packages + hosts: all + become: yes + + tasks: + - name: Update packages to the latest version + dnf: name="*" state=latest + + - name: Check if a reboot is required + command: + cmd: needs-restarting -r + register: reboot_check + changed_when: false + failed_when: reboot_check.rc not in [0, 1] + + - name: Reboot the server only if needed + reboot: + when: reboot_check.rc == 1 + +