-
-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Commit contributed roles and add a script to
composer update
to upd…
…ate the roles and removing all calls to "ansible-galaxy".
- Loading branch information
Showing
253 changed files
with
7,175 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Ansible Galaxy Roles | ||
|
||
This folder contains roles distributed on https://galaxy.ansible.com, | ||
|
||
To improve stability and remove the need for extra build steps, the roles are committed directly to this repo. | ||
|
||
This is modeled on the DrupalVM repository. See https://github.com/geerlingguy/drupal-vm/tree/master/provisioning | ||
|
||
## Adding and Updating Galaxy roles | ||
|
||
To simplify role management, we've come up with a model for committing roles to code. | ||
|
||
To update roles to the latest versions, just run `composer update` and commit | ||
the result. | ||
|
||
To install a new role, add it to `roles/roles.yml`, then run `composer update` | ||
to install the roles. | ||
|
||
DevShop's `composer.json` file has a `post-update-cmd` hook that calls | ||
`ansible-galaxy install` with the `--force` option. | ||
|
||
## Forking Roles | ||
|
||
You can easily fork a role and include your version in this repository. | ||
|
||
Change the entry in `roles.yml` to point to your repository instead: | ||
|
||
# from GitHub, overriding the name and specifying a specific tag | ||
- src: https://github.com/bennojoy/nginx | ||
version: master | ||
name: nginx_role |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
*.retry | ||
*/__pycache__ | ||
*.pyc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
--- | ||
language: python | ||
services: docker | ||
|
||
env: | ||
global: | ||
- ROLE_NAME: apache | ||
matrix: | ||
- MOLECULE_DISTRO: ubi8 | ||
- MOLECULE_DISTRO: centos7 | ||
- MOLECULE_DISTRO: centos6 | ||
- MOLECULE_DISTRO: ubuntu1804 | ||
- MOLECULE_DISTRO: ubuntu1604 | ||
- MOLECULE_DISTRO: ubuntu1404 | ||
- MOLECULE_DISTRO: debian10 | ||
- MOLECULE_DISTRO: debian9 | ||
|
||
install: | ||
# Install test dependencies. | ||
- pip install molecule docker | ||
|
||
before_script: | ||
# Use actual Ansible Galaxy role name for the project directory. | ||
- cd ../ | ||
- mv ansible-role-$ROLE_NAME geerlingguy.$ROLE_NAME | ||
- cd geerlingguy.$ROLE_NAME | ||
|
||
script: | ||
# Run tests. | ||
- molecule test | ||
|
||
notifications: | ||
webhooks: https://galaxy.ansible.com/api/v1/notifications/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2017 Jeff Geerling | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
this software and associated documentation files (the "Software"), to deal in | ||
the Software without restriction, including without limitation the rights to | ||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||
the Software, and to permit persons to whom the Software is furnished to do so, | ||
subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,156 @@ | ||
# Ansible Role: Apache 2.x | ||
|
||
[![Build Status](https://travis-ci.org/geerlingguy/ansible-role-apache.svg?branch=master)](https://travis-ci.org/geerlingguy/ansible-role-apache) | ||
|
||
An Ansible Role that installs Apache 2.x on RHEL/CentOS, Debian/Ubuntu, SLES and Solaris. | ||
|
||
## Requirements | ||
|
||
If you are using SSL/TLS, you will need to provide your own certificate and key files. You can generate a self-signed certificate with a command like `openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout example.key -out example.crt`. | ||
|
||
If you are using Apache with PHP, I recommend using the `geerlingguy.php` role to install PHP, and you can either use mod_php (by adding the proper package, e.g. `libapache2-mod-php5` for Ubuntu, to `php_packages`), or by also using `geerlingguy.apache-php-fpm` to connect Apache to PHP via FPM. See that role's README for more info. | ||
|
||
## Role Variables | ||
|
||
Available variables are listed below, along with default values (see `defaults/main.yml`): | ||
|
||
apache_enablerepo: "" | ||
|
||
The repository to use when installing Apache (only used on RHEL/CentOS systems). If you'd like later versions of Apache than are available in the OS's core repositories, use a repository like EPEL (which can be installed with the `geerlingguy.repo-epel` role). | ||
|
||
apache_listen_ip: "*" | ||
apache_listen_port: 80 | ||
apache_listen_port_ssl: 443 | ||
|
||
The IP address and ports on which apache should be listening. Useful if you have another service (like a reverse proxy) listening on port 80 or 443 and need to change the defaults. | ||
|
||
apache_create_vhosts: true | ||
apache_vhosts_filename: "vhosts.conf" | ||
apache_vhosts_template: "vhosts.conf.j2" | ||
|
||
If set to true, a vhosts file, managed by this role's variables (see below), will be created and placed in the Apache configuration folder. If set to false, you can place your own vhosts file into Apache's configuration folder and skip the convenient (but more basic) one added by this role. You can also override the template used and set a path to your own template, if you need to further customize the layout of your VirtualHosts. | ||
|
||
apache_remove_default_vhost: false | ||
|
||
On Debian/Ubuntu, a default virtualhost is included in Apache's configuration. Set this to `true` to remove that default virtualhost configuration file. | ||
|
||
apache_global_vhost_settings: | | ||
DirectoryIndex index.php index.html | ||
# Add other global settings on subsequent lines. | ||
|
||
You can add or override global Apache configuration settings in the role-provided vhosts file (assuming `apache_create_vhosts` is true) using this variable. By default it only sets the DirectoryIndex configuration. | ||
|
||
apache_vhosts: | ||
# Additional optional properties: 'serveradmin, serveralias, extra_parameters'. | ||
- servername: "local.dev" | ||
documentroot: "/var/www/html" | ||
|
||
Add a set of properties per virtualhost, including `servername` (required), `documentroot` (required), `allow_override` (optional: defaults to the value of `apache_allow_override`), `options` (optional: defaults to the value of `apache_options`), `serveradmin` (optional), `serveralias` (optional) and `extra_parameters` (optional: you can add whatever additional configuration lines you'd like in here). | ||
|
||
Here's an example using `extra_parameters` to add a RewriteRule to redirect all requests to the `www.` site: | ||
|
||
- servername: "www.local.dev" | ||
serveralias: "local.dev" | ||
documentroot: "/var/www/html" | ||
extra_parameters: | | ||
RewriteCond %{HTTP_HOST} !^www\. [NC] | ||
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L] | ||
|
||
The `|` denotes a multiline scalar block in YAML, so newlines are preserved in the resulting configuration file output. | ||
|
||
apache_vhosts_ssl: [] | ||
|
||
No SSL vhosts are configured by default, but you can add them using the same pattern as `apache_vhosts`, with a few additional directives, like the following example: | ||
|
||
apache_vhosts_ssl: | ||
- servername: "local.dev" | ||
documentroot: "/var/www/html" | ||
certificate_file: "/home/vagrant/example.crt" | ||
certificate_key_file: "/home/vagrant/example.key" | ||
certificate_chain_file: "/path/to/certificate_chain.crt" | ||
extra_parameters: | | ||
RewriteCond %{HTTP_HOST} !^www\. [NC] | ||
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L] | ||
|
||
Other SSL directives can be managed with other SSL-related role variables. | ||
|
||
apache_ssl_protocol: "All -SSLv2 -SSLv3" | ||
apache_ssl_cipher_suite: "AES256+EECDH:AES256+EDH" | ||
|
||
The SSL protocols and cipher suites that are used/allowed when clients make secure connections to your server. These are secure/sane defaults, but for maximum security, performand, and/or compatibility, you may need to adjust these settings. | ||
|
||
apache_allow_override: "All" | ||
apache_options: "-Indexes +FollowSymLinks" | ||
|
||
The default values for the `AllowOverride` and `Options` directives for the `documentroot` directory of each vhost. A vhost can overwrite these values by specifying `allow_override` or `options`. | ||
|
||
apache_mods_enabled: | ||
- rewrite.load | ||
- ssl.load | ||
apache_mods_disabled: [] | ||
|
||
(Debian/Ubuntu ONLY) Which Apache mods to enable or disable (these will be symlinked into the appropriate location). See the `mods-available` directory inside the apache configuration directory (`/etc/apache2/mods-available` by default) for all the available mods. | ||
|
||
apache_packages: | ||
- [platform-specific] | ||
|
||
The list of packages to be installed. This defaults to a set of platform-specific packages for RedHat or Debian-based systems (see `vars/RedHat.yml` and `vars/Debian.yml` for the default values). | ||
|
||
apache_state: started | ||
|
||
Set initial Apache daemon state to be enforced when this role is run. This should generally remain `started`, but you can set it to `stopped` if you need to fix the Apache config during a playbook run or otherwise would not like Apache started at the time this role is run. | ||
|
||
apache_packages_state: present | ||
|
||
If you have enabled any additional repositories such as _ondrej/apache2_, [geerlingguy.repo-epel](https://github.com/geerlingguy/ansible-role-repo-epel), or [geerlingguy.repo-remi](https://github.com/geerlingguy/ansible-role-repo-remi), you may want an easy way to upgrade versions. You can set this to `latest` (combined with `apache_enablerepo` on RHEL) and can directly upgrade to a different Apache version from a different repo (instead of uninstalling and reinstalling Apache). | ||
|
||
apache_ignore_missing_ssl_certificate: true | ||
|
||
If you would like to only create SSL vhosts when the vhost certificate is present (e.g. when using Let’s Encrypt), set `apache_ignore_missing_ssl_certificate` to `false`. When doing this, you might need to run your playbook more than once so all the vhosts are configured (if another part of the playbook generates the SSL certificates). | ||
|
||
## .htaccess-based Basic Authorization | ||
|
||
If you require Basic Auth support, you can add it either through a custom template, or by adding `extra_parameters` to a VirtualHost configuration, like so: | ||
|
||
extra_parameters: | | ||
<Directory "/var/www/password-protected-directory"> | ||
Require valid-user | ||
AuthType Basic | ||
AuthName "Please authenticate" | ||
AuthUserFile /var/www/password-protected-directory/.htpasswd | ||
</Directory> | ||
|
||
To password protect everything within a VirtualHost directive, use the `Location` block instead of `Directory`: | ||
|
||
<Location "/"> | ||
Require valid-user | ||
.... | ||
</Location> | ||
|
||
You would need to generate/upload your own `.htpasswd` file in your own playbook. There may be other roles that support this functionality in a more integrated way. | ||
|
||
## Dependencies | ||
|
||
None. | ||
|
||
## 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](https://www.jeffgeerling.com/), author of [Ansible for DevOps](https://www.ansiblefordevops.com/). |
Oops, something went wrong.