Ansible-roles

This repository is dedicated to storing a collection of diverse roles designed to be executed within the Ansible. These roles aim to automate various tasks and streamline the configuration and management processes in our infrastructure.

MIT License

Stars
0
Committers
2

ansible-roles

Description

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.

Roles Overview

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.

Requirements

To use these roles, you need to have Ansible installed on your system. You can install Ansible using the following command:

pip install ansible

You also need to have a basic understanding of Ansible and how to create playbooks to run the roles on your target hosts.

How to Use

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.yml

Replace inventory with the path to your inventory file and playbook.yml with the path to your playbook file.

Example Create a inventory file

echo "[servers]" > inventory
echo "server1 ansible_host=xx.xx.xx.xx" >> inventory
echo "server2 ansible_host=xx.xx.xx.xx" >> inventory

Example Create a playbook file

echo "- hosts: servers" > playbook.yml
echo "  roles:" >> playbook.yml
echo "    - { role: commons, tags: commons }" >> playbook.yml