Install basic packages and update OS, create a FTP user, install Nginx on latest version, PHP 7.2/PHP 7.3/PHP 7.4 with specific modules and MySQL Community Server 5.6.49.
- Allow Ansible Server communicate to new instante, executing the command
ssh-copy-id root@IPVIRTUALMACHINE
; - Add the IPVIRTUALMACHINE on
/etc/ansible/hosts
file; - Insert the IPVIRTUALMACHINE on file main.yml and choose wich are roles do you execute;
- Execute the playbook
main.yml
; And Voalá...
OBS 1: The MySQL root password is on the directory vars, roles/mysqld/vars/
.
OBS 2: The WebServer Username is defined on roles/usrdev/vars/main.yml
.
OBS 3: You need to create a new nginx .conf file to add a URL of your application.
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: Uncoment role line to install one or more packages, choose one version of PHP.
---
- name: Apply common configuration on webserver instance
hosts: IPVIRTUALMACHINE
gather_facts: no
ignore_errors: yes
roles:
# - { role: packages }
# - { role: nginx }
# - { role: php7.2 }
# - { role: php7.3 }
# - { role: php7.4 }
# - { role: vsftpd }
# - { role: usrdev }
# - { role: mysqld }
Use where you think you will contribute :)
- Joel Pinheiro - Github - joelcpinheiro