{"id":18960612,"url":"https://github.com/adel-bz/server-auto-config","last_synced_at":"2026-02-12T08:08:30.456Z","repository":{"id":176849226,"uuid":"659636124","full_name":"adel-bz/Server-Auto-Config","owner":"adel-bz","description":"Config Servers With Ansible","archived":false,"fork":false,"pushed_at":"2025-04-26T10:00:41.000Z","size":58,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-13T08:50:16.545Z","etag":null,"topics":["ansible","automation","docker","fail2ban","gitlab-runner","linux"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/adel-bz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-06-28T08:42:07.000Z","updated_at":"2025-04-26T10:00:45.000Z","dependencies_parsed_at":null,"dependency_job_id":"e759b37e-a08e-4ab9-a7df-f90240993b67","html_url":"https://github.com/adel-bz/Server-Auto-Config","commit_stats":null,"previous_names":["adel-bz/ansible-server-config","adel-bz/server-config","adel-bz/server-auto-config"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/adel-bz/Server-Auto-Config","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adel-bz%2FServer-Auto-Config","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adel-bz%2FServer-Auto-Config/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adel-bz%2FServer-Auto-Config/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adel-bz%2FServer-Auto-Config/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adel-bz","download_url":"https://codeload.github.com/adel-bz/Server-Auto-Config/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adel-bz%2FServer-Auto-Config/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29361812,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-12T01:03:07.613Z","status":"online","status_checked_at":"2026-02-12T02:00:06.911Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ansible","automation","docker","fail2ban","gitlab-runner","linux"],"created_at":"2024-11-08T14:08:37.124Z","updated_at":"2026-02-12T08:08:30.442Z","avatar_url":"https://github.com/adel-bz.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Server Auto Config\n\n# Introduction\nWelcome to the Server Auto-Config Repository! This GitHub repository provides powerful tools and scripts for automating server setup and configuration. Whether you're a sysadmin/DevOps engineer looking to save time or a developer streamlining server provisioning, this repository simplifies the process, ensuring reliability and security. Join our community of contributors and experience the benefits of server automation today.\n\nhttps://github.com/adel-bz/Ansible-Server-Config/assets/45201934/46729180-8423-464c-b103-7bfbad9174b4\n \n\n## Roles\nWe have 8 roles for the config Ubuntu servers.\n\n### User Config Role: \n- In this role, we create a new user for servers and give access to the user to run ``` sudo ``` command without a password.\n### Manage packages Role: \n- In this role, we have 3 steps.\n\nStep 1: updating servers with ```apt-get update``` and ```apt-get upgrade``` commands and enabling automatic security updates.\n  \nStep 2: Removing unnecessary packages and services.\n\nStep 3: Removing old software packages and cleaning the package cache.\n### Install Dependencies Role: \n- This role is to install dependencies on servers. Dependencies include Nginx, Docker, docker-compose-plugin, Certbot, etc.\n### Gitlab-Runner Role:\n- Gitlab-Runner Role is to install and register gitlab-runner on servers.\n### SSH Role:\n- SSH Role is to config SSH service. First of all, we add SSH public key to servers for secure ssh connection and we change the ```sshd_config``` file in ```/etc/ssh/``` location with our sshd_config file. and in the end, we change the SSH port.\n\n\n\u003e **Note**\n\u003e \n\u003e The ```sshd_config``` file has the best practices config for SSH but you can use your ```sshd_config``` file instead of our ```sshd_config``` file.\n\n### Swap Config Role:\n- The role enables swap with 4G capacity on servers. Also, you can change the capacity in ```/roles/swap_config/tasks/main.yml```\n\n### Fail2ban Role:\n- This role is to install and config fail2ban. fail2ban is a service for controlling SSH connections.\n\n### Firewall Role:\n- The firewall Role is the last one and this role is to config the UFW firewall, we open HTTP, HTTPS, and SSH ports on UFW, and also we enable UFW on servers. in the end, we restart the servers.\n\n# Requirements\n\n### Ansible\nYou just have two Requirement. Install Ansible, You can use the below link to install Ansible on different os. \n\nhttps://adamtheautomator.com/install-ansible/\n\n#### Server OS: Ubuntu all versions\n\n# Usage\n\n### Step 1:\n- Clone the project\n```\ngit clone https://github.com/adel-bz/Ansible-Server-Config.git\n```\n### Step 2:\n- Go to the project directory.\n```\ncd Ansible-Server-Config\n```\n### Step 3:\n- Change variables in the ```all.yml``` file in ```/playbook/group_vars``` directory.\n  \n### Step 4:\n- Add remote servers to the ```inventory.cnf``` file in ```/playbook``` directory.\n\n\n\u003e **Note**\n\u003e \n\u003e This project only works on Ubuntu OS (all versions) on a remote server.\n\n\n\u003e **Note**\n\u003e \n\u003e You have to use a config file for ssh to servers. You can use this link https://linuxize.com/post/using-the-ssh-config-file/\n\u003e\n\u003e Or use another way to add servers to inventory.cnf file. You can see this link https://www.cherryservers.com/blog/how-to-set-up-ansible-inventory-file\n\n\u003e **Note**\n\u003e \n\u003e Change ```config.yml``` file in ```/playbook``` directory. if you don't need a role in ```config.yml``` file, you must comment that role.\n\n### Step 5:\n- Run the below command on your terminal in the ```/playbook``` directory.\n\n```\nansible-playbook -i inventory.cnf config.yml\n``` \n- If a server needs a password for SSH connection, Run the below command to ask password:\n\n```\nansible-playbook -i inventory.cnf config.yml -kK\n``` \n\n# Test Project\nIf you will get an error like the below image it means your config is successful. You will get this error because you changed the SSH port and Ansible can't connect to the server with port 22.\n![Screenshot from 2023-07-03 17-32-03](https://github.com/adel-bz/Ansible-Server-Config/assets/45201934/9a9ef4cc-5a39-4c47-9d58-a729da706942)\n\nOr we won't have any errors like the below image.\n![Screenshot from 2023-07-03 17-52-07](https://github.com/adel-bz/Ansible-Server-Config/assets/45201934/03e0c500-2a02-460c-a4b7-d200857ca954)\n\n# Contributing\nWe welcome contributions from the community to improve the Server Auto Config. To contribute:\n\n1. Fork the repository.\n\n2. Create a new branch for your feature/fix:\n```\ngit checkout -b feature-name\n```\n3. Commit your changes and push them to your forked repository:\n```\ngit commit -m \"Add a descriptive commit message\"\ngit push origin feature-name\n```\n4. Create a pull request. Your changes will be reviewed, and once approved, they will be merged into the main branch.\n\nPlease ensure your code adheres to the project's coding standards.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadel-bz%2Fserver-auto-config","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadel-bz%2Fserver-auto-config","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadel-bz%2Fserver-auto-config/lists"}