From aa52ca9e12267ce5cf43ebde4782ed6f2fc57150 Mon Sep 17 00:00:00 2001
From: Jonathan Steffan <jsteffan@fedoraproject.org>
Date: Sun, 22 Nov 2015 19:51:21 -0700
Subject: Update for latest CentOS-7-x86_64-GenericCloud.  - Use xz compressed
 image  - Update sha256 for new image  - Update docs to reflect new settings

---
 playbooks/libvirt/openshift-cluster/launch.yml                 | 1 +
 playbooks/libvirt/openshift-cluster/tasks/launch_instances.yml | 9 ++++++++-
 playbooks/libvirt/openshift-cluster/vars.yml                   | 6 ++++--
 3 files changed, 13 insertions(+), 3 deletions(-)

(limited to 'playbooks/libvirt/openshift-cluster')

diff --git a/playbooks/libvirt/openshift-cluster/launch.yml b/playbooks/libvirt/openshift-cluster/launch.yml
index 8d7949dd1..acb53440d 100644
--- a/playbooks/libvirt/openshift-cluster/launch.yml
+++ b/playbooks/libvirt/openshift-cluster/launch.yml
@@ -11,6 +11,7 @@
     image_url: "{{ deployment_vars[deployment_type].image.url }}"
     image_sha256: "{{ deployment_vars[deployment_type].image.sha256 }}"
     image_name: "{{ deployment_vars[deployment_type].image.name }}"
+    image_compression: "{{ deployment_vars[deployment_type].image.compression }}"
   tasks:
   - fail: msg="Deployment type not supported for libvirt provider yet"
     when: deployment_type == 'online'
diff --git a/playbooks/libvirt/openshift-cluster/tasks/launch_instances.yml b/playbooks/libvirt/openshift-cluster/tasks/launch_instances.yml
index 4825207c9..e1e552c36 100644
--- a/playbooks/libvirt/openshift-cluster/tasks/launch_instances.yml
+++ b/playbooks/libvirt/openshift-cluster/tasks/launch_instances.yml
@@ -13,8 +13,15 @@
   get_url:
     url: '{{ image_url }}'
     sha256sum: '{{ image_sha256 }}'
-    dest: '{{ os_libvirt_storage_pool_path }}/{{ image_name }}'
+    dest: '{{ os_libvirt_storage_pool_path }}/{{ [image_name, image_compression] | join(".") }}'
   when: '{{ ( lookup("oo_option", "skip_image_download") | default("no", True) | lower ) in ["false", "no"] }}'
+  register: downloaded_image
+
+- name: Uncompress Base Cloud image
+  command: 'unxz -kf {{ os_libvirt_storage_pool_path }}/{{ image_name }}.{{ image_compression }}'
+  args:
+    creates: '{{ os_libvirt_storage_pool_path }}/{{ image_name }}'
+  when: image_compression in ["xz"] and downloaded_image.changed
 
 - name: Create the cloud-init config drive path
   file:
diff --git a/playbooks/libvirt/openshift-cluster/vars.yml b/playbooks/libvirt/openshift-cluster/vars.yml
index c77a0797e..67cfbcdb8 100644
--- a/playbooks/libvirt/openshift-cluster/vars.yml
+++ b/playbooks/libvirt/openshift-cluster/vars.yml
@@ -8,11 +8,13 @@ deployment_vars:
   origin:
     image:
       url:    "{{ lookup('oo_option', 'image_url') |
-                  default('http://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud.qcow2', True) }}"
+                  default('http://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud.qcow2.xz', True) }}"
+      compression:   "{{ lookup('oo_option', 'image_compression') |
+                         default('xz', True) }}"
       name:   "{{ lookup('oo_option', 'image_name') |
                   default('CentOS-7-x86_64-GenericCloud.qcow2', True) }}"
       sha256: "{{ lookup('oo_option', 'image_sha256') |
-                  default('e324e3ab1d24a1bbf035ddb365e7f9058c0b454acf48d7aa15c5519fae5998ab', True) }}"
+                  default('9461006300d65172f5668d8875f2aad7b54f7ba4e9c5435d65a84a5a2d66e39b', True) }}"
     ssh_user: openshift
     sudo: yes
   online:
-- 
cgit v1.2.3


