From b00727520bc903efc02ece721c3500e599f18b75 Mon Sep 17 00:00:00 2001 From: Jhon Honce Date: Fri, 3 Oct 2014 15:16:18 -0700 Subject: WIP Infra - Use variables in roles --- playbooks/gce/openshift-master/config.yml | 3 ++- playbooks/gce/openshift-minion/config.yml | 3 ++- roles/openshift_master/tasks/main.yml | 4 ++-- roles/openshift_minion/tasks/main.yml | 4 ++-- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/playbooks/gce/openshift-master/config.yml b/playbooks/gce/openshift-master/config.yml index 681f804cc..f705bb305 100644 --- a/playbooks/gce/openshift-master/config.yml +++ b/playbooks/gce/openshift-master/config.yml @@ -34,6 +34,7 @@ - ../../../roles/repos - { role: ../../../roles/openshift_master, - oo_minion_ips: "{{ hostvars['localhost'].oo_minion_ips | default(['']) }}" + oo_minion_ips: "{{ hostvars['localhost'].oo_minion_ips | default(['']) }}", + oo_bind_ip: "{{ hostvars[inventory_hostname].ansible_eth0.ipv4.address | default(['']) }}" } - ../../../roles/pods diff --git a/playbooks/gce/openshift-minion/config.yml b/playbooks/gce/openshift-minion/config.yml index 0a92d41c7..0f78d4c76 100644 --- a/playbooks/gce/openshift-minion/config.yml +++ b/playbooks/gce/openshift-minion/config.yml @@ -35,5 +35,6 @@ - ../../../roles/docker - { role: ../../../roles/openshift_minion, - oo_master_ips: "{{ hostvars['localhost'].oo_master_ips | default(['']) }}" + oo_master_ips: "{{ hostvars['localhost'].oo_master_ips | default(['']) }}", + oo_bind_ip: "{{ hostvars[inventory_hostname].ansible_eth0.ipv4.address | default(['']) }}" } diff --git a/roles/openshift_master/tasks/main.yml b/roles/openshift_master/tasks/main.yml index 5a940c88a..83573cb27 100644 --- a/roles/openshift_master/tasks/main.yml +++ b/roles/openshift_master/tasks/main.yml @@ -9,8 +9,8 @@ regexp={{ item.regex }} line="{{ item.line }}" with_items: - - { regex: '^OPENSHIFT_MASTER', line: 'OPENSHIFT_MASTER=\"{{ hostvars[inventory_hostname].ansible_eth0.ipv4.address }}\"' } - - { regex: '^OPENSHIFT_BIND_ADDR', line: 'OPENSHIFT_BIND_ADDR=\"{{ hostvars[inventory_hostname].ansible_eth0.ipv4.address }}\"'} + - { regex: '^OPENSHIFT_MASTER', line: 'OPENSHIFT_MASTER=\"{{ oo_bind_ip }}\"' } + - { regex: '^OPENSHIFT_BIND_ADDR', line: 'OPENSHIFT_BIND_ADDR=\"{{ oo_bind_ip }}\"'} notify: - restart openshift-master diff --git a/roles/openshift_minion/tasks/main.yml b/roles/openshift_minion/tasks/main.yml index c43575945..2b1f5332e 100644 --- a/roles/openshift_minion/tasks/main.yml +++ b/roles/openshift_minion/tasks/main.yml @@ -10,7 +10,7 @@ line="{{ item.line }}" with_items: - { regex: '^OPENSHIFT_MASTER', line: 'OPENSHIFT_MASTER=\"{{ oo_master_ips[0] }}\"' } - - { regex: '^OPENSHIFT_BIND_ADDR', line: 'OPENSHIFT_BIND_ADDR=\"{{ hostvars[inventory_hostname].ansible_eth0.ipv4.address }}\"'} + - { regex: '^OPENSHIFT_BIND_ADDR', line: 'OPENSHIFT_BIND_ADDR=\"{{ oo_bind_ip }}\"'} notify: - restart openshift-minion @@ -26,5 +26,5 @@ service: name=openshift enabled=yes state=started - name: Register with OpenShift master - command: "curl -X POST -H 'Accept: application/json' -d '{\"kind\":\"Minion\", \"id\":\"{{ hostvars[inventory_hostname].ansible_eth0.ipv4.address }}\", \"apiVersion\":\"v1beta1\", \"hostIP\":\"{{ hostvars[inventory_hostname].ansible_eth0.ipv4.address }}\" }' http://{{ oo_master_ips[0] }}:8080/api/v1beta1/minions" + command: "curl -X POST -H 'Accept: application/json' -d '{\"kind\":\"Minion\", \"id\":\"{{ oo_bind_ip }}\", \"apiVersion\":\"v1beta1\", \"hostIP\":\"{{ oo_bind_ip }}\" }' http://{{ oo_master_ips[0] }}:8080/api/v1beta1/minions" when: oo_master_ips[0] != '' -- cgit v1.2.3