Skip to content

Ansible role which installs and configures apache web server

License

Notifications You must be signed in to change notification settings

DirectorSloan/ansible-role-apache

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ansible Role: Apache

An Ansible role that installs Apache Web Server and configures it. It is currently used and tested for RHEL / CentOS 6 but may also work for 7. This Role has also a skeleteon for Debian based distributions.

Table of Contents

Requirements

  • Ansible 2+

Role Variables

Basic Variables

Variables with defaults:

apache_config_dir: '/etc/httpd/conf.d'

apache_use_ssl: 'no'

apache_user: 'apache'

apache_vhost_desired: 'no'

You can set this var to simple string values:

apache_virtual_hostname: 'hostname.domainname.edu'

Be careful: It has to be set if you want to use ssl with apache_use_ssl

SSL Variables

Configure ssl certificate variables like paths if apache_use_ssl is set, e.g.:

apache_ssl_cert_file: '/etc/ssl/yourcert.pem'

apache_ssl_cert_key_file: '/etc/ssl/yourkey.key'

If you wish you can also provide a chain file extra:

apache_ssl_cert_key_file: '/etc/ssl/yourchainfile.pem'

Addon Variables

Feel Free to define your own variables for different apache modules. Please use the config dir and avoid hacking the httpd.conf main config file.

Dependencies

None.

Example Playbook

Add to requirements.yml:

---

- src: sloan87.httpd

...

Download:

$ ansible-galaxy install -r requirements.yml

Top-Level Playbook

Write a top-level playbook:

---

- name: head server
  hosts: head

  roles:
    - role: sloan87.httpd
      tags:
        - apache
        - httpd
        - webserver

...

Role Dependency

Define the role dependency in meta/main.yml:

---

dependencies:

  - role: sloan87.httpd
    tags:
      - apache
      - httpd
      - webserver

...

License

MIT

Author Information

This role was created in 2018 by Ben Langenberg aka sloan87 at GitHub