From a69aedf1f23b3e1927ce81378ec5e07d8aa6c9fc Mon Sep 17 00:00:00 2001
From: Jonathan Steffan <jsteffan@fedoraproject.org>
Date: Sun, 22 Nov 2015 19:57:53 -0700
Subject: Use join for the uncompress command.

---
 playbooks/libvirt/openshift-cluster/tasks/launch_instances.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'playbooks/libvirt/openshift-cluster')

diff --git a/playbooks/libvirt/openshift-cluster/tasks/launch_instances.yml b/playbooks/libvirt/openshift-cluster/tasks/launch_instances.yml
index e1e552c36..f26b41f31 100644
--- a/playbooks/libvirt/openshift-cluster/tasks/launch_instances.yml
+++ b/playbooks/libvirt/openshift-cluster/tasks/launch_instances.yml
@@ -18,7 +18,7 @@
   register: downloaded_image
 
 - name: Uncompress Base Cloud image
-  command: 'unxz -kf {{ os_libvirt_storage_pool_path }}/{{ image_name }}.{{ image_compression }}'
+  command: 'unxz -kf {{ os_libvirt_storage_pool_path }}/{{ [image_name, image_compression] | join(".") }}'
   args:
     creates: '{{ os_libvirt_storage_pool_path }}/{{ image_name }}'
   when: image_compression in ["xz"] and downloaded_image.changed
-- 
cgit v1.2.3


From e81bf0e72dc12736b3ea69151123697b69b5240d Mon Sep 17 00:00:00 2001
From: Jason DeTiberus <jdetiber@redhat.com>
Date: Mon, 30 Nov 2015 11:42:46 -0500
Subject: Enforce connection: local and become: no on all localhost plays

---
 playbooks/libvirt/openshift-cluster/config.yml    | 2 ++
 playbooks/libvirt/openshift-cluster/launch.yml    | 2 ++
 playbooks/libvirt/openshift-cluster/list.yml      | 4 ++++
 playbooks/libvirt/openshift-cluster/service.yml   | 2 ++
 playbooks/libvirt/openshift-cluster/terminate.yml | 4 ++++
 playbooks/libvirt/openshift-cluster/update.yml    | 2 ++
 6 files changed, 16 insertions(+)

(limited to 'playbooks/libvirt/openshift-cluster')

diff --git a/playbooks/libvirt/openshift-cluster/config.yml b/playbooks/libvirt/openshift-cluster/config.yml
index 4d1ae22ff..9bccf80b9 100644
--- a/playbooks/libvirt/openshift-cluster/config.yml
+++ b/playbooks/libvirt/openshift-cluster/config.yml
@@ -5,6 +5,8 @@
 
 - hosts: localhost
   gather_facts: no
+  become: no
+  connection: local
   vars_files:
   - vars.yml
   tasks:
diff --git a/playbooks/libvirt/openshift-cluster/launch.yml b/playbooks/libvirt/openshift-cluster/launch.yml
index 8d7949dd1..da4f175cb 100644
--- a/playbooks/libvirt/openshift-cluster/launch.yml
+++ b/playbooks/libvirt/openshift-cluster/launch.yml
@@ -1,6 +1,8 @@
 ---
 - name: Launch instance(s)
   hosts: localhost
+  become: no
+  connection: local
   gather_facts: no
   vars_files:
   - vars.yml
diff --git a/playbooks/libvirt/openshift-cluster/list.yml b/playbooks/libvirt/openshift-cluster/list.yml
index 5954bb01e..d89e699f2 100644
--- a/playbooks/libvirt/openshift-cluster/list.yml
+++ b/playbooks/libvirt/openshift-cluster/list.yml
@@ -1,6 +1,8 @@
 ---
 - name: Generate oo_list_hosts group
   hosts: localhost
+  become: no
+  connection: local
   gather_facts: no
   vars_files:
   - vars.yml
@@ -21,6 +23,8 @@
 
 - name: List Hosts
   hosts: localhost
+  become: no
+  connection: local
   gather_facts: no
   vars_files:
   - vars.yml
diff --git a/playbooks/libvirt/openshift-cluster/service.yml b/playbooks/libvirt/openshift-cluster/service.yml
index ae095f5a2..aabd2566d 100644
--- a/playbooks/libvirt/openshift-cluster/service.yml
+++ b/playbooks/libvirt/openshift-cluster/service.yml
@@ -5,6 +5,8 @@
 
 - name: Call same systemctl command for openshift on all instance(s)
   hosts: localhost
