thorian93.webserver
Ansible Role: Webserver
Not Maintained! Moved to Collection!
This role has moved to my main collection.
It is no longer maintained here!
For the latest content, please visit the collection.
This role is a helper role for easier use of webserver roles. It provides variables to be used in various webserver roles.
No Dragons Here!
There are no dragons left.
Requirements
No specific requirements needed; however, this role needs root access. You should use it in a playbook with become: yes
, like this:
- hosts: foobar
roles:
- role: thorian93.webserver
become: yes
Role Variables
Note: The variables in the vars/
directory are not meant to be used directly!
Use the variables this role identifies:
webserver_name: []
This is the name of the webserver. It can currently recognize: apache2
, httpd
, and nginx
.
webserver_user: []
This is the user that the webserver runs as. Check the related file in vars/
for more information.
webserver_conf_file: []
This is the main configuration file for the webserver. See the relevant file in vars/
for details.
For transparency, here are the variables from vars/Debian.yml
, vars/RedHat.yml
, and vars/Suse.yml
:
webserver_apache_name: apache2
webserver_apache_user: www-data
webserver_apache_conf_file: /etc/apache2/apache2.conf
webserver_apache_manager: apache2ctl
webserver_apache_site_dir: "/etc/{{ webserver_apache_name }}/sites-available"
These variables are for the Apache2 webserver.
webserver_nginx_name: nginx
webserver_nginx_user: nginx
webserver_nginx_conf_file: /etc/nginx/nginx.conf
webserver_nginx_manager: nginx
webserver_nginx_site_dir: "/etc/{{ webserver_nginx_name }}/conf.d"
These variables are for the NGINX webserver.
Dependencies
None.
OS Compatibility
This role checks to make sure it is not used on unsupported systems by looking for the correct distribution name and major version number in a variable named <role-name>_stable_os
. You can find this variable in the role's default variable file at defaults/main.yml
:
role_stable_os:
- Debian 10
- Ubuntu 18
- CentOS 7
- Fedora 30
If the distribution and version do not match the target system, the role will fail. To make it work, you can add the correct distribution name and version to that variable, but please test it first!
Thanks to HarryHarcourt for this idea!
Example Playbook
---
- name: "Run role."
hosts: all
become: yes
roles:
- ansible-role-webserver
Contributing
Please feel free to report bugs, issues, or suggestions for improvement. You can also contact me anytime if you want to discuss anything.
Disclaimer
This role is provided "AS IS," with no guarantees or accountability for issues or misconfigurations caused by its use. Please review the role carefully before using it.
License
MIT
Author Information
This role was created in 2020 by Thorian93.
ansible-galaxy install thorian93.webserver