Updated install to work if router and message processors are defined on separate boxes.
diff --git a/tasks/main.yml b/tasks/main.yml index b2a1362..c699d0c 100644 --- a/tasks/main.yml +++ b/tasks/main.yml
@@ -20,13 +20,23 @@ msg: "Admin password must be provided" when: opdk_user_pass is not defined -- name: Create apigee-validate.conf file +- name: Create apigee-validate.conf file for RMP become: true template: - src: apigee-validate.conf.j2 + src: apigee-validate-rmp.conf.j2 dest: '{{ apigee_validate_config_file }}' owner: '{{ opdk_user_name }}' group: '{{ opdk_group_name }}' + when: groups['dc-1-rmp'] is defined + +- name: Create apigee-validate.conf file for Router separate from MP + become: true + template: + src: apigee-validate-r-mp.conf.j2 + dest: '{{ apigee_validate_config_file }}' + owner: '{{ opdk_user_name }}' + group: '{{ opdk_group_name }}' + when: groups['r'] is defined and groups['mp'] - name: Validate OPDK Installation expect:
diff --git a/templates/apigee-validate-r-mp.conf.j2 b/templates/apigee-validate-r-mp.conf.j2 new file mode 100644 index 0000000..5c5b912 --- /dev/null +++ b/templates/apigee-validate-r-mp.conf.j2
@@ -0,0 +1,40 @@ +{% if groups['dc-1'] is defined and inventory_hostname in groups['dc-1'] %} +MSIP={{ hostvars[groups['dc-1-ms'][0]][interface_name].ipv4.address }} +{% elif groups['dc-2'] is defined and inventory_hostname in groups['dc-2'] %} +MSIP={{ hostvars[groups['dc-2-ms'][0]][interface_name].ipv4.address }} +{% else %} +{# Default to the MS in region 1 #} +MSIP={{ hostvars[groups['dc-1-ms'][0]][interface_name].ipv4.address }} +{% endif %} +ADMIN_EMAIL={{ opdk_user_email }} +APIGEE_PORT_HTTP_MS={{ ms_ext_mgmt_port }} +APIGEE_ADMINPW={{ opdk_user_pass }} +{% if groups['dc-1'] is defined and inventory_hostname in groups['dc-1'] %} +REGION=dc-1 +{% elif groups['dc-2'] is defined and inventory_hostname in groups['dc-2'] %} +REGION=dc-2 +{% elif groups['dc-3'] is defined and inventory_hostname in groups['dc-3'] %} +REGION=dc-3 +{% else %} +REGION=Please update the region +{% endif %} +MP_POD={{ opdk_mp_pod }} +{% if groups['dc-1'] is defined and inventory_hostname in groups['dc-1'] %} +MP_IP='{{ hostvars[groups['dc-1-rmp'][0]][interface_name].ipv4.address }}' +{% elif groups['dc-2'] is defined and inventory_hostname in groups['dc-2'] %} +MP_IP='{{ hostvars[groups['dc-2-rmp'][0]][interface_name].ipv4.address }}' +{% elif groups['dc-3'] is defined and inventory_hostname in groups['dc-3'] %} +MP_IP='{{ hostvars[groups['dc-3-rmp'][0]][interface_name].ipv4.address }}' +{% else %} +MP_IP=please update the mp ip address +{% endif %} +MP_PORT={{ mp_ext_mgmt_port }} +{% if groups['dc-1'] is defined and inventory_hostname in groups['dc-1'] %} +HOST_ALIAS='{{ groups['dc-1-rmp'] | join(" ") }}' +{% elif groups['dc-2'] is defined and inventory_hostname in groups['dc-2'] %} +HOST_ALIAS='{{ groups['dc-2-rmp'] | join(" ") }}' +{% elif groups['dc-3'] is defined and inventory_hostname in groups['dc-3'] %} +HOST_ALIAS="{{ groups['dc-3-rmp'] | join(' ') }}" +{% else %} +HOST_ALIAS=Neither a dc-1 or dc-2 inventory group was defined +{% endif %}
diff --git a/templates/apigee-validate-rmp.conf.j2 b/templates/apigee-validate-rmp.conf.j2 new file mode 100644 index 0000000..0ad6642 --- /dev/null +++ b/templates/apigee-validate-rmp.conf.j2
@@ -0,0 +1,40 @@ +{% if groups['dc-1'] is defined and inventory_hostname in groups['dc-1'] %} + MSIP={{ hostvars[groups['dc-1-ms'][0]][interface_name].ipv4.address }} +{% elif groups['dc-2'] is defined and inventory_hostname in groups['dc-2'] %} + MSIP={{ hostvars[groups['dc-2-ms'][0]][interface_name].ipv4.address }} +{% else %} + {# Default to the MS in region 1 #} + MSIP={{ hostvars[groups['dc-1-ms'][0]][interface_name].ipv4.address }} +{% endif %} +ADMIN_EMAIL={{ opdk_user_email }} +APIGEE_PORT_HTTP_MS={{ ms_ext_mgmt_port }} +APIGEE_ADMINPW={{ opdk_user_pass }} +{% if groups['dc-1'] is defined and inventory_hostname in groups['dc-1'] %} + REGION=dc-1 +{% elif groups['dc-2'] is defined and inventory_hostname in groups['dc-2'] %} + REGION=dc-2 +{% elif groups['dc-3'] is defined and inventory_hostname in groups['dc-3'] %} + REGION=dc-3 +{% else %} + REGION=Please update the region +{% endif %} +MP_POD={{ opdk_mp_pod }} +{% if groups['dc-1'] is defined and inventory_hostname in groups['dc-1'] %} + MP_IP='{{ hostvars[groups['dc-1-mp'][0]][interface_name].ipv4.address }}' +{% elif groups['dc-2'] is defined and inventory_hostname in groups['dc-2'] %} + MP_IP='{{ hostvars[groups['dc-2-mp'][0]][interface_name].ipv4.address }}' +{% elif groups['dc-3'] is defined and inventory_hostname in groups['dc-3'] %} + MP_IP='{{ hostvars[groups['dc-3-mp'][0]][interface_name].ipv4.address }}' +{% else %} + MP_IP=please update the mp ip address +{% endif %} +MP_PORT={{ mp_ext_mgmt_port }} +{% if groups['dc-1'] is defined and inventory_hostname in groups['dc-1'] %} + HOST_ALIAS='{{ groups['dc-1-r'] | join(" ") }}' +{% elif groups['dc-2'] is defined and inventory_hostname in groups['dc-2'] %} + HOST_ALIAS='{{ groups['dc-2-r'] | join(" ") }}' +{% elif groups['dc-3'] is defined and inventory_hostname in groups['dc-3'] %} + HOST_ALIAS="{{ groups['dc-3-r'] | join(' ') }}" +{% else %} + HOST_ALIAS=Neither a dc-1 or dc-2 inventory group was defined +{% endif %}
diff --git a/templates/apigee-validate.conf.j2 b/templates/apigee-validate.conf.j2 deleted file mode 100644 index 2f85f65..0000000 --- a/templates/apigee-validate.conf.j2 +++ /dev/null
@@ -1,58 +0,0 @@ -{% if groups['dc-1'] is defined and inventory_hostname in groups['dc-1'] %} -MSIP={{ hostvars[groups['dc-1-ms'][0]][interface_name].ipv4.address }} -{% elif groups['dc-2'] is defined and inventory_hostname in groups['dc-2'] %} -MSIP={{ hostvars[groups['dc-2-ms'][0]][interface_name].ipv4.address }} -{% else %} -{# Default to the MS in region 1 #} -MSIP={{ hostvars[groups['dc-1-ms'][0]][interface_name].ipv4.address }} -{% endif %} -ADMIN_EMAIL={{ opdk_user_email }} -APIGEE_PORT_HTTP_MS={{ ms_ext_mgmt_port }} -APIGEE_ADMINPW={{ opdk_user_pass }} -{% if groups['dc-1'] is defined and inventory_hostname in groups['dc-1'] %} -REGION=dc-1 -{% elif groups['dc-2'] is defined and inventory_hostname in groups['dc-2'] %} -REGION=dc-2 -{% elif groups['dc-3'] is defined and inventory_hostname in groups['dc-3'] %} -REGION=dc-3 -{% else %} -REGION=Please update the region -{% endif %} -MP_POD={{ opdk_mp_pod }} -{% if groups['dc-1'] is defined and inventory_hostname in groups['dc-1'] %} - {% if groups['dc-1-rmp'][0] is defined%} - MP_IP='{{ hostvars[groups['dc-1-rmp'][0]][interface_name].ipv4.address }}' - {% elif groups['dc-2-rmp'] is defined and inventory_hostname in groups['dc-2'] %} - MP_IP='{{ hostvars[groups['dc-2-rmp'][0]][interface_name].ipv4.address }}' - {% elif groups['dc-3-rmp'] is defined and inventory_hostname in groups['dc-3'] %} - MP_IP='{{ hostvars[groups['dc-3-rmp'][0]][interface_name].ipv4.address }}' - {% endif %} - {% if groups['dc-1-mp'] is defined %} - MP_IP='{{ hostvars[groups['dc-1-mp'][0]][interface_name].ipv4.address }}' - {% elif groups['dc-2-mp'] is defined and inventory_hostname in groups['dc-2'] %} - MP_IP='{{ hostvars[groups['dc-2-mp'][0]][interface_name].ipv4.address }}' - {% elif groups['dc-3-mp'] is defined and inventory_hostname in groups['dc-3'] %} - MP_IP='{{ hostvars[groups['dc-3-mp'][0]][interface_name].ipv4.address }}' - {% endif %} -{% else %} - MP_IP=please update the mp ip address -{% endif %} -MP_PORT={{ mp_ext_mgmt_port }} -{% if groups['dc-1'] is defined and inventory_hostname in groups['dc-1'] %} - {% if groups['dc-1-rmp'][0] is defined %} - HOST_ALIAS='{{ groups['dc-1-rmp'] | join(" ") }}' - {% elif groups['dc-2-rmp'] is defined and inventory_hostname in groups['dc-2'] %} - HOST_ALIAS='{{ groups['dc-2-rmp'] | join(" ") }}' - {% elif groups['dc-3-rmp'] is defined and inventory_hostname in groups['dc-3'] %} - HOST_ALIAS="{{ groups['dc-3-rmp'] | join(' ') }}" - {% endif %} - {% if groups['dc-1-mp'] is defined %} - HOST_ALIAS='{{ groups['dc-1-mp'] | join(" ") }}' - {% elif groups['dc-2-mp'] is defined and inventory_hostname in groups['dc-2'] %} - HOST_ALIAS='{{ groups['dc-2-mp'] | join(" ") }}' - {% elif groups['dc-3-mp'] is defined and inventory_hostname in groups['dc-3'] %} - HOST_ALIAS="{{ groups['dc-3-mp'] | join(' ') }}" - {% endif %} -{% else %} - HOST_ALIAS=Neither a dc-1 or dc-2 inventory group was defined -{% endif %}