+  become: no
+  connection: local
   gather_facts: no
   vars_files:
   - vars.yml
diff --git a/playbooks/libvirt/openshift-cluster/terminate.yml b/playbooks/libvirt/openshift-cluster/terminate.yml
index 8f00812a9..a6b963608 100644
--- a/playbooks/libvirt/openshift-cluster/terminate.yml
+++ b/playbooks/libvirt/openshift-cluster/terminate.yml
@@ -3,6 +3,8 @@
 
 - name: Terminate instance(s)
   hosts: localhost
+  become: no
+  connection: local
   gather_facts: no
   vars_files:
   - vars.yml
@@ -28,6 +30,8 @@
 
 - name: Terminate instance(s)
   hosts: localhost
+  become: no
+  connection: local
   gather_facts: no
   vars_files:
   - vars.yml
diff --git a/playbooks/libvirt/openshift-cluster/update.yml b/playbooks/libvirt/openshift-cluster/update.yml
index d09832c16..dde67bcb1 100644
--- a/playbooks/libvirt/openshift-cluster/update.yml
+++ b/playbooks/libvirt/openshift-cluster/update.yml
@@ -1,6 +1,8 @@
 ---
 - name: Populate oo_hosts_to_update group
   hosts: localhost
+  become: no
+  connection: local
   gather_facts: no
   vars_files:
   - vars.yml
-- 
cgit v1.2.3


From 7c945d07d2a61e7334a10388d37ac28f1bc58ce1 Mon Sep 17 00:00:00 2001
From: Kenny Woodson <kwoodson@redhat.com>
Date: Mon, 30 Nov 2015 17:33:03 -0500
Subject: Updating env-host-type to host patterns

---
 playbooks/libvirt/openshift-cluster/config.yml                 |  8 ++++----
 playbooks/libvirt/openshift-cluster/service.yml                |  4 ++--
 playbooks/libvirt/openshift-cluster/tasks/launch_instances.yml |  2 +-
 playbooks/libvirt/openshift-cluster/templates/domain.xml       |  1 -
 playbooks/libvirt/openshift-cluster/update.yml                 | 10 +++++++---
 5 files changed, 14 insertions(+), 11 deletions(-)

(limited to 'playbooks/libvirt/openshift-cluster')

diff --git a/playbooks/libvirt/openshift-cluster/config.yml b/playbooks/libvirt/openshift-cluster/config.yml
index 4d1ae22ff..3410c735a 100644
--- a/playbooks/libvirt/openshift-cluster/config.yml
+++ b/playbooks/libvirt/openshift-cluster/config.yml
@@ -14,10 +14,10 @@
 
 - include: ../../common/openshift-cluster/config.yml
   vars:
-    g_etcd_group: "{{ 'tag_env-host-type-' ~ cluster_id ~ '-openshift-etcd' }}"
-    g_lb_group: "{{ 'tag_env-host-type-' ~ cluster_id ~ '-openshift-lb' }}"
-    g_masters_group: "{{ 'tag_env-host-type-' ~ cluster_id ~ '-openshift-master' }}"
-    g_nodes_group: "{{ 'tag_env-host-type-' ~ cluster_id ~ '-openshift-node' }}"
+    g_etcd_hosts:   "{{ (groups['tag_host-type-etcd']|default([]))   | intersect((groups['tag_env-' ~ cluster_id]|default([]))) }}"
+    g_lb_hosts:     "{{ (groups['tag_host-type-lb']|default([]))     | intersect((groups['tag_env-' ~ cluster_id]|default([]))) }}"
+    g_master_hosts: "{{ (groups['tag_host-type-master']|default([])) | intersect((groups['tag_env-' ~ cluster_id]|default([]))) }}"
+    g_node_hosts:   "{{ (groups['tag_host-type-node']|default([]))   | intersect((groups['tag_env-' ~ cluster_id]|default([]))) }}"
     g_ssh_user: "{{ hostvars.localhost.g_ssh_user_tmp }}"
     g_sudo: "{{ hostvars.localhost.g_sudo_tmp }}"
     openshift_cluster_id: "{{ cluster_id }}"
