I have been learning from this book Fabio Alessandro Locati, published under Packt>.

There is one simple exercise where there is an example of “Configuring a basic server”. The codes can be found
Enabling EPEL
To enable EPEL, in RHEL/CentOS 7, just install the epel-release package
---
- hosts: all
remote_user: ansible
tasks:
- name: Ensure EPEL is enabled
yum:
name: epel-release
state: present
become: True
Python bindings for SELINUX
Ansible is written in python, and mainly use the Python bindings to operate on the operating system.
---
- hosts: all
remote_user: ansible
tasks:
- name: Ensure libselinux-python is present
yum:
name: libselinux-python
state: present
become: True
- name: Ensure libsemanage-python is present
yum:
name: libsemanage-python
state: present
become: True
Firewall Settings
---
- hosts: all
remote_user: ansible
tasks:
- name: Ensure FirewallD is running
service:
name: firewalld
state: started
enabled: True
become: True
- name: Ensure SSH can pass the firewall
firewalld:
service: ssh
state: enabled
permanent: True
immediate: True
become: True