This is repository contains custom Ansible roles that can be used to automate tasks in a Linux environment. The roles are written in language Yaml and can be used to perform various tasks, such as installing packages, managing users, and configuring services.
The following roles are available in this repository:
- Chrony: Installs and configures the Chrony NTP service on a host machine.
- Commons: Performs basic hardening of a Linux system, including installing essential packages, adding a user to the sudo group, and setting a custom MOTD.
- Docker: Installs Docker on a host machine and configures Docker Compose and related settings.
To use these roles, you need to have Ansible installed on your system. You can install Ansible using the following command:
pip install ansibleYou also need to have a basic understanding of Ansible and how to create playbooks to run the roles on your target hosts.
To use these roles, you need to have Ansible installed on your system. You can then create a playbook that includes the roles you want to run on your target hosts. For example, to run the commons role on a group of servers, you can create a playbook like this:
- hosts: servers
roles:
- { role: commons, tags: commons }You can then run the playbook using the ansible-playbook command:
ansible-playbook -i inventory playbook.ymlReplace inventory with the path to your inventory file and playbook.yml with the path to your playbook file.
echo "[servers]" > inventory
echo "server1 ansible_host=xx.xx.xx.xx" >> inventory
echo "server2 ansible_host=xx.xx.xx.xx" >> inventoryecho "- hosts: servers" > playbook.yml
echo " roles:" >> playbook.yml
echo " - { role: commons, tags: commons }" >> playbook.yml