apache

apache

quality Build Status Documentation Status GitHub tag

Ansible role. Install and configure Apache.

Documentation at readthedocs.io

Feel free to share your feedback and report issues.

Contributions are welcome.

Supported platforms

This role has been developed and tested with

Requirements

Collections

  • community.general

Roles

Variables

Review defaults and examples in vars. By default SSL is off.

apache_ssl: False

Certificates are needed to enable SSL.

apache_ssl: True
apache_version: "24"
apache_SSLCertificateFile: "/usr/local/etc/apache{{ apache_version }}/server.crt"
apache_SSLCertificateKeyFile: "/usr/local/etc/apache{{ apache_version }}/server.key"

Virtual hosts are configured with optional redirection to SSL. By default virtual hosts for ports 80 and 443 will be created and port 80 permanently redirected to 443. Example is available in vars.

Workflow

  1. Change shell to /bin/sh if necessary
shell> ansible webserver -e 'ansible_shell_type=csh ansible_shell_executable=/bin/csh' -a 'sudo pw usermod freebsd -s /bin/sh'
  1. Install role
shell> ansible-galaxy install vbotka.apache
  1. Fit variables

  2. Create playbook and inventory

shell> cat apache.yml
---
- hosts: webserver
  roles:
    - vbotka.apache
shell> cat hosts
[webserver]
<webserver-ip-or-fqdn>
[webserver:vars]
ansible_connection=ssh
ansible_user=freebsd
ansible_become=true
ansible_become_method=sudo
ansible_python_interpreter=/usr/local/bin/python3.9
ansible_perl_interpreter=/usr/local/bin/perl
  1. Test syntax
shell> ansible-playbook apache.yml --syntax-check
  1. Show variables
shell> ansible-playbook apache.yml -t apache_debug -e apache_debug=true
  1. Install packages
shell> ansible-playbook apache.yml -t apache_packages -e apache_install=true
  1. Dry run and show differences
shell> ansible-playbook apache.yml --check --diff
  1. Install and configure apache
shell> ansible-playbook apache.yml
  1. Optionally test the webserver

Ansible lint

Use the configuration file .ansible-lint.local when running ansible-lint. Some rules might be disabled and some warnings might be ignored. See the notes in the configuration file.

shell> ansible-lint -c .ansible-lint.local

References

License

license

Author Information

Vladimir Botka

About

Install and configure Apache.

Install
ansible-galaxy install vbotka/ansible-apache
GitHub repository
License
bsd-2-clause
Downloads
287