Ansible's Role to install secure LEMP stack + drupal + civiCRM.
python-dev
python-pip
python-openssl
ansible 2.2+
The following commands will install ansible (via pip) in your system.
git clone https://github.com/mauhftw/ansible-drupal
chmod +x setup_ansible.sh
sudo ./setup_ansible.sh
Ansible-drupal contains the following roles:
common
Installs basic tools & dependenciesufw
Installs ufw and basic rules (HTTP/s, SSH)ssh
Configures SSHno_spoofing
Prevents IP spoofingfail2ban
Installs and configures fail2ban (SSH)sendmail
Setups MTA sendmail (sendonly emails)letsencrypt
Install letsencrypt certificatesnginx
Install nginx-full & nginx-extras + secure drupal configsmysql
Install mysqlphp
Install php7.0drupal
Install drupalcivicrm
Install civiCRM modulebackup
Install schedules configurable backups cronjobs to AWS S3
Before you run the ansible role, please configure your group_vars. In the next paragraph basic notes about vars will be given.
TIP
: Use default local.yml values for references
ssh_users:
Users allowed to ssh your current system (AllowUsers)
fail2ban_default_bantime:
Default Fail2ban's Bantimefail2ban_default_findtime:
Default Fail2ban's findtimefail2ban_default_destemail:
Email address for notificationsfail2ban_default_sendername:
Email name for notificationsfail2ban_default_maxretries:
Max number of retriesfail2ban_ssh_port:
Default SSH portfail2ban_default_ssh_path:
SSH's log pathfail2ban_mta:
Default MTA
sendmail_user:
Account's username for sendmail
webroot_dir:
Webroot directory name (e.g project)letsencrypt_webroot_path:
Webroot path (e.g /var/www/project)letsencrypt_email:
mail@yourdomain.app
nginx_worker_processes:
Number of worker processesdomain:
Domain name (e.g yourdomain.app)domain_www:
www domain name (e.g www.yourdomain.app)resolver:
Default resolver's ip
mysql_port:
Mysql's portmysql_bind_address:
Mysql's bind addressmysql_password:
Mysql's password. Edit this entry in vault_file.txtmysql_packages:
Mysql's packages to install
php_repo:
PHP's repophp_packages:
PHP's packages to install
drupal_db:
Drupal databasedrupal_user:
Drupal database userdrupal_password:
Drupal database password. Edit this entry in vault_file.txtdrupal_docroot:
Webroot path withour project's directory (eg. /var/www)drupal_version:
Drupal version to install (e.g drupal-7.54)drupal_dir:
Webroot directory name (e.g project)drupal_absolute_docroot:
Webroot path (e.g /var/www/project)site_mail:
Drupal's email for notification purposessite_name:
Drupal's site name.account_mail:
Drupal's main accountuser:
Admin usernamepassword:
Admin password. Edit this entry in vault_file.txt
rootdir:
Webroot directory name (e.g project)civicrm_db:
Civicrm databasecivicrm_user:
Civicrm database usercivicrm_password:
Civicrm database password.Edit this entry in vault_file.txtcivicrm_url:
Civicrm download pagecivicrm_destination:
Civicrm temporal directory for configuration purpose
aws_access_key:
Your AWS's access keyaws_access_secret:
Your AWS's access secret keyregion:
AWS's regions3_bucket:
S3's bucket names3_prefix:
S3's bucket prefix namebackup_name:
Backup namebackup_tmp_dest:
Backup temporal destination (e.g /tmp/dump)
cronjob_name:
Cronjob's backup namecronjob_schedule_minute:
cronjob_schedule_hour:
cronjob_schedule_day:
cronjob_schedule_month:
cronjob_schedule_weekday:
These parameters work like a conventional unix-like cronjob.
Field | Required | Allowed values | Allowed special characters |
---|---|---|---|
Minutes | Yes | 0-59 * , - | - |
Hours | Yes | 0-23 * , - | - |
Day of month | Yes | 1-31 * , - ? L W | - |
Month | Yes | 1-12 or JAN-DEC * , - | - |
Day of week | Yes | 0-6 or SUN-SAT * , - ? L # | - |
Year | No | 1970–2099 * , - |
For more information, please visit: https://en.wikipedia.org/wiki/Cron
Ansible-Vault is a feature of ansible that allows keeping sensitive data such as passwords or keys in encrypted files, rather than as plaintext in your playbooks or roles. To edit the vault file, please use the following command
$ ansible-vault edit vault_password.txt
ENTER your VAULT PASSWORD: supersecret2314! (in this example)
And then you can edit your encrypted vars.
If you want to use vault, please use the following flag --ask-vault-pass
or for automating processing place the password in a file and use -vault-password-file=/path/to/vault_file
flag
If you wish to change your password on a vault-encrypted file or files, you can do so with the rekey command:
$ ansible-vault rekey vault_password.txt
For more information, please check ansible-vault docs:
Before Running the Role please configure and check your hosts, group_vars, sudo password, vault password.
$ ansible-playbook -i hosts/testing.yml master.yml --ask-become-pass --vault-password-file=vault_password.txt