From 67afaa13ee375def01960004195254b46cddd0db Mon Sep 17 00:00:00 2001
From: Jhon Honce <jhonce@redhat.com>
Date: Wed, 3 Jun 2015 09:29:46 -0700
Subject: Infrastructure - Add service action to bin/cluster

* Add necessary playbooks/roles
* Cleanup bin/cluster to meet new design guide lines
---
 bin/cluster | 30 +++++++++++++++++++++++++++---
 1 file changed, 27 insertions(+), 3 deletions(-)

(limited to 'bin')

diff --git a/bin/cluster b/bin/cluster
index 79f1f988f..2a6cb4b58 100755
--- a/bin/cluster
+++ b/bin/cluster
@@ -9,8 +9,9 @@ import os
 
 class Cluster(object):
     """
-    Control and Configuration Interface for OpenShift Clusters
+    Provide Command, Control and Configuration (c3) Interface for OpenShift Clusters
     """
+
     def __init__(self):
         # setup ansible ssh environment
         if 'ANSIBLE_SSH_ARGS' not in os.environ:
@@ -104,6 +105,21 @@ class Cluster(object):
 
         return self.action(args, inventory, env, playbook)
 
+    def service(self, args):
+        """
+        Make the same service call across all nodes in the cluster
+        :param args: command line arguments provided by user
+        :return: exit status from run command
+        """
+        env = {'cluster_id': args.cluster_id,
+               'deployment_type': self.get_deployment_type(args),
+               'new_cluster_state': args.state}
+
+        playbook = "playbooks/{}/openshift-cluster/service.yml".format(args.provider)
+        inventory = self.setup_provider(args.provider)
+
+        return self.action(args, inventory, env, playbook)
+
     def setup_provider(self, provider):
         """
         Setup ansible playbook environment
@@ -167,7 +183,7 @@ class Cluster(object):
 
 if __name__ == '__main__':
     """
-    Implemented to support writing unit tests
+    User command to invoke ansible playbooks in a "known" environment
     """
 
     cluster = Cluster()
@@ -221,6 +237,13 @@ if __name__ == '__main__':
                                            parents=[meta_parser])
     list_parser.set_defaults(func=cluster.list)
 
+    service_parser = action_parser.add_parser('service', help='service for openshift across cluster',
+                                              parents=[meta_parser])
+    # choices are the only ones valid for the ansible service module: http://docs.ansible.com/service_module.html
+    service_parser.add_argument('state', choices=['started', 'stopped', 'restarted', 'reloaded'],
+                                help='make service call across cluster')
+    service_parser.set_defaults(func=cluster.service)
+
     args = parser.parse_args()
 
     if 'terminate' == args.action and not args.force:
@@ -230,7 +253,8 @@ if __name__ == '__main__':
             exit(1)
 
     if 'update' == args.action and not args.force:
-        answer = raw_input("This is destructive and could corrupt {} environment. Continue? [y/N] ".format(args.cluster_id))
+        answer = raw_input(
+            "This is destructive and could corrupt {} environment. Continue? [y/N] ".format(args.cluster_id))
         if answer not in ['y', 'Y']:
             sys.stderr.write('\nACTION [update] aborted by user!\n')
             exit(1)
-- 
cgit v1.2.3


From 6d4dd9f43d4b5dc747bfff5700d2e7b6a562ba9c Mon Sep 17 00:00:00 2001
From: Jhon Honce <jhonce@redhat.com>
Date: Wed, 3 Jun 2015 15:11:01 -0700
Subject: Issue 119 - Add support for ~/.openshift-ansible

* Allow user to override: validate_cluster_ids, cluster_ids, providers
---
 bin/cluster | 28 +++++++++++++++++++++++++---
 1 file changed, 25 insertions(+), 3 deletions(-)

(limited to 'bin')

diff --git a/bin/cluster b/bin/cluster
index 2a6cb4b58..0a6ee7ec4 100755
--- a/bin/cluster
+++ b/bin/cluster
@@ -184,21 +184,43 @@ class Cluster(object):
 if __name__ == '__main__':
     """
     User command to invoke ansible playbooks in a "known" environment
+
+    Reads ~/.openshift-ansible for default configuration items
+      [DEFAULT]
+      validate_cluster_ids = False
+      cluster_ids = production,stage,integration
+      providers = gce,aws,libvirt
     """
 
+    environment = ConfigParser.SafeConfigParser({
+        'cluster_ids': 'prod,stg,int',
+        'validate_cluster_ids': 'False',
+        'providers': 'gce,aws,libvirt',
+    })
+
+    path = os.path.expanduser("~/.openshift-ansible")
+    if os.path.isfile(path):
+        environment.read(path)
+
     cluster = Cluster()
 
-    providers = ['gce', 'aws', 'libvirt']
     parser = argparse.ArgumentParser(
         description='Python wrapper to ensure proper environment for OpenShift ansible playbooks',
     )
     parser.add_argument('-v', '--verbose', action='count',
                         help='Multiple -v options increase the verbosity')
-    parser.add_argument('--version', action='version', version='%(prog)s 0.2')
+    parser.add_argument('--version', action='version', version='%(prog)s 0.3')
 
     meta_parser = argparse.ArgumentParser(add_help=False)
+    providers = environment.get('DEFAULT', 'providers').split(',')
     meta_parser.add_argument('provider', choices=providers, help='provider')
-    meta_parser.add_argument('cluster_id', help='prefix for cluster VM names')
+
+    if environment.get('DEFAULT', 'validate_cluster_ids').lower() in ("yes", "true", "1"):
+        meta_parser.add_argument('cluster_id', choices=environment.get('DEFAULT', 'cluster_ids').split(','),
+                                 help='prefix for cluster VM names')
+    else:
+        meta_parser.add_argument('cluster_id', help='prefix for cluster VM names')
+
     meta_parser.add_argument('-t', '--deployment-type',
                              choices=['origin', 'online', 'enterprise'],
                              help='Deployment type. (default: origin)')
-- 
cgit v1.2.3


From 73a3673b55e84c255fc13a350a7a6989e6df4bf3 Mon Sep 17 00:00:00 2001
From: Jhon Honce <jhonce@redhat.com>
Date: Thu, 4 Jun 2015 09:15:44 -0700
Subject: * Update defaults and examples to track core concepts guide

---
 bin/cluster | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'bin')

diff --git a/bin/cluster b/bin/cluster
index 0a6ee7ec4..bf8198de9 100755
--- a/bin/cluster
+++ b/bin/cluster
@@ -188,12 +188,12 @@ if __name__ == '__main__':
     Reads ~/.openshift-ansible for default configuration items
       [DEFAULT]
       validate_cluster_ids = False
-      cluster_ids = production,stage,integration
+      cluster_ids = marketing,sales
       providers = gce,aws,libvirt
     """
 
     environment = ConfigParser.SafeConfigParser({
-        'cluster_ids': 'prod,stg,int',
+        'cluster_ids': 'marketing,sales',
         'validate_cluster_ids': 'False',
         'providers': 'gce,aws,libvirt',
     })
