Ansible Playbook to Setup Amazon Linux Server With a WordPress Website
A simple ansible playbook to setup a wordpress website on amazon linux based servers with custom virtual host on apache webserver. Ansible is an open-source software provisioning tool by Red Hat. We can use Ansible for cloud provisioning, configuration management, application deployment etc.
In this repo I have created a simple playbook to create a WordPress website with apache, MySQL database and PHP7.4 on Amazon Linux based servers. As of now this is just a experimental work on ansible palybook. But this can be edited to use for other linux OS families also.
- One step creation of website is desired number of servers.
- Variables file to manage MySQL root password, WordPress database details etc.
- Can also specify major php ini settings like upload_max_filesize , memory_limit etc using variables file
- All the components are installed through the playbook like (Apache, MySQL, PHP, Wordpress)
yum install git -y
amazon-linux-extras ansible2 -y
git clone https://github.com/MarkAntonyGit/Ansible-Lamp-WordPress.git
cd Ansible-Lamp-WordPress
Vim hosts (Add ansible client server details)
Vim keyfile.pem (Add private key file for ansible client servers)
chmod 600 keyfile.pem
-- Sample Hosts File
ansible -i hosts all -m ping (To check your master and client connection)
vim lamp_wp_variables.yml (To edit variables)
ansible-playbook -i hosts playbook_lamp_wordpress.yml --syntax-check
ansible-playbook -i hosts playbook_lamp_wordpress.yml
--Sample Variables File
--Play Outputs
--Website Outputs
If you are using a demo website name. Please use the following online tool for checking the website via hosts method or you can use the local hosts file of your PC.
-------- -----------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------