Adds in Apache2 role - Ubuntu 16.04
Building on from the previous commit https://review.openstack.org/427869 this adds in Apache2 role to host the pre-seed files and some Ubuntu install files. Change-Id: Ib0c2469e25f5e7a03c7c79efc201cd51f673966e
This commit is contained in:
parent
49ccdbeb2c
commit
e0381502e3
23
multi-node-aio-xenial-ansible/roles/apache_install/README.md
Normal file
23
multi-node-aio-xenial-ansible/roles/apache_install/README.md
Normal file
@ -0,0 +1,23 @@
|
||||
apache_install
|
||||
=========
|
||||
|
||||
This module installs Apache2 and configures a site
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
||||
This module requires Ansible 2.0+
|
||||
|
||||
Role Variables
|
||||
--------------
|
||||
|
||||
See defaults for variables and descriptions
|
||||
|
||||
Example Playbook
|
||||
----------------
|
||||
|
||||
Example to call:
|
||||
|
||||
- hosts: all
|
||||
roles:
|
||||
- { role: url: default }
|
@ -0,0 +1,26 @@
|
||||
---
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# name: apache_install/defaults
|
||||
# description: ALL our default variables for apache_install go in here
|
||||
#------------------------------------------------------------------------------
|
||||
# Packages - All our required packages we need installing
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# - pre-requisites -
|
||||
packages: # Packages required for apache role to work
|
||||
- apache2
|
||||
|
||||
# - variables -
|
||||
url: blank # Default sub folder
|
||||
publish_root: blank # What will the default path be for the apache site
|
@ -0,0 +1,20 @@
|
||||
---
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# name: apache_install/handlers
|
||||
# description: All our handlers for apache_install go in here
|
||||
|
||||
- name: restart_apache2
|
||||
service:
|
||||
name: apache2
|
||||
state: restarted
|
@ -0,0 +1,22 @@
|
||||
---
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
galaxy_info:
|
||||
author: "Stuart Grace - BBC R&D"
|
||||
license: Apache2
|
||||
min_ansible_version: 2.0
|
||||
platforms:
|
||||
- name: Ubuntu
|
||||
versions:
|
||||
- xenial
|
||||
dependencies: []
|
@ -0,0 +1,40 @@
|
||||
---
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# module: apache_install/tasks/configure
|
||||
# description: Configure apache_install
|
||||
|
||||
- name: Create default index to show host info
|
||||
copy:
|
||||
content: "System - {{ ansible_fqdn }}"
|
||||
dest: /var/www/html/index.html
|
||||
|
||||
- name: Create control file for apache site
|
||||
template:
|
||||
src: sites-allowed.j2
|
||||
dest: "/etc/apache2/sites-available/{{ url }}.conf"
|
||||
mode: 0644
|
||||
notify: restart_apache2
|
||||
|
||||
- name: Create publish root path
|
||||
file:
|
||||
path: "{{ publish_root }}"
|
||||
state: directory
|
||||
recurse: yes
|
||||
|
||||
- name: Enable apache site using symlink
|
||||
file:
|
||||
path: "/etc/apache2/sites-enabled/{{ url }}.conf"
|
||||
src: "/etc/apache2/sites-available/{{ url }}.conf"
|
||||
state: link
|
||||
notify: restart_apache2
|
@ -0,0 +1,25 @@
|
||||
---
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# module: apache_install/tasks/install
|
||||
# description: Install our required packages for apache_install
|
||||
|
||||
- name: Install all required packages for apache_install
|
||||
apt:
|
||||
pkg: "{{ packages }}"
|
||||
state: latest
|
||||
|
||||
- name: Make sure Apache2 is enabled
|
||||
service:
|
||||
name: apache2
|
||||
enabled: yes
|
@ -0,0 +1,18 @@
|
||||
---
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# module: apache_install/tasks
|
||||
# description: Install apache onto an Ubuntu 16.xx server
|
||||
|
||||
- include: install.yml
|
||||
- include: configure.yml
|
@ -0,0 +1,7 @@
|
||||
### MANAGED BY {{ role_path|basename }} ANSIBLE ROLE ###
|
||||
|
||||
Alias /{{ url }} {{ publish_root }}
|
||||
<Directory {{ publish_root }}>
|
||||
Require all granted
|
||||
Options +Indexes
|
||||
</Directory>
|
Loading…
x
Reference in New Issue
Block a user