-- 
cgit v1.2.3


From 901f0ee491efb34f9788e11dd6d572928146da91 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?L=C3=A9na=C3=AFc=20Huard?= <lhuard@amadeus.com>
Date: Mon, 20 Apr 2015 14:11:48 +0200
Subject: Implement OpenStack provider

---
 bin/cluster | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

(limited to 'bin')

diff --git a/bin/cluster b/bin/cluster
index bf8198de9..2ea389523 100755
--- a/bin/cluster
+++ b/bin/cluster
@@ -143,6 +143,8 @@ class Cluster(object):
             inventory = '-i inventory/aws/hosts'
         elif 'libvirt' == provider:
             inventory = '-i inventory/libvirt/hosts'
+        elif 'openstack' == provider:
+            inventory = '-i inventory/openstack/hosts'
         else:
             # this code should never be reached
             raise ValueError("invalid PROVIDER {}".format(provider))
@@ -163,6 +165,11 @@ class Cluster(object):
         if args.verbose > 0:
             verbose = '-{}'.format('v' * args.verbose)
 
+        if args.option:
+            for opt in args.option:
+                k, v = opt.split('=', 1)
+                env['opt_'+k] = v
+
         ansible_env = '-e \'{}\''.format(
             ' '.join(['%s=%s' % (key, value) for (key, value) in env.items()])
         )
@@ -189,13 +196,13 @@ if __name__ == '__main__':
       [DEFAULT]
       validate_cluster_ids = False
       cluster_ids = marketing,sales
-      providers = gce,aws,libvirt
+      providers = gce,aws,libvirt,openstack
     """
 
     environment = ConfigParser.SafeConfigParser({
         'cluster_ids': 'marketing,sales',
         'validate_cluster_ids': 'False',
-        'providers': 'gce,aws,libvirt',
+        'providers': 'gce,aws,libvirt,openstack',
     })
 
     path = os.path.expanduser("~/.openshift-ansible")
@@ -224,6 +231,8 @@ if __name__ == '__main__':
     meta_parser.add_argument('-t', '--deployment-type',
                              choices=['origin', 'online', 'enterprise'],
                              help='Deployment type. (default: origin)')
+    meta_parser.add_argument('-o', '--option', action='append',
+                             help='options')
 
     action_parser = parser.add_subparsers(dest='action', title='actions',
                                           description='Choose from valid actions')
-- 
cgit v1.2.3


From 9854943f315c6527ea7a1c5d82e662e666ecbef0 Mon Sep 17 00:00:00 2001
From: Kenny Woodson <kwoodson@redhat.com>
Date: Tue, 9 Jun 2015 14:07:55 -0400
Subject: Automatic commit of package [openshift-ansible-bin] release
 [0.0.18-1].

---
 bin/openshift-ansible-bin.spec | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

(limited to 'bin')

diff --git a/bin/openshift-ansible-bin.spec b/bin/openshift-ansible-bin.spec
index 884d4eb0a..fd2386c9a 100644
--- a/bin/openshift-ansible-bin.spec
+++ b/bin/openshift-ansible-bin.spec
@@ -1,6 +1,6 @@
 Summary:       OpenShift Ansible Scripts for working with metadata hosts
 Name:          openshift-ansible-bin
-Version:       0.0.17
+Version:       0.0.18
 Release:       1%{?dist}
 License:       ASL 2.0
 URL:           https://github.com/openshift/openshift-ansible
@@ -42,6 +42,13 @@ cp -p openshift_ansible.conf.example %{buildroot}/etc/openshift_ansible/openshif
 %config(noreplace) /etc/openshift_ansible/
 
 %changelog
+* Tue Jun 09 2015 Kenny Woodson <kwoodson@redhat.com> 0.0.18-1
+- Implement OpenStack provider (lhuard@amadeus.com)
+- * Update defaults and examples to track core concepts guide
+  (jhonce@redhat.com)
+- Issue 119 - Add support for ~/.openshift-ansible (jhonce@redhat.com)
+- Infrastructure - Add service action to bin/cluster (jhonce@redhat.com)
+
 * Fri May 15 2015 Thomas Wiest <twiest@redhat.com> 0.0.17-1
 - fixed the openshift-ansible-bin build (twiest@redhat.com)
 
-- 
cgit v1.2.3