Giter Club home page Giter Club logo

ansible-server-voidlinux's Introduction

Ansible Server

Hello!

I use this Ansible script to do basic server configuration after a bare installation. What can it do?

  • Creates a user with root privileges.
  • Changes the default SSH port, disables password login, and copies your SSH key.
  • Configures the firewall.

Additionally:

  • In the docker folder, there is a docker-compose.yml with my container configuration, this script will not run them automatically.
  • The script automatically creates a convenient file structure in /home for storing Docker containers data.

I hope you find this project interesting and learn something new from it, maybe even consider using it!

Installation

I assume you've just installed your system, and it's bare. This instruction will help you deploy my configuration correctly

Installing the necessary dependencies

0.1 Depending on your distribution, you need to update your system and then install git, python, and ansible: Example:
Void
xbps-install -Su
xbps-install -S git python ansible

0.2 If you haven't installed locales yet, you need to do so, otherwise ansible won't be able to run: You need to uncomment #en_US.UTF-8 UTF-8 line:
Void
vim /etc/default/libc-locales
xbps-reconfigure -fa

Arch
vim /etc/locale.gen
locale-gen

0.3 Cloning the repo
git clone https://github.com/alytidae/ansible-server-voidlinux

Add an additional disk configuration

This is just my recommendation, but before or after running (whichever you prefer), you could set up disk redundancy using two excellent tools: snapraid and mergerfs. This will help prevent data loss in case one of the disks fails. However, it still won't replace backups!

Changing config files

In the project, there are two places for configuration:

  • defaults/main.yml - for Ansible configuration.
  • docker/docker.env - for Docker configuration.

This Ansible script won't automatically start these containers; you'll have to do it manually after installation. Therefore, you only need to configure defaults/main.yml.

1.1 Open the file defaults/main.yml, and modify all settings; there's a comment next to each one so you won't get confused.

1.2(Optional) Open the file docker/docker.env, and modify all Docker settings.

Starting the Ansible

1.3 In the project folder:
ansible-playbook playbook.yml

Configure backup

Don't forget to set up a backup of your server. I highly recommend using restic along with cron.

Additional Information

If you want to start Docker containers, you can simply go to the docker folder and run
sudo docker-compose --env-file docker.env up
However, if you want to use Grafana, before that, you need to copy the file docker/prometheus-config/prometheus.yml to /home/your_username/containers/prometheus on the server. This is the default Prometheus config, but there are additional lines to make node-exporter work for you. After that, you can start the Docker containers, and everything should run without errors.

Initially, this project was conceived as deploying the server only on the Voidlinux distribution, as there are some peculiarities when working with Ansible. However, in the end, I abandoned this idea because I didn't use anything specific to Voidlinux.

License

Licensed under The MIT License

ansible-server-voidlinux's People

Contributors

alytidae avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.