0.1.0-DEV-20191030-122725
------------------------- * INITIAL: - initial commit
This commit is contained in:
commit
c7ad8909d8
7
.ansible-lint
Normal file
7
.ansible-lint
Normal file
@ -0,0 +1,7 @@
|
||||
parseable: true
|
||||
quiet: false
|
||||
skip_list:
|
||||
- '010'
|
||||
- '403'
|
||||
use_default_rules: true
|
||||
verbosity: 1
|
86
.gitlab-ci.yml
Normal file
86
.gitlab-ci.yml
Normal file
@ -0,0 +1,86 @@
|
||||
# CI Mark that build is executed in CI environment
|
||||
# GITLAB_CI Mark that build is executed in GitLab CI environment
|
||||
# CI_SERVER Mark that build is executed in CI environment
|
||||
# CI_SERVER_NAME CI server that is used to coordinate builds
|
||||
# CI_SERVER_VERSION Not yet defined
|
||||
# CI_SERVER_REVISION Not yet defined
|
||||
# CI_BUILD_REF The commit revision for which project is built
|
||||
# CI_BUILD_BEFORE_SHA The first commit that were included in push request
|
||||
# CI_BUILD_REF_NAME The branch or tag name for which project is built
|
||||
# CI_BUILD_ID The unique id of the current build that GitLab CI uses internally
|
||||
# CI_BUILD_REPO The URL to clone the Git repository
|
||||
# CI_PROJECT_ID The unique id of the current project that GitLab CI uses internally
|
||||
# CI_PROJECT_DIR The full path where the repository is cloned and where the build is ran
|
||||
|
||||
|
||||
variables:
|
||||
ANSIBLE_ROLE: "zen_rev_proxy"
|
||||
ANSIBLE_ROLE_PATH: "${CI_PROJECT_DIR}"
|
||||
ANSIBLE_EXTRA_VARS: ""
|
||||
|
||||
|
||||
stages:
|
||||
- check_versions
|
||||
- lint_playbook
|
||||
- test_deploy
|
||||
|
||||
|
||||
### BEGIN TEMPLATES ###
|
||||
.tags_template: &tags_template
|
||||
tags:
|
||||
- zen-ci-workstation
|
||||
|
||||
|
||||
.centos_7_template: ¢os_7_template
|
||||
variables:
|
||||
DOCKER_IMG_TAG: "7.6.1810"
|
||||
|
||||
|
||||
.check_version_template: &check_version_template
|
||||
<<: *tags_template
|
||||
stage: check_versions
|
||||
only:
|
||||
- development
|
||||
script:
|
||||
- /usr/bin/hostname
|
||||
- "cd ${CI_PROJECT_DIR} && git log -1"
|
||||
- "ansible --version"
|
||||
- "ansible-lint --version"
|
||||
|
||||
|
||||
.lint_playbook_template: &lint_playbook_template
|
||||
<<: *tags_template
|
||||
stage: lint_playbook
|
||||
only:
|
||||
- development
|
||||
script:
|
||||
- "ansible-lint -v ${ANSIBLE_ROLE_PATH}"
|
||||
|
||||
|
||||
.test_deploy_template: &test_deploy_template
|
||||
<<: *tags_template
|
||||
stage: test_deploy
|
||||
only:
|
||||
- development
|
||||
script:
|
||||
- echo "Copy ${ANSIBLE_ROLE_PATH} into global roles directory..."
|
||||
- cp -a ${ANSIBLE_ROLE_PATH} /etc/ansible/roles/${ANSIBLE_ROLE}
|
||||
- ansible-playbook -v --connection=local ${ANSIBLE_EXTRA_VARS} tests/test.yml
|
||||
### END TEMPLATES ###
|
||||
|
||||
|
||||
### BEGIN JOBS ###
|
||||
Check Versioning Info:7:
|
||||
<<: *centos_7_template
|
||||
<<: *check_version_template
|
||||
|
||||
|
||||
Lint_Playbook:7:
|
||||
<<: *centos_7_template
|
||||
<<: *lint_playbook_template
|
||||
|
||||
|
||||
Test_Deploy:7:
|
||||
<<: *centos_7_template
|
||||
<<: *test_deploy_template
|
||||
### END JOBS ###
|
38
README.md
Normal file
38
README.md
Normal file
@ -0,0 +1,38 @@
|
||||
Role Name
|
||||
=========
|
||||
|
||||
A brief description of the role goes here.
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
||||
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
|
||||
|
||||
Role Variables
|
||||
--------------
|
||||
|
||||
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
|
||||
|
||||
Dependencies
|
||||
------------
|
||||
|
||||
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
|
||||
|
||||
Example Playbook
|
||||
----------------
|
||||
|
||||
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
|
||||
|
||||
- hosts: servers
|
||||
roles:
|
||||
- { role: username.rolename, x: 42 }
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
BSD
|
||||
|
||||
Author Information
|
||||
------------------
|
||||
|
||||
An optional section for the role authors to include contact information, or a website (HTML is not allowed).
|
21
defaults/main/proxy_site_defs.yml
Normal file
21
defaults/main/proxy_site_defs.yml
Normal file
@ -0,0 +1,21 @@
|
||||
---
|
||||
proxy_site_conf_dir : /etc/nginx/conf.d
|
||||
proxy_site_file : "{{ proxy_site_conf_dir }}/zen_proxy.conf"
|
||||
proxy_site_version : 1.4
|
||||
proxy_site_revision : 20191029-101338
|
||||
|
||||
|
||||
proxy_site_log_path : /proxy_logs
|
||||
proxy_site_access_log : "{{ proxy_site_log_path }}/zen_proxy.log"
|
||||
|
||||
|
||||
proxy_site_ssl_directory : /etc/nginx/ssl
|
||||
proxy_site_ssl_certificate : "{{ proxy_site_ssl_directory }}/thezengarden.net/bundle1.pem"
|
||||
proxy_site_ssl_certificate_key : "{{ proxy_site_ssl_directory }}/thezengarden.net/privkey1.pem"
|
||||
proxy_site_ssl_protocols : TLSv1.2
|
||||
proxy_site_ssl_ciphers : ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256
|
||||
|
||||
|
||||
# many websites are run from our apache host
|
||||
# ...lets define it here to make things easier
|
||||
proxy_default_host : zg-lxwb04.thezengarden.net
|
168
defaults/main/proxy_sites.yml
Normal file
168
defaults/main/proxy_sites.yml
Normal file
@ -0,0 +1,168 @@
|
||||
---
|
||||
|
||||
proxy_sites:
|
||||
wiki.thezengarden.net:
|
||||
proto : http
|
||||
dest : docker.thezengarden.net
|
||||
port : 8081
|
||||
|
||||
|
||||
git.thezengarden.net:
|
||||
proto : https
|
||||
dest : gitlab.thezengarden.net
|
||||
port : 443
|
||||
|
||||
|
||||
hastebin.thezengarden.net:
|
||||
proto : http
|
||||
dest : docker.thezengarden.net
|
||||
port : 7777
|
||||
|
||||
|
||||
ipam.thezengarden.net:
|
||||
proto : http
|
||||
dest : docker.thezengarden.net
|
||||
port : 8000
|
||||
|
||||
|
||||
nms.thezengarden.net:
|
||||
proto : http
|
||||
dest : nms-vm.thezengarden.net
|
||||
port : 80
|
||||
|
||||
|
||||
observium.thezengarden.net:
|
||||
proto : http
|
||||
dest : observium-vm.thezengarden.net
|
||||
port : 80
|
||||
|
||||
|
||||
media.thezengarden.net:
|
||||
proto : http
|
||||
dest : media.thezengarden.net
|
||||
port : 32400
|
||||
|
||||
|
||||
hme-1.thezengarden.net:
|
||||
proto : http
|
||||
dest : kansai.thezengarden.net
|
||||
port : 80
|
||||
|
||||
|
||||
hme-2.thezengarden.net:
|
||||
proto : https
|
||||
dest : 10.1.1.6
|
||||
port : 9090
|
||||
|
||||
|
||||
hme-3.thezengarden.net:
|
||||
proto : https
|
||||
dest : kaiju.thezengarden.net
|
||||
port : 8006
|
||||
|
||||
|
||||
chat.thezengarden.net:
|
||||
proto : http
|
||||
dest : docker.thezengarden.net
|
||||
port : 8065
|
||||
|
||||
|
||||
centos.thezengarden.net:
|
||||
proto : http
|
||||
dest : 10.1.1.5
|
||||
port : 80
|
||||
|
||||
|
||||
wordpress.thezengarden.net:
|
||||
proto : http
|
||||
dest : 10.10.10.118
|
||||
port : 80
|
||||
|
||||
|
||||
mail.thezengarden.net:
|
||||
proto : https
|
||||
dest : mailcow.thezengarden.net
|
||||
port : 443
|
||||
|
||||
|
||||
seafile.thezengarden.net:
|
||||
proto : http
|
||||
dest : sa.thezengarden.net
|
||||
port : 8000
|
||||
|
||||
|
||||
awx.thezengarden.net:
|
||||
proto : http
|
||||
dest : awx.thezengarden.net
|
||||
port : 80
|
||||
|
||||
|
||||
dashboard.thezengarden.net:
|
||||
proto : https
|
||||
dest : "{{ proxy_default_host }}"
|
||||
port : 443
|
||||
|
||||
|
||||
images.thezengarden.net:
|
||||
proto : https
|
||||
dest : "{{ proxy_default_host }}"
|
||||
port : 443
|
||||
|
||||
|
||||
cloud.thezengarden.net:
|
||||
proto : https
|
||||
dest : zg-lxoc01.thezengarden.net
|
||||
port : 443
|
||||
|
||||
|
||||
lakeshorebulldogs.com:
|
||||
aliases : www.lakeshorebulldogs.com
|
||||
proto : http
|
||||
dest : "{{ proxy_default_host }}"
|
||||
port : 80
|
||||
ssl_cert : "{{ proxy_site_ssl_directory }}/lakeshorebulldogs.com/fullchain1.pem"
|
||||
ssl_key : "{{ proxy_site_ssl_directory }}/lakeshorebulldogs.com/privkey1.pem"
|
||||
|
||||
|
||||
resources.thezengarden.net:
|
||||
proto : https
|
||||
dest : "{{ proxy_default_host }}"
|
||||
port : 443
|
||||
|
||||
|
||||
thezengarden.net:
|
||||
aliases : www.thezengarden.net
|
||||
proto : https
|
||||
dest : "{{ proxy_default_host }}"
|
||||
port : 443
|
||||
|
||||
|
||||
devel.thezengarden.net:
|
||||
proto : http
|
||||
dest : "{{ proxy_default_host }}"
|
||||
port : 80
|
||||
|
||||
|
||||
beta.chris-hammer.com:
|
||||
proto : http
|
||||
dest : "{{ proxy_default_host }}"
|
||||
port : 80
|
||||
ssl_cert : "{{ proxy_site_ssl_directory }}/christian-hammer.com/fullchain3.pem"
|
||||
ssl_key : "{{ proxy_site_ssl_directory }}/christian-hammer.com/privkey3.pem"
|
||||
|
||||
|
||||
christian-hammer.com:
|
||||
aliases : www.christian-hammer.com
|
||||
proto : http
|
||||
dest : "{{ proxy_default_host }}"
|
||||
port : 80
|
||||
ssl_cert : "{{ proxy_site_ssl_directory }}/christian-hammer.com/fullchain3.pem"
|
||||
ssl_key : "{{ proxy_site_ssl_directory }}/christian-hammer.com/privkey3.pem"
|
||||
|
||||
|
||||
chris-hammer.com:
|
||||
proto : http
|
||||
dest : "{{ proxy_default_host }}"
|
||||
port : 80
|
||||
ssl_cert : "{{ proxy_site_ssl_directory }}/christian-hammer.com/fullchain3.pem"
|
||||
ssl_key : "{{ proxy_site_ssl_directory }}/christian-hammer.com/privkey3.pem"
|
8
handlers/main.yml
Normal file
8
handlers/main.yml
Normal file
@ -0,0 +1,8 @@
|
||||
---
|
||||
# handlers file for zen_rev_proxy
|
||||
|
||||
- name: restart nginx
|
||||
service:
|
||||
name : nginx
|
||||
state: restarted
|
||||
when: ansible_virtualization_type != "docker"
|
60
meta/main.yml
Normal file
60
meta/main.yml
Normal file
@ -0,0 +1,60 @@
|
||||
galaxy_info:
|
||||
author: Chris Hammer <chris@thezengarden.net>
|
||||
description: Manages Nginx SSL termination for network
|
||||
company: The Zen Garden
|
||||
|
||||
# If the issue tracker for your role is not on github, uncomment the
|
||||
# next line and provide a value
|
||||
# issue_tracker_url: http://example.com/issue/tracker
|
||||
|
||||
# Some suggested licenses:
|
||||
# - BSD (default)
|
||||
# - MIT
|
||||
# - GPLv2
|
||||
# - GPLv3
|
||||
# - Apache
|
||||
# - CC-BY
|
||||
license: GPLv2
|
||||
|
||||
min_ansible_version: 2.4
|
||||
|
||||
# If this a Container Enabled role, provide the minimum Ansible Container version.
|
||||
# min_ansible_container_version:
|
||||
|
||||
# Optionally specify the branch Galaxy will use when accessing the GitHub
|
||||
# repo for this role. During role install, if no tags are available,
|
||||
# Galaxy will use this branch. During import Galaxy will access files on
|
||||
# this branch. If Travis integration is configured, only notifications for this
|
||||
# branch will be accepted. Otherwise, in all cases, the repo's default branch
|
||||
# (usually master) will be used.
|
||||
#github_branch:
|
||||
|
||||
#
|
||||
# Provide a list of supported platforms, and for each platform a list of versions.
|
||||
# If you don't wish to enumerate all versions for a particular platform, use 'all'.
|
||||
# To view available platforms and versions (or releases), visit:
|
||||
# https://galaxy.ansible.com/api/v1/platforms/
|
||||
#
|
||||
# platforms:
|
||||
# - name: Fedora
|
||||
# versions:
|
||||
# - all
|
||||
# - 25
|
||||
# - name: SomePlatform
|
||||
# versions:
|
||||
# - all
|
||||
# - 1.0
|
||||
# - 7
|
||||
# - 99.99
|
||||
|
||||
galaxy_tags: []
|
||||
# List tags for your role here, one per line. A tag is a keyword that describes
|
||||
# and categorizes the role. Users find roles by searching for tags. Be sure to
|
||||
# remove the '[]' above, if you add tags to this list.
|
||||
#
|
||||
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
|
||||
# Maximum 20 tags per role.
|
||||
|
||||
dependencies: []
|
||||
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
|
||||
# if you add dependencies to this list.
|
46
tasks/main.yml
Normal file
46
tasks/main.yml
Normal file
@ -0,0 +1,46 @@
|
||||
---
|
||||
# tasks file for zen_rev_proxy
|
||||
|
||||
- name: install nginx/aptitude
|
||||
package:
|
||||
name : ['nginx','aptitude']
|
||||
state : present
|
||||
force_apt_get: True
|
||||
|
||||
|
||||
- name: enable nginx at boot time
|
||||
service:
|
||||
name : nginx
|
||||
enabled : yes
|
||||
when: ansible_virtualization_type != "docker"
|
||||
|
||||
|
||||
- name: create conf.d directory
|
||||
file:
|
||||
path : "{{ proxy_site_conf_dir }}"
|
||||
state : directory
|
||||
mode : 0755
|
||||
|
||||
|
||||
- name: create log directory
|
||||
file:
|
||||
path : "{{ proxy_site_log_path }}"
|
||||
state : directory
|
||||
mode : 0755
|
||||
|
||||
|
||||
- name: write configuration file(s)
|
||||
template:
|
||||
src : proxy_site.j2
|
||||
dest : "{{ proxy_site_conf_dir }}/{{ item.key }}.conf"
|
||||
mode : 0644
|
||||
with_dict:
|
||||
- "{{ proxy_sites }}"
|
||||
notify: restart nginx
|
||||
|
||||
|
||||
- name: start nginx
|
||||
service:
|
||||
name : nginx
|
||||
state : started
|
||||
when: ansible_virtualization_type != "docker"
|
39
templates/proxy_site.j2
Normal file
39
templates/proxy_site.j2
Normal file
@ -0,0 +1,39 @@
|
||||
#####################################################
|
||||
# The Zen Garden Network #
|
||||
# #
|
||||
# Configuration : {{ proxy_site_conf_dir }}/{{ item.key }}.conf #
|
||||
# Version : {{ proxy_site_version }}-{{ proxy_site_revision }} #
|
||||
# #
|
||||
# Chris H. <chris@thezengarden.net> #
|
||||
#####################################################
|
||||
|
||||
|
||||
### Configuration for: {{ item.key }}
|
||||
################################################
|
||||
server {
|
||||
listen 443 ssl;
|
||||
server_name {{ item.key }} {% if proxy_sites[item.key]['aliases'] is defined %}{{ proxy_sites[item.key]['aliases'] }}{% endif %};
|
||||
|
||||
ssl_certificate {{ proxy_sites[item.key]['ssl_cert'] | default(proxy_site_ssl_certificate) }};
|
||||
ssl_certificate_key {{ proxy_sites[item.key]['ssl_key'] | default(proxy_site_ssl_certificate_key) }};
|
||||
ssl_session_cache shared:SSL:10m;
|
||||
ssl_protocols {{ proxy_site_ssl_protocols }};
|
||||
ssl_ciphers {{ proxy_site_ssl_ciphers }};
|
||||
ssl_prefer_server_ciphers on;
|
||||
|
||||
access_log {{ proxy_site_log_path }}/{{ item.key }}.log;
|
||||
|
||||
location / {
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-Host $host;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header Host $host;
|
||||
|
||||
proxy_pass {{ proxy_sites[item.key]['proto'] }}://{{ proxy_sites[item.key]['dest'] }}:{{ proxy_sites[item.key]['port'] }};
|
||||
|
||||
|
||||
# re-write redirects to http as to https
|
||||
proxy_redirect http:// https://;
|
||||
}
|
||||
}
|
37
templates/proxy_site_aio.j2
Normal file
37
templates/proxy_site_aio.j2
Normal file
@ -0,0 +1,37 @@
|
||||
#####################################################
|
||||
# The Zen Garden Network #
|
||||
# #
|
||||
# Configuration : {{ proxy_site_file }} #
|
||||
# Version : {{ proxy_site_version }}-{{ proxy_site_revision }} #
|
||||
# #
|
||||
# Chris H. <chris@thezengarden.net> #
|
||||
#####################################################
|
||||
|
||||
|
||||
{% for site in proxy_sites %}
|
||||
### Configuration for: {{ site }}
|
||||
################################################
|
||||
server {
|
||||
listen 443 ssl;
|
||||
server_name {{ site }};
|
||||
|
||||
ssl_certificate {{ proxy_site_ssl_certificate }};
|
||||
ssl_certificate_key {{ proxy_site_ssl_certificate_key }};
|
||||
ssl_session_cache shared:SSL:10m;
|
||||
ssl_protocols {{ proxy_site_ssl_protocols }};
|
||||
ssl_ciphers {{ proxy_site_ssl_ciphers }};
|
||||
ssl_prefer_server_ciphers on;
|
||||
|
||||
access_log {{ proxy_site_log_path }}/{{ site }}.log;
|
||||
|
||||
location / {
|
||||
proxy_pass {{ proxy_sites[site]['proto'] }}://{{ proxy_sites[site]['dest'] }}:{{ proxy_sites[site]['port'] }};
|
||||
proxy_set_header Host $host;
|
||||
|
||||
# re-write redirects to http as to https
|
||||
proxy_redirect http:// https://;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
{% endfor %}
|
2
tests/inventory
Normal file
2
tests/inventory
Normal file
@ -0,0 +1,2 @@
|
||||
localhost
|
||||
|
5
tests/test.yml
Normal file
5
tests/test.yml
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
- hosts: localhost
|
||||
remote_user: root
|
||||
roles:
|
||||
- zen_rev_proxy
|
2
vars/main.yml
Normal file
2
vars/main.yml
Normal file
@ -0,0 +1,2 @@
|
||||
---
|
||||
# vars file for zen_rev_proxy
|
Loading…
x
Reference in New Issue
Block a user