summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.tito/packages/openshift-ansible2
-rwxr-xr-xinventory/multi_inventory.py75
-rw-r--r--openshift-ansible.spec10
-rw-r--r--playbooks/common/openshift-master/scaleup.yml3
-rw-r--r--playbooks/common/openshift-node/config.yml3
-rw-r--r--roles/openshift_master/handlers/main.yml3
-rw-r--r--roles/openshift_master/tasks/main.yml3
-rw-r--r--roles/openshift_node/tasks/main.yml3
8 files changed, 73 insertions, 29 deletions
diff --git a/.tito/packages/openshift-ansible b/.tito/packages/openshift-ansible
index ba0a6d69d..e6a0b6e80 100644
--- a/.tito/packages/openshift-ansible
+++ b/.tito/packages/openshift-ansible
@@ -1 +1 @@
-3.0.57-1 ./
+3.0.58-1 ./
diff --git a/inventory/multi_inventory.py b/inventory/multi_inventory.py
index 20fc48aa9..57be259f7 100755
--- a/inventory/multi_inventory.py
+++ b/inventory/multi_inventory.py
@@ -25,6 +25,9 @@ class MultiInventoryException(Exception):
'''Exceptions for MultiInventory class'''
pass
+# pylint: disable=too-many-public-methods
+# After a refactor of too-many-branches and placing those branches into
+# their own corresponding function, we have passed the allowed amount of functions(20).
class MultiInventory(object):
'''
MultiInventory class:
@@ -282,35 +285,63 @@ class MultiInventory(object):
else:
return data.get(keys, None)
- def apply_account_config(self, acc_config):
- ''' Apply account config settings
- '''
- results = self.all_inventory_results[acc_config['name']]
- results['all_hosts'] = results['_meta']['hostvars'].keys()
-
+ def apply_extra_vars(self, inventory, extra_vars):
+ ''' Apply the account config extra vars '''
# Extra vars go here
- for new_var, value in acc_config.get('extra_vars', {}).items():
- for data in results['_meta']['hostvars'].values():
+ for new_var, value in extra_vars.items():
+ for data in inventory.values():
self.add_entry(data, new_var, value)
+ def apply_clone_vars(self, inventory, clone_vars):
+ ''' Apply the account config clone vars '''
# Clone vars go here
- for to_name, from_name in acc_config.get('clone_vars', {}).items():
- for data in results['_meta']['hostvars'].values():
+ for to_name, from_name in clone_vars.items():
+ for data in inventory.values():
self.add_entry(data, to_name, self.get_entry(data, from_name))
- # Extra groups go here
- for new_var, value in acc_config.get('extra_groups', {}).items():
- for data in results['_meta']['hostvars'].values():
- results["%s_%s" % (new_var, value)] = copy.copy(results['all_hosts'])
-
- # Clone groups go here
- # Build a group based on the desired key name
- for to_name, from_name in acc_config.get('clone_groups', {}).items():
- for name, data in results['_meta']['hostvars'].items():
+ def apply_extra_groups(self, inventory, extra_groups):
+ ''' Apply the account config for extra groups '''
+ _ = self # Here for pylint. wanted an instance method instead of static
+ for new_var, value in extra_groups.items():
+ for _ in inventory['_meta']['hostvars'].values():
+ inventory["%s_%s" % (new_var, value)] = copy.copy(inventory['all_hosts'])
+
+ def apply_clone_groups(self, inventory, clone_groups):
+ ''' Apply the account config for clone groups '''
+ for to_name, from_name in clone_groups.items():
+ for name, data in inventory['_meta']['hostvars'].items():
key = '%s_%s' % (to_name, self.get_entry(data, from_name))
- if not results.has_key(key):
- results[key] = []
- results[key].append(name)
+ if not inventory.has_key(key):
+ inventory[key] = []
+ inventory[key].append(name)
+
+ def apply_group_selectors(self, inventory, group_selectors):
+ ''' Apply the account config for clone groups '''
+ _ = self # Here for pylint. wanted an instance method instead of static
+ for selector in group_selectors:
+ if inventory.has_key(selector['from_group']):
+ inventory[selector['from_group']].sort()
+ inventory[selector['name']] = inventory[selector['from_group']][0:selector['count']]
+ for host in inventory[selector['from_group']]:
+ if host in inventory[selector['name']]:
+ inventory['_meta']['hostvars'][host][selector['name']] = True
+ else:
+ inventory['_meta']['hostvars'][host][selector['name']] = False
+
+ def apply_account_config(self, acc_config):
+ ''' Apply account config settings '''
+ results = self.all_inventory_results[acc_config['name']]
+ results['all_hosts'] = results['_meta']['hostvars'].keys()
+
+ self.apply_extra_vars(results['_meta']['hostvars'], acc_config.get('extra_vars', {}))
+
+ self.apply_clone_vars(results['_meta']['hostvars'], acc_config.get('clone_vars', {}))
+
+ self.apply_extra_groups(results, acc_config.get('extra_groups', {}))
+
+ self.apply_clone_groups(results, acc_config.get('clone_groups', {}))
+
+ self.apply_group_selectors(results, acc_config.get('group_selectors', {}))
# store the results back into all_inventory_results
self.all_inventory_results[acc_config['name']] = results
diff --git a/openshift-ansible.spec b/openshift-ansible.spec
index 358c346a1..bad7e68b2 100644
--- a/openshift-ansible.spec
+++ b/openshift-ansible.spec
@@ -5,7 +5,7 @@
}
Name: openshift-ansible
-Version: 3.0.57
+Version: 3.0.58
Release: 1%{?dist}
Summary: Openshift and Atomic Enterprise Ansible
License: ASL 2.0
@@ -279,6 +279,14 @@ Atomic OpenShift Utilities includes
%changelog
+* Tue Mar 15 2016 Kenny Woodson <kwoodson@redhat.com> 3.0.58-1
+- Group selector feature added (kwoodson@redhat.com)
+- nfs: replace yum with dnf (efreiber@redhat.com)
+- Move common common facts to openshift_facts (jdetiber@redhat.com)
+- perform oc client config tasks only once when ansible_ssh_user is root
+ (jdetiber@redhat.com)
+- OSE/Origin < 3.2/1.2 should not get Docker 1.9 (sdodson@redhat.com)
+
* Mon Mar 14 2016 Brenton Leanhardt <bleanhar@redhat.com> 3.0.57-1
- Docker stderr can break this script if ansible executes it remotely
(bleanhar@redhat.com)
diff --git a/playbooks/common/openshift-master/scaleup.yml b/playbooks/common/openshift-master/scaleup.yml
index ccb1d23f1..6e6cb3e01 100644
--- a/playbooks/common/openshift-master/scaleup.yml
+++ b/playbooks/common/openshift-master/scaleup.yml
@@ -33,7 +33,8 @@
service: name={{ openshift.common.service_type }}-master-controllers state=restarted
- name: verify api server
command: >
- curl -k --silent {{ openshift.master.api_url }}/healthz/ready
+ curl --silent --cacert {{ openshift.common.config_base }}/master/ca.crt
+ {{ openshift.master.api_url }}/healthz/ready
register: api_available_output
until: api_available_output.stdout == 'ok'
retries: 120
diff --git a/playbooks/common/openshift-node/config.yml b/playbooks/common/openshift-node/config.yml
index 1f32f2786..aa71ab703 100644
--- a/playbooks/common/openshift-node/config.yml
+++ b/playbooks/common/openshift-node/config.yml
@@ -256,7 +256,8 @@
# Using curl here since the uri module requires python-httplib2 and
# wait_for port doesn't provide health information.
command: >
- curl -k --silent {{ openshift.master.api_url }}/healthz/ready
+ curl --silent --cacert {{ openshift.master.config_dir }}/master/ca.crt
+ {{ openshift.master.api_url }}/healthz/ready
register: api_available_output
until: api_available_output.stdout == 'ok'
retries: 120
diff --git a/roles/openshift_master/handlers/main.yml b/roles/openshift_master/handlers/main.yml
index 4d1216aae..e5b9e4977 100644
--- a/roles/openshift_master/handlers/main.yml
+++ b/roles/openshift_master/handlers/main.yml
@@ -17,7 +17,8 @@
# Using curl here since the uri module requires python-httplib2 and
# wait_for port doesn't provide health information.
command: >
- curl -k --silent {{ openshift.master.api_url }}/healthz/ready
+ curl --silent --cacert {{ openshift.common.config_base }}/master/ca.crt
+ {{ openshift.master.api_url }}/healthz/ready
register: api_available_output
until: api_available_output.stdout == 'ok'
retries: 120
diff --git a/roles/openshift_master/tasks/main.yml b/roles/openshift_master/tasks/main.yml
index 1f499dc93..9c3d09d09 100644
--- a/roles/openshift_master/tasks/main.yml
+++ b/roles/openshift_master/tasks/main.yml
@@ -282,7 +282,8 @@
# Using curl here since the uri module requires python-httplib2 and
# wait_for port doesn't provide health information.
command: >
- curl -k --silent {{ openshift.master.api_url }}/healthz/ready
+ curl --silent --cacert {{ openshift.common.config_base }}/master/ca.crt
+ {{ openshift.master.api_url }}/healthz/ready
register: api_available_output
until: api_available_output.stdout == 'ok'
retries: 120
diff --git a/roles/openshift_node/tasks/main.yml b/roles/openshift_node/tasks/main.yml
index 8768d426b..f854d3f38 100644
--- a/roles/openshift_node/tasks/main.yml
+++ b/roles/openshift_node/tasks/main.yml
@@ -126,7 +126,8 @@
# Using curl here since the uri module requires python-httplib2 and
# wait_for port doesn't provide health information.
command: >
- curl -k --silent {{ openshift_node_master_api_url }}/healthz/ready
+ curl --silent --cacert {{ openshift.common.config_base }}/node/ca.crt
+ {{ openshift_node_master_api_url }}/healthz/ready
register: api_available_output
until: api_available_output.stdout == 'ok'
retries: 120