No description
Find a file
2014-02-28 16:39:31 -06:00
handlers Add handlers, meta info, tasks, templates, and vars. 2014-02-28 16:23:24 -06:00
meta Add handlers, meta info, tasks, templates, and vars. 2014-02-28 16:23:24 -06:00
tasks Add handlers, meta info, tasks, templates, and vars. 2014-02-28 16:23:24 -06:00
templates Add handlers, meta info, tasks, templates, and vars. 2014-02-28 16:23:24 -06:00
vars Add handlers, meta info, tasks, templates, and vars. 2014-02-28 16:23:24 -06:00
README.md Tiny tweak to README.md. 2014-02-28 16:39:31 -06:00

Ansible Role: Apache 2.x

An Ansible Role that installs Apache 2.x on RedHat Enterprise Linux or CentOS 6.x servers.

Requirements

None.

Role Variables

Available variables are listed below, along with default values (see vars/main.yml):

apache_listen_port: 80

The port on which apache should be listening. Useful if you have another service (like a reverse proxy) listening on port 80.

apache_vhosts:
  # Additional optional properties: 'serveradmin, extra_parameters'.
  - {servername: "local.dev", documentroot: "/var/www/html"}

Add a set of properties per virtualhost, including servername (required), documentroot (required), serveradmin (optional: the admin email address for this server), and extra_parameters (you can add whatever you'd like in here).

Note that this role doesn't configure SSL support out of the box; you would need to add in additional tasks to listen on port 443 and add your own VirtualHost directives for SSL. This may be improved in the future :)

Dependencies

  • geerlingguy.repo-epel (Installs the EPEL repository for CentOS 6.x).

Example Playbook

- hosts: webservers
  vars_files:
    - vars/main.yml
  roles:
    - { role: geerlingguy.apache }

Inside vars/main.yml:

apache_listen_port: 8080
apache_vhosts:
  - {servername: "example.com", documentroot: "/var/www/vhosts/example_com"}

License

MIT / BSD

Author Information

This role was created in 2014 by Jeff Geerling (@geerlingguy), author of Ansible for DevOps. You can find out more about the book at http://ansiblefordevops.com/, and learn about the author at http://jeffgeerling.com/.