sborenst
2018-03-06 63b26e9194745e589cebaa468ac88ebb61e7ecb9
added httpd-reverse-proxy role for use in ocp-ha-disconected-lab
2 files added
3 files modified
73 ■■■■ changed files
ansible/configs/ocp-ha-disconnected-lab/env_vars.yml 8 ●●●● patch | view | raw | blame | history
ansible/configs/ocp-ha-disconnected-lab/files/repos_template.j2 14 ●●●●● patch | view | raw | blame | history
ansible/configs/ocp-ha-disconnected-lab/pre_software.yml 19 ●●●●● patch | view | raw | blame | history
ansible/roles/httpd-reverse-proxy/tasks/main.yml 18 ●●●●● patch | view | raw | blame | history
ansible/roles/httpd-reverse-proxy/templates/reverse-proxy.conf.j2 14 ●●●●● patch | view | raw | blame | history
ansible/configs/ocp-ha-disconnected-lab/env_vars.yml
@@ -4,7 +4,6 @@
## should just toss in group_vars/all.
### Also, we should probably just create a variable reference in the README.md
### For now, just tagging comments in line with configuration file.
###### VARIABLES YOU SHOULD CONFIGURE FOR YOUR DEPLOYEMNT
###### OR PASS as "-e" args to ansible-playbook command
# #
@@ -18,7 +17,8 @@
#
# # This doesn't work
# all: "tag_Project_opentlc_shared_{{guid}}"
#
reverse_proxy: true
# # but maybe this is silly enough to work
# #all: "tag_Project_opentlc_shared_{{guid}}:&tag_Project_opentlc_shared_{{guid}}"
#rhn_pool_id_string: OpenShift Container Platform
@@ -653,7 +653,7 @@
      "ec2": "{{support_instance_type}}"
    tags:
      - key: "AnsibleGroup"
        value: "isoloated"
        value: "support"
      - key: "ostype"
        value: "linux"
    rootfs_size: "{{ rootfs_size_support }}"
@@ -672,7 +672,7 @@
      "ec2": "{{isolated_instance_type}}"
    tags:
      - key: "AnsibleGroup"
        value: "isoloated"
        value: "isolated"
      - key: "ostype"
        value: "linux"
    rootfs_size: "{{ rootfs_size_isolated }}"
ansible/configs/ocp-ha-disconnected-lab/files/repos_template.j2
@@ -1,37 +1,35 @@
[rhel-7-server-rpms]
name=Red Hat Enterprise Linux 7
baseurl={{own_repo_path}}/rhel-7-server-rpms
baseurl=http://{{hostvars[groups['isolated'][0]].internaldns}}{{ own_repo_path | urlsplit('path') }}rhel-7-server-rpms
enabled=1
gpgcheck=0
[rhel-7-server-rh-common-rpms]
name=Red Hat Enterprise Linux 7 Common
baseurl={{own_repo_path}}/rhel-7-server-rh-common-rpms
baseurl=http://{{hostvars[groups['isolated'][0]].internaldns}}{{ own_repo_path | urlsplit('path') }}rhel-7-server-rh-common-rpms
enabled=1
gpgcheck=0
[rhel-7-server-extras-rpms]
name=Red Hat Enterprise Linux 7 Extras
baseurl={{own_repo_path}}/rhel-7-server-extras-rpms
baseurl=http://{{hostvars[groups['isolated'][0]].internaldns}}{{ own_repo_path | urlsplit('path') }}rhel-7-server-extras-rpms
enabled=1
gpgcheck=0
[rhel-7-server-optional-rpms]
name=Red Hat Enterprise Linux 7 Optional
baseurl={{own_repo_path}}/rhel-7-server-optional-rpms
baseurl=http://{{hostvars[groups['isolated'][0]].internaldns}}{{ own_repo_path | urlsplit('path') }}rhel-7-server-optional-rpms
enabled=1
gpgcheck=0
[rhel-7-server-ose-{{repo_version}}-rpms]
name=Red Hat Enterprise Linux 7 OSE {{repo_version}}
baseurl={{own_repo_path}}/rhel-7-server-ose-{{repo_version}}-rpms
baseurl=http://{{hostvars[groups['isolated'][0]].internaldns}}{{ own_repo_path | urlsplit('path') }}rhel-7-server-ose-{{repo_version}}-rpms
enabled=1
gpgcheck=0
[rhel-7-fast-datapath-rpms]
name=Red Hat Enterprise Linux 7 Fast Datapath
baseurl={{own_repo_path}}/rhel-7-fast-datapath-rpms
baseurl=http://{{hostvars[groups['isolated'][0]].internaldns}}{{ own_repo_path | urlsplit('path') }}rhel-7-fast-datapath-rpms
enabled=1
gpgcheck=0
ansible/configs/ocp-ha-disconnected-lab/pre_software.yml
@@ -31,6 +31,23 @@
# Cloudformation template or equivalent should tag all hosts with Project:{{ env_type }}-{{ guid }}
- name: configure reverse proxy on isolated host
  hosts: isolated
  become: true
  gather_facts: False
  vars_files:
    - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml"
    - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_secret_vars.yml"
  tags:
    - step004
    - common_tasks
  vars:
    proxyservername: "http://{{ own_repo_path | urlsplit('hostname') }}"
    servername: "{{hostvars[groups['isolated'][0]].internaldns}}"
  roles:
    - { role: "{{ ANSIBLE_REPO_PATH }}/roles/httpd-reverse-proxy", when: 'reverse_proxy is defined' }
- name: Configure all hosts with Repositories, Common Files and Set environment key
  hosts: all
  become: true
@@ -42,9 +59,9 @@
    - step004
    - common_tasks
  roles:
    - { role: "{{ ANSIBLE_REPO_PATH }}/roles/set_env_authorized_key", when: 'set_env_authorized_key' }
    - { role: "{{ ANSIBLE_REPO_PATH }}/roles/set-repositories", when: 'repo_method is defined' }
    - { role: "{{ ANSIBLE_REPO_PATH }}/roles/common", when: 'install_common' }
    - { role: "{{ ANSIBLE_REPO_PATH }}/roles/set_env_authorized_key", when: 'set_env_authorized_key' }
- name: Configuring Bastion Hosts
  hosts: bastions
ansible/roles/httpd-reverse-proxy/tasks/main.yml
New file
@@ -0,0 +1,18 @@
- name: install httpd package
  yum:
    name: "{{ item }}"
    state: present
  with_items:
    - httpd
  tags:
    - install_httpd_packages
- name: create reverse proxy file on httpd /etc/httpd/conf.d
  template:
    src: reverse-proxy.conf.j2
    dest: /etc/httpd/conf.d/default.conf
- service:
    name: httpd
    state: started
    enabled: yes
ansible/roles/httpd-reverse-proxy/templates/reverse-proxy.conf.j2
New file
@@ -0,0 +1,14 @@
<VirtualHost *:*>
    ProxyPreserveHost On
    # Servers to proxy the connection, or;
    # List of application servers:
    # Usage:
    # ProxyPass / http://[IP Addr.]:[port]/
    # ProxyPassReverse / http://[IP Addr.]:[port]/
    # Example:
    ProxyPass / {{proxyservername}}/
    ProxyPassReverse / {{proxyservername}}/
    ServerName {{servername}}
</VirtualHost>