diff --git a/playbooks/libvirt/openshift-cluster/service.yml b/playbooks/libvirt/openshift-cluster/service.yml
index ae095f5a2..8afaf2e9d 100644
--- a/playbooks/libvirt/openshift-cluster/service.yml
+++ b/playbooks/libvirt/openshift-cluster/service.yml
@@ -18,7 +18,7 @@
       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([])
+    with_items: "{{ g_master_hosts | default([]) }}"
 
   - name: Evaluate g_service_nodes
     add_host:
@@ -26,7 +26,7 @@
       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([])
+    with_items: "{{ g_node_hosts | 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 4825207c9..e6317c32a 100644
--- a/playbooks/libvirt/openshift-cluster/tasks/launch_instances.yml
+++ b/playbooks/libvirt/openshift-cluster/tasks/launch_instances.yml
@@ -81,7 +81,7 @@
     ansible_ssh_host: '{{ item.1 }}'
     ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
     ansible_sudo: "{{ deployment_vars[deployment_type].sudo }}"
-    groups: 'tag_env-{{ cluster }}, tag_host-type-{{ type }}, tag_env-host-type-{{ cluster }}-openshift-{{ type }}, tag_sub-host-type-{{ g_sub_host_type }}'
+    groups: 'tag_env-{{ cluster }}, tag_host-type-{{ type }}, tag_sub-host-type-{{ g_sub_host_type }}'
   with_together:
     - instances
     - ips
diff --git a/playbooks/libvirt/openshift-cluster/templates/domain.xml b/playbooks/libvirt/openshift-cluster/templates/domain.xml
index 870bcf2a6..c4ac6a434 100644
--- a/playbooks/libvirt/openshift-cluster/templates/domain.xml
+++ b/playbooks/libvirt/openshift-cluster/templates/domain.xml
@@ -4,7 +4,6 @@
   <metadata xmlns:ansible="https://github.com/ansible/ansible">
     <ansible:tags>
       <ansible:tag>env-{{ cluster }}</ansible:tag>
-      <ansible:tag>env-host-type-{{ cluster }}-openshift-{{ type }}</ansible:tag>
       <ansible:tag>host-type-{{ type }}</ansible:tag>
       <ansible:tag>sub-host-type-{{ g_sub_host_type }}</ansible:tag>
     </ansible:tags>
diff --git a/playbooks/libvirt/openshift-cluster/update.yml b/playbooks/libvirt/openshift-cluster/update.yml
index d09832c16..415880845 100644
--- a/playbooks/libvirt/openshift-cluster/update.yml
+++ b/playbooks/libvirt/openshift-cluster/update.yml
@@ -2,6 +2,12 @@
 - name: Populate oo_hosts_to_update group
   hosts: localhost
   gather_facts: no
+  vars:
+    g_etcd_hosts:   "{{ (groups['tag_host-type-etcd']|default([])) | intersect(groups['tag_env-' ~ cluster_id]) }}"
+    g_lb_hosts:     "{{ (groups['tag_host-type-lb']|default([])) | intersect(groups['tag_env-' ~ cluster_id]) }}"
+    g_master_hosts: "{{ (groups['tag_host-type-master']|default([])) | intersect(groups['tag_env-' ~ cluster_id]) }}"
+    g_node_hosts:   "{{ (groups['tag_host-type-node']|default([])) | intersect((groups['tag_env-' ~ cluster_id]|default([]))) }}"
+
   vars_files:
   - vars.yml
   tasks:
@@ -11,9 +17,7 @@
       groups: oo_hosts_to_update
       ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
       ansible_sudo: "{{ deployment_vars[deployment_type].sudo }}"
-    with_items: (groups["tag_env-host-type-{{ cluster_id }}-openshift-master"] | default([]))
-                | union(groups["tag_env-host-type-{{ cluster_id }}-openshift-node"] | default([]))
-                | union(groups["tag_env-host-type-{{ cluster_id }}-openshift-etcd"] | default([]))
+    with_items: "{{ g_master_hosts  | union(g_node_hosts) | union(g_etcd_hosts) | default([]) }}"
 
 - include: ../../common/openshift-cluster/update_repos_and_packages.yml
 
-- 
cgit v1.2.3