📚 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 📝:
- A local Linux machine (e.g., Ubuntu, CentOS . . .) with root or sudo access.
- Internet connectivity to download Ansible and software packages.
- Basic knowledge of the Linux command line.
- Add the Ansible repository to your system's package manager:
sudo apt-add-repository ppa:ansible/ansible
- Update the package lists to include the newly added repository:
sudo apt update
- Install Ansible:
sudo apt install ansible
- 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.
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 on Local Machine.
git clone https://github.com/kuldipmori/ansible-software-install.git
- Enter in Direcotry.
cd ansible-software-install
- Excute Playbook
sudo ansible-playbook *.yaml
.
├── 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
-
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. -
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. -
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. -
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. -
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.
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!
- Fork the repository.
- Create a new branch:
git checkout -b feature/your-feature-name
. - Manage Readme.md file proper formate.
- Make your changes and commit them:
git commit -m 'Add your commit message'
. - Push to the branch:
git push origin feature/your-feature-name
. - Open a pull request and describe your changes.
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.
This project was created by Kuldip Mori as an example for ansible-software-install