Coder Social home page Coder Social logo

sdiri / multi-linux-environment-automation-with-vagrant-ansible Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 7 KB

This repository hosts a versatile shell script tailored to automate lab environment setup across various Linux distributions (Ubuntu, AlmaLinux, Rocky Linux, etc.) using Vagrant. The script simplifies the installation of necessary packages, handles user management, automates SSH handshake, and facilitates Ansible setup on a single controller server

License: MIT License

Shell 100.00%

multi-linux-environment-automation-with-vagrant-ansible's Introduction

MIT License

Environment Setup Script

Overview

This Bash script is designed for setting up environments across multiple Linux machines using Vagrant and Ansible. The script automates the setup process, including the installation of necessary packages, user creation, SSH key acceptance, and more.

Features

  • User Management: Creates the 'ansible' user with sudo privileges and adds it to the 'wheel' group.
  • Package Installation: Installs required packages such as Python3, pip, and Ansible based on the Linux distribution.
  • Hostname Check: Installs Ansible specifically on the 'controller.lab.com' machine.
  • SSH Configuration: Accepts SSH keys for all provisioned machines to facilitate Ansible communication.

Functions

log_error()

  • Logs errors encountered during the Ansible setup process into /var/log/init_environment_setup_errors.log.

install_package()

  • Installs packages and handles installation errors gracefully.

install_ansible()

  • Installs Ansible based on the Linux distribution detected on the machine.

Main Execution

  1. Checks if the 'ansible' user exists and adds it if not present.
  2. Executes the Ansible setup script specifically on 'controller.lab.com'.
  3. Configures the 'known_hosts' file for SSH keys on each machine.

Usage

The script is intended to be used within a Vagrant environment for automatic setup and provisioning of multiple Linux machines. It requires minimal user intervention once initiated.

Notes

  • This script assumes familiarity with Vagrant, Bash scripting, and Linux system administration.
  • Users are advised to review the script and modify it according to specific requirements before usage.

multi-linux-environment-automation-with-vagrant-ansible's People

Contributors

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