Compare commits

...

10 commits

10 changed files with 89 additions and 25 deletions

View file

@ -11,6 +11,7 @@
state: present state: present
- name: configure dnf-automatic - name: configure dnf-automatic
become: true
lineinfile: lineinfile:
path: /etc/dnf/automatic.conf path: /etc/dnf/automatic.conf
state: present state: present
@ -18,7 +19,8 @@
line: "{{ item.line }}" line: "{{ item.line }}"
with_items: with_items:
- { regexp: '^upgrade_type.=', line: 'upgrade_type = security' } - { regexp: '^upgrade_type.=', line: 'upgrade_type = security' }
- { regexp: '^emit_via.=', line: 'emit_via = stdio' } - { regexp: '^emit_via.=', line: 'emit_via = stdio,motd' }
- { regexp: '^apply_updates.=', line: 'apply_updates = yes' }
- name: enable dnf-automatic timer - name: enable dnf-automatic timer
systemd: systemd:

View file

@ -1,4 +1,4 @@
--- ---
fedora_latest: 33 fedora_latest: 35
fedora_minimum: 31 fedora_minimum: 33
fedora_target: "{{ fedora_latest|int }}" fedora_target: "{{ fedora_latest|int }}"

View file

@ -0,0 +1,7 @@
---
BAD_SERVICES:
- postfix
- rpcbind
- rsyncd.service
- rsyncd.socket

View file

@ -0,0 +1,13 @@
---
- name: Install required dependency libsemanage-python
yum:
name: libsemanage-python
state: latest
when: (ansible_distribution_major_version is version('7', '='))
- name: Install required dependency python3-policycoreutils
dnf:
name: python3-policycoreutils
state: latest
when: (ansible_distribution_major_version is version('8', '>='))

View file

@ -0,0 +1,13 @@
---
- name: Install required dependency python3-libsemanage
dnf:
name: python3-libsemanage
state: latest
when: (ansible_distribution_major_version is version('31', '>='))
- name: Install required dependency libsemanage-python
dnf:
name: libsemanage-python
state: latest
when: (ansible_distribution_major_version is version('30', '<='))

View file

@ -1,27 +1,21 @@
--- ---
#- name: Disallow root SSH access
# lineinfile:
# dest: /etc/ssh/sshd_config
# regexp: "^PermitRootLogin"
# line: "PermitRootLogin no"
# state: present
# notify: Restart ssh
- name: include SELinux package tasks for EL (CentOS/RHEL)
include_tasks: centos-selinux.yml
when: (ansible_distribution in ["CentOS" , "Red Hat Enterprise Linux", "RedHat"])
# untested on debian/ubuntu - name: include SELinux package tasks for Fedora (non-atomic)
- name: disable services include_tasks: fedora-selinux.yml
when: (ansible_distribution in ["Fedora"] and not is_atomic)
# likely to break on non-RHEL/derivatives, could use improvement.
- name: enable firewalld
service: service:
name: "{{ item }}" name: firewalld
state: stopped state: started
enabled: no enabled: yes
with_items:
- postfix
- rpcbind
- rsyncd.service
- rsyncd.socket
ignore_errors: true
- name: disable password auth - name: SSH - disable password auth
lineinfile: lineinfile:
dest: /etc/ssh/sshd_config dest: /etc/ssh/sshd_config
regexp: "^PasswordAuthentication" regexp: "^PasswordAuthentication"
@ -29,4 +23,27 @@
state: present state: present
notify: restart sshd notify: restart sshd
- name: SSH - config port 1181
lineinfile:
path: /etc/ssh/sshd_config
regexp: '^Port '
line: 'Port 1181'
insertbefore: "(^|#)AddressFamily.*"
validate: '/usr/sbin/sshd -t -f %s'
notify: restart sshd
- name: allow custom SSH port in selinux
seport:
ports: 1181
proto: tcp
setype: ssh_port_t
state: present
when: (ansible_selinux is defined and ansible_selinux != False and ansible_selinux.status == 'enabled')
# also likely to break on non-RHEL/derivatives, could use improvement too.
- name: allow custom SSH port in firewalld
firewalld:
port: 1181/tcp
permanent: yes
immediate: yes
state: enabled

View file

@ -12,6 +12,7 @@ COMMON_PKGS:
- rsync - rsync
- lsof - lsof
- firewalld - firewalld
- mosh
EL_PKGS: EL_PKGS:
- iperf3 - iperf3
- nmap - nmap
@ -20,5 +21,6 @@ EL_PKGS:
- psmisc # may work on deb/ubuntu also? - provides killall - psmisc # may work on deb/ubuntu also? - provides killall
- wget - wget
- cockpit - cockpit
- ioping
DEB_PKGS: DEB_PKGS:
- dnsutils - dnsutils

View file

@ -1,5 +1,10 @@
--- ---
- name: update apt caches
apt:
update_cache: yes
when: (ansible_os_family in ["Debian"] )
- name: install packages - name: install packages
package: package:
name: "{{ item }}" name: "{{ item }}"
@ -7,6 +12,7 @@
with_items: with_items:
- tuned - tuned
- tuned-utils - tuned-utils
# - tuned-profiles-realtime # only on Fedora? not on centos 8 stream
- name: start service - name: start service
service: service:
@ -22,4 +28,4 @@
- name: deploy {{ tuned_custom_profile }} based on {{ tuned_base_profile }} - name: deploy {{ tuned_custom_profile }} based on {{ tuned_base_profile }}
include: configure-custom-profile.yml include: configure-custom-profile.yml
when: (ansible_distribution in ["CentOS" , "Red Hat Enterprise Linux", "Fedora" ] and not is_atomic) when: (ansible_distribution in ["CentOS" , "Red Hat Enterprise Linux", "RedHat", "Fedora" ] and not is_atomic)

View file

@ -6,6 +6,10 @@ EL_ZFS_PKGS:
- kernel-devel - kernel-devel
- "@Development tools" - "@Development tools"
- dkms - dkms
- libuuid-devel
- libblkid-devel
- libtirpc-devel
- openssl-devel
- zfs - zfs
UBUNTU_ZFS_PKGS: UBUNTU_ZFS_PKGS:
- zfsutils-linux - zfsutils-linux

View file

@ -2,7 +2,7 @@
- name: include zfs-release tasks (CentOS/RHEL/Fedora) - name: include zfs-release tasks (CentOS/RHEL/Fedora)
include_tasks: zfs-release.yml include_tasks: zfs-release.yml
when: ('zfs-release' not in ansible_facts.packages) and (ansible_distribution in ["CentOS" , "Red Hat Enterprise Linux", "Fedora" ]) when: ('zfs-release' not in ansible_facts.packages) and (ansible_distribution in ["CentOS" , "Red Hat Enterprise Linux", "RedHat", "Fedora" ])
- name: include zfs installation tasks (Ubuntu) - name: include zfs installation tasks (Ubuntu)
include_tasks: ubuntu.yml include_tasks: ubuntu.yml
@ -10,7 +10,7 @@
- name: include zfs installation tasks (CentOS/RHEL/Fedora) - name: include zfs installation tasks (CentOS/RHEL/Fedora)
include_tasks: el.yml include_tasks: el.yml
when: (ansible_distribution in ["CentOS" , "Red Hat Enterprise Linux", "Fedora" ] and not is_atomic) when: (ansible_distribution in ["CentOS" , "Red Hat Enterprise Linux", "RedHat", "Fedora" ] and not is_atomic)
- name: load zfs module - name: load zfs module
modprobe: modprobe: