Automation with ansible of sample LAMP installation & configuration for kodekloudhub/learning-app-ecommerce.
This is automation with ansible of a sample e-commerce application built for learning purposes forked from kodekloudhub/learning-app-ecommerce.
Here's how to deploy it on CentOS systems with Docker containers:
- Install Docker with systemd. I used centos/systemd image and build my own with a little modifications by enabling ssh, then run it:
sudo docker run --privileged --name < target_node_name > --hostname < target_node_hostname > -v /sys/fs/cgroup:/sys/fs/cgroup:ro -p < example_port >:22 -d < modified_image_name >
- Install ansible on control node.
sudo yum install -y ansible
- Create inventory file.
sudo touch inventory.txt
sudo vi inventory.txt
< target_node_name > ansible_host=< target_node_ip > ansible_connection=ssh ansible_user=< user_name > ansible_ssh_pass= < user_password >
- Create playbook file.
sudo touch < playbook_name >.yaml
sudo vi < playbook_name >.yaml
ansible-playbook < playbook_name > -i inventory.txt
- SSH to target node to check automation.
sudo systemctl status httpd.service
sudo systemctl status mariadb.service
curl http://localhost