This is a Ansible role to deploy a LAMP Stack on centos7/amazon-linux2 hosts.
- Roles let you automatically load related vars, files, tasks, handlers, and other Ansible artifacts based on a known file structure. After you group your content in roles, you can easily reuse them and share them with other users.Each directory contains a main.yml file which contains relevant content.
This is the structure of role I have created for this project,
├── defaults
│ └── main.yml
├── files
├── handlers
│ └── main.yml
├── meta
│ └── main.yml
├── README.md
├── tasks
│ ├── amazon.yml
│ ├── centos.yml
│ └── main.yml
├── templates
│ ├── httpd.conf.temp
│ └── virtualhost.conf.temp
├── tests
│ ├── inventory
│ └── test.yml
└── vars
└── main.yml
- Apache Webserver
- php7.4
- Mariadb-database-server
Latest ansible version installed.
- Add hosts in an inventory file(say inventory.txt) under your working directory.
- Configuration of variables for both apache (port number,httpd_user,httpd_group) and mariadb (domain_name,mariadb_root_password,mariadb_database_name,mariadb_database_user_name,mariadb_database_user_password) are included in main.yml file the vars section, which can be modified as per the requirement.
To check if the playbook have any syntax error, run:
ansible-playbook -i inventory_file your_custom.yml --syntax-check
Inroder to execute, run
ansible-playbook -i inventory_file your_custom.yml
'your_custom.yml' can be any playbook with the role included in it.