Welcome to our GitHub repository where you'll find Ansible scripts written to facilitate the development of web applications by mirroring a typical production environment. This approach might address common challenges where hardware or time constraints make it difficult to set up a test or acceptance environment that accurately reflects various production settings.
This repository hosts Ansible scripts that allow you to deploy a complex web application environment either locally on your development machine, on-premises hardware, or in a cloud setup. By leveraging these scripts, developers may accelerate the setup process and ensure consistency across different environments, from development to production.
The provided Ansible scripts are prepared to configure the following roles essential for a full-featured web application infrastructure:
- Web Server: Hosts the web application interface.
- Cache: Improves response time and reduces load on the database by storing recently accessed data.
- Database: Manages data storage and retrieval.
- Identity Server: Handles authentication and authorization services.
- REST API endpoints: Facilitates communication between the client apps and server.
- Load Balancer: Distributes incoming network traffic across multiple servers.
- Certificate Authority: Issues SSL/TLS certificates for secured communications.
- HTTPS offloading: Relieves backend application servers of the processing load associated with encrypting and decrypting public HTTPS traffic.
- Prometheus monitoring: Collects and stores metrics as time-series data.
- Grafana dashboards: Provides visualization of the metrics collected by Prometheus.
Before running the Ansible playbooks, ensure that you have the following:
- Ansible installed on your local machine or a control node.
- Sufficient privileges to manage the systems designated in your inventory.
- Machines (VMs, containers, or bare metal) defined in your hosts file and accessible over your network.
To deploy the roles listed above, follow these steps:
-
Navigate to your local clone of this repository: Open a terminal and ensure you are in the repository directory.
-
Setup your inventory: Ensure that your
hosts
file in the./playbooks
directory is updated to reflect the infrastructure where you want to deploy the roles. -
Configure role variables Default variables are provided for all roles in
role_folder/defaults/vars.yml
and initialized by reading environment variables. Example environment variables are available. -
Execute the Ansible Playbook: Run the following command to start the deployment process. This command will prompt you for your sudo password due to the
-K
flag and provide detailed output with the-vvv
verbosity level.ansible-playbook site.yml -K -i hosts -vvv
After executing the playbook, all specified roles should be successfully configured and running across your specified machines. You can verify the status of each role through the corresponding management interfaces or by checking the services directly on each machine.
If you encounter any issues during the setup, consider the following troubleshooting steps:
- Verify network connectivity between your control node and the target machines.
- Check the permissions and authentication details for the accounts used.
- Review the verbose output provided by the Ansible execution for errors or warnings.
We welcome contributions to improve the scripts or documentation. Please feel free to fork the repository, make your changes, and submit a pull request.