| --- |
| - name: Checking for Management Server Port |
| register: ms_ext_mgmt_port_status |
| ignore_errors: true |
| wait_for: |
| port: '{{ ms_ext_mgmt_port }}' |
| host: '{{ private_address }}' |
| timeout: 1 |
| |
| - name: Management Server Port Status report |
| debug: |
| var: ms_ext_mgmt_port_status |
| |
| - name: Management server is not running |
| fail: |
| msg: "Management server is not running" |
| when: ms_ext_mgmt_port_status | failed |
| |
| - name: Construct name of edge response validate file |
| cache: |
| key: 'onboarding_config_file_path' |
| value: '{{ opdk_installer_path }}/edge-response-validate-{{ opdk_version }}-{{ region }}.conf' |
| |
| - name: Remove old apigee-provision file |
| become: yes |
| file: |
| path: '{{ onboarding_config_file_path }}' |
| state: absent |
| when: provided_onboarding_config_file_path is not defined |
| |
| - name: Initialize RMP addresses |
| set_fact: |
| vhost_alias: '' |
| |
| - block: |
| - name: Set vhost_alias to load_balancer |
| cache: |
| key: "vhost_alias" |
| value: "{{ load_balancer | trim }}" |
| when: load_balancer is defined and load_balancer | trim | length > 0 |
| |
| - block: |
| - name: Collect DC 1 RMP addresses |
| cache: |
| key: "vhost_alias" |
| value: "{{ vhost_alias | trim }} {{ hostvars[item].private_address | trim }}" |
| with_items: "{{ groups['dc-1-rmp'] }}" |
| when: groups['dc-1'] is defined and inventory_hostname in groups['dc-1'] and groups['dc-1-rmp'] is defined |
| |
| - name: Collect DC 2 RMP addresses |
| cache: |
| key: "vhost_alias" |
| value: "{{ vhost_alias | trim }} {{ hostvars[item].private_address | trim }}" |
| with_items: "{{ groups['dc-2-rmp'] }}" |
| when: groups['dc-2'] is defined and inventory_hostname in groups['dc-2'] and groups['dc-2-rmp'] is defined |
| |
| - name: Collect DC 3 RMP addresses |
| cache: |
| key: "vhost_alias" |
| value: "{{ vhost_alias | trim }} {{ hostvars[item].private_address | trim }}" |
| with_items: "{{ groups['dc-3-rmp'] }}" |
| when: groups['dc-3'] is defined and inventory_hostname in groups['dc-3'] and groups['dc-3-rmp'] is defined |
| |
| - name: Collect DC 1 Router addresses |
| cache: |
| key: "vhost_alias" |
| value: "{{ vhost_alias | trim }} {{ hostvars[item].private_address | trim }}" |
| with_items: "{{ groups['dc-1-r'] }}" |
| when: groups['dc-1'] is defined and inventory_hostname in groups['dc-1'] and groups['dc-1-r'] is defined |
| |
| - name: Collect DC 2 Router addresses |
| cache: |
| key: "vhost_alias" |
| value: "{{ vhost_alias | trim }} {{ hostvars[item].private_address | trim }}" |
| with_items: "{{ groups['dc-2-r'] }}" |
| when: groups['dc-2'] is defined and inventory_hostname in groups['dc-2'] and groups['dc-2-r'] is defined |
| |
| - name: Collect DC 3 Router addresses |
| cache: |
| key: "vhost_alias" |
| value: "{{ vhost_alias | trim }} {{ hostvars[item].private_address | trim }}" |
| with_items: "{{ groups['dc-3-r'] }}" |
| when: groups['dc-3'] is defined and inventory_hostname in groups['dc-3'] and groups['dc-3-r'] is defined |
| |
| when: ( load_balancer is not defined or load_balancer | trim | length == 0 ) |
| |
| - name: Prepare onboarding config file |
| become: yes |
| template: |
| src: 'apigee-provision.conf.j2' |
| dest: '{{ onboarding_config_file_path }}' |
| mode: 0644 |
| when: provided_onboarding_config_file_path is not defined |
| |
| - name: Copy provided onboarding config file |
| become: yes |
| copy: |
| src: '{{ provided_onboarding_config_file_path }}' |
| dest: '{{ onboarding_config_file_path }}' |
| mode: 0644 |
| when: provided_onboarding_config_file_path is defined |