---
- hosts:      localhost
  connection: local
  become:     true
  vars_files:
    - vars/default-core.yml

  tasks:
    - name: Deriving 'gsdl3servlet_internal_domain_url'
      set_fact: 
        gsdl3servlet_internal_domain_url: "{{ gsdl3servlet_internal | gsdl3servlet_domain_url() }}"

    - name: Adding 'gsdl3servlet_internal_domain_url' to 'gsdl3servlet_internal'
      set_fact: 
        gsdl3servlet_internal: "{{ gsdl3servlet_internal | combine ({'domain_url': gsdl3servlet_internal_domain_url}) }}"

    - debug:
        msg: "gsdl3servlet_internal = {{ gsdl3servlet_internal }}"	


    - name: Deriving 'gsdl3servlet_external_domain_url'
      set_fact: 
        gsdl3servlet_external_domain_url: "{{ gsdl3servlet_external | gsdl3servlet_domain_url() }}"

    - name: Adding 'gsdl3servlet_external_domain_url' to 'gsdl3servlet_external'
      set_fact: 
        gsdl3servlet_external: "{{ gsdl3servlet_external | combine ({'domain_url': gsdl3servlet_external_domain_url}) }}"

    - debug:
        msg: "gsdl3servlet_external = {{ gsdl3servlet_external }}"	


    - debug:
        msg: "apache2_revproxy_config = {{ apache2_revproxy_config }}"	


#    - name: Adding derived values
#      set_fact: 
#        gsdl3servlet_internal: "{{ gsdl3servlet_internal | combine ({ item.key : item.value }) }}"
#      with_items:
##        - { 'key': 'explicit_port',
##	    'value': "{{ gsdl3servlet_internal.optional_port | default(80,true) }}" }
#        - { 'key': 'optional_colon_port',
#
#	    'value': "{{ (':'+gsdl3servlet_internal.optional_port) if 'optional_port' in gsdl3servlet_internal else '' }}" }
# #       - { 'key': 'domain_and_optional_port',
# #           'value': "{{ gsdl3servlet_internal.domain+gsdl3servlet_internal.optional_colon_port }}" }
#
##    - name: Deriving 'gsdl3servlet_internal_domain_url'
##      set_fact:
##        gsdl3servlet_internal_domain_url:
##	  "{{ gsdl3servet_internal.
#
#      set_fact: 
#        gsdl3servlet_internal: "{{ gsdl3servlet_internal | combine ({ item.key : item.value }) }}"
#
#
#    - debug: msg="gsdl3servlet_internal = {{ gsdl3servlet_internal }}"

