acandid.httpd
Ansible Role: httpd
=========
This is a simple Ansible role to install and set up the Apache web server on RHEL/CentOS 7.
- It installs the needed packages.
- It manages the main configuration file.
- It installs custom certificate files.
Requirements
- The firewall settings are not part of this role.
Role Variables
None of the variables below are required.
Variable | Default | Comments |
---|---|---|
web_customlog |
logs/access_log | Where to find the access log file (http) |
web_vhosts.documentroot |
'/var/www/html' | The directory where HTML files are stored |
web_errorlog |
logs/error_log | Where to find the error log file (http) |
web_ssl_port |
443 | Port number for https connections |
web_port |
80 | Port number for http connections |
web_vhosts.serveradmin |
webmaster@yourdomain.com | Email of the server administrator |
web_vhost_servername |
Hostname the server uses to identify itself | |
certificate_chain_file |
/etc/pki/tls/certs/ | Name of a certificate chain file. See below, Installing certificates |
certificate_file |
/etc/pki/tls/certs/ | Name of the certificate file. See below, Installing certificates |
certificate_key_file |
/etc/pki/tls/private/ | Name of the certificate key file. See below, Installing certificates |
web_ssl_cipher_suite |
... | See default variables |
web_ssl_protocol |
'all -SSLv3 -SSLv2' | Specifies which SSL/TLS protocol versions can be used |
web_allow_override |
"All" | AllowOverride settings |
web_options |
"-Indexes +FollowSymLinks" | Additional options |
Dependencies
There are no dependencies.
Installing certificates
By default, this role uses a self-signed certificate created when mod_ssl
is installed. If you want to use your own certificate, place it in a subdirectory called files/
next to your main playbook. Then set the right role variables. For details on creating your own self-signed certificates, check out the CentOS Wiki.
For example, if you have a server key example.com.key
and a certificate file example.com.crt
, your directory structure should look like this:
.
└── files
├── example.com.crt
└── example.com.key
|__ root-certificate.crt # Example CA file
The same applies to a certificate chain file and CA certificate file. Make sure they are in the files/
directory and set the certificate_chain_file
variable.
Example Playbook
hosts: server
become: yes
vars:
- vhost_name: "example" # Enter your vhost name, for example: yourdomain.com. This will create yourdomain.com.conf and ssl.yourdomain.com.conf
roles:
- /path/acandid.httpd
...
Contributing
Feedback, feature requests, and ideas are welcome and can be submitted in the Issues section.
Author Information
LinkedIn: https://br.linkedin.com/in/almircandido
ansible-galaxy install acandid.httpd