summaryrefslogtreecommitdiffstats
path: root/playbooks/libvirt/openshift-cluster
diff options
context:
space:
mode:
authorTroy Dawson <tdawson@redhat.com>2015-06-12 12:49:37 -0500
committerTroy Dawson <tdawson@redhat.com>2015-06-12 12:49:37 -0500
commitc650920bc7b0043e59fa3439f48f61d5fa211f2d (patch)
tree3e1f882f5bc7fe419f13a134a71927cb6484fa86 /playbooks/libvirt/openshift-cluster
parent124ca40c134a40b2e6823ab3c4bfe329580d7eaa (diff)
parent42806b6745c747843b71eaf08b62aeee5e450ab1 (diff)
downloadopenshift-c650920bc7b0043e59fa3439f48f61d5fa211f2d.tar.gz
openshift-c650920bc7b0043e59fa3439f48f61d5fa211f2d.tar.bz2
openshift-c650920bc7b0043e59fa3439f48f61d5fa211f2d.tar.xz
openshift-c650920bc7b0043e59fa3439f48f61d5fa211f2d.zip
Merge branch 'master' into prod
Diffstat (limited to 'playbooks/libvirt/openshift-cluster')
-rw-r--r--playbooks/libvirt/openshift-cluster/config.yml1
-rw-r--r--playbooks/libvirt/openshift-cluster/service.yml32
-rw-r--r--playbooks/libvirt/openshift-cluster/tasks/launch_instances.yml12
3 files changed, 36 insertions, 9 deletions
diff --git a/playbooks/libvirt/openshift-cluster/config.yml b/playbooks/libvirt/openshift-cluster/config.yml
index faf278b10..75e2005a2 100644
--- a/playbooks/libvirt/openshift-cluster/config.yml
+++ b/playbooks/libvirt/openshift-cluster/config.yml
@@ -36,3 +36,4 @@
openshift_cluster_id: "{{ cluster_id }}"
openshift_debug_level: 4
openshift_deployment_type: "{{ deployment_type }}"
+ openshift_first_master: "{{ groups.oo_first_master.0 }}"
diff --git a/playbooks/libvirt/openshift-cluster/service.yml b/playbooks/libvirt/openshift-cluster/service.yml
new file mode 100644
index 000000000..ae095f5a2
--- /dev/null
+++ b/playbooks/libvirt/openshift-cluster/service.yml
@@ -0,0 +1,32 @@
+---
+# TODO: need to figure out a plan for setting hostname, currently the default
+# is localhost, so no hostname value (or public_hostname) value is getting
+# assigned
+
+- name: Call same systemctl command for openshift on all instance(s)
+ hosts: localhost
+ gather_facts: no
+ vars_files:
+ - vars.yml
+ tasks:
+ - fail: msg="cluster_id is required to be injected in this playbook"
+ when: cluster_id is not defined
+
+ - name: Evaluate g_service_masters
+ add_host:
+ name: "{{ item }}"
+ ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
+ ansible_sudo: "{{ deployment_vars[deployment_type].sudo }}"
+ groups: g_service_masters
+ with_items: groups["tag_env-host-type-{{ cluster_id }}-openshift-master"] | default([])
+
+ - name: Evaluate g_service_nodes
+ add_host:
+ name: "{{ item }}"
+ ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
+ ansible_sudo: "{{ deployment_vars[deployment_type].sudo }}"
+ groups: g_service_nodes
+ with_items: groups["tag_env-host-type-{{ cluster_id }}-openshift-node"] | default([])
+
+- include: ../../common/openshift-node/service.yml
+- include: ../../common/openshift-master/service.yml
diff --git a/playbooks/libvirt/openshift-cluster/tasks/launch_instances.yml b/playbooks/libvirt/openshift-cluster/tasks/launch_instances.yml
index 359d0b2f3..8291192ab 100644
--- a/playbooks/libvirt/openshift-cluster/tasks/launch_instances.yml
+++ b/playbooks/libvirt/openshift-cluster/tasks/launch_instances.yml
@@ -58,23 +58,17 @@
uri: '{{ libvirt_uri }}'
with_items: instances
-- name: Collect MAC addresses of the VMs
- shell: 'virsh -c {{ libvirt_uri }} dumpxml {{ item }} | xmllint --xpath "string(//domain/devices/interface/mac/@address)" -'
- register: scratch_mac
- with_items: instances
-
- name: Wait for the VMs to get an IP
- command: "egrep -c '{{ scratch_mac.results | oo_collect('stdout') | join('|') }}' /proc/net/arp"
- ignore_errors: yes
+ shell: 'virsh -c {{ libvirt_uri }} net-dhcp-leases openshift-ansible | egrep -c ''{{ instances | join("|") }}'''
register: nb_allocated_ips
until: nb_allocated_ips.stdout == '{{ instances | length }}'
retries: 30
delay: 1
- name: Collect IP addresses of the VMs
- shell: "awk '/{{ item.stdout }}/ {print $1}' /proc/net/arp"
+ shell: 'virsh -c {{ libvirt_uri }} net-dhcp-leases openshift-ansible | awk ''$6 == "{{ item }}" {gsub(/\/.*/, "", $5); print $5}'''
register: scratch_ip
- with_items: scratch_mac.results
+ with_items: instances
- set_fact:
ips: "{{ scratch_ip.results | oo_collect('stdout') }}"