Skip to content

Latest commit

 

History

History
151 lines (109 loc) · 4.92 KB

README.md

File metadata and controls

151 lines (109 loc) · 4.92 KB

Ansible Installation and Software Deployment Guide

📚 Overview

This README file provides step-by-step instructions on how to install Ansible on a local Linux machine and use it to manage software installations. Ansible is a powerful automation tool that simplifies the process of managing configurations and deploying applications across multiple servers.

🛠️ Prerequisites

Before you begin, ensure that you have the following 📝:

  1. A local Linux machine (e.g., Ubuntu, CentOS . . .) with root or sudo access.
  2. Internet connectivity to download Ansible and software packages.
  3. Basic knowledge of the Linux command line.

🚀 Install Ansible on Linux, follow these steps:

  1. Add the Ansible repository to your system's package manager:
sudo apt-add-repository ppa:ansible/ansible
  1. Update the package lists to include the newly added repository:
sudo apt update
  1. Install Ansible:
sudo apt install ansible
  1. Verify the Ansible installation by checking the version:
ansible --version

The output should display the installed Ansible version information, confirming that the installation was successful.

🔧 Setup Ansible-Hosts file

The /etc/ansible/hosts file is the inventory file used by Ansible to define and organize the hosts (remote servers) that Ansible will manage. It is a text file that lists the hostnames or IP addresses of the remote servers and organizes them into groups.

For external machine or server,

[target-server] = Your target server name.

Replace 13.200.130.21 with your target server IP(s).

sudo nano /etc/ansible/hosts
#Ansible-Target-Server
[target-server]
13.200.130.21

For local machine or system,

sudo nano /etc/ansible/hosts
#Localhost
[localhost]
127.0.0.1 ansible_connection=local

📂 Code Clone

  1. Code clone on Local Machine.
git clone https://github.com/kuldipmori/ansible-software-install.git
  1. Enter in Direcotry.
cd ansible-software-install
  1. Excute Playbook
sudo ansible-playbook *.yaml

📂 Code Directories

.
├── cache-service
│   └── redis-install.yaml
├── database-install
│   ├── mysql-install.yaml
│   └── psql-install.yaml
├── package-management
│   └── apt-manage.yaml
├── README.md
├── software-install
│   ├── anydesk-install.yaml
│   ├── chrome-install.yaml
│   └── vscode-install.yaml
└── web-server
    ├── apache2-install.yaml
    └── nginx-install.yaml

5 directories, 10 files

Playbook file permission

-rwxr-xr-x  1 USER USER  312 Jul 18 11:03 *.yaml

For Excute playbooks in Linux-machine

sudo ansible-playbook *.yaml

📋 Playbook Descriptions

⚠️ NOTE: Make sure to run the playbook with appropriate privileges (e.g., sudo) to perform package management operations.

  1. package-management: This directory contains the apt-manage.yaml playbook, which handles package management tasks specific to the system's package manager (APT in this case). It may include tasks like updating the package cache, upgrading packages, or removing packages.

  2. software-install: This directory contains the chrome-install.yaml, anydesk-install.yaml and vscode-install.yaml playbooks. These playbooks handle the installation and configuration of specific software packages, such as Google Chrome and Visual Studio Code.

  3. web-server: This directory includes the nginx-install.yaml & apache2-install.yaml playbook. It focuses on the installation and setup of a web server, specifically Nginx, including tasks like package installation, configuration, and service management.

  4. cache-service: Automated Redis cache server installation with Ansible. Easily set up Redis server and CLI on target servers using the redis-install.yaml playbook.

  5. database-install: Automated database installation using Ansible. This playbook facilitates the setup of a database environment and the creation of a root user with a password.

Contribution

If you find any issues, have suggestions, or want to contribute to this repository, feel free to open an issue or submit a pull request. Your contributions are welcome!

How to Contribute

  1. Fork the repository.
  2. Create a new branch: git checkout -b feature/your-feature-name.
  3. Manage Readme.md file proper formate.
  4. Make your changes and commit them: git commit -m 'Add your commit message'.
  5. Push to the branch: git push origin feature/your-feature-name.
  6. Open a pull request and describe your changes.

Additional Note

If you have any useful Ansible playbooks that could benefit this project, we encourage you to share them! Open a pull request and let's make this repository even more valuable.

About the Author

This project was created by Kuldip Mori as an example for ansible-software-install