瀏覽代碼

Relocate filter plugins to lib_utils

This commit relocates filter_plugings to lib_utils,
changes the namespacing to prevent unintended use of
older versions that may be present in filter_plugins/
directory on existing installs.

Add lib_utils to meta depends for roles

Also consolidate some plugins into lib_utils from
various other areas.

Update rpm spec, obsolete plugin rpms.
Michael Gugino 7 年之前
父節點
當前提交
801779eeb6
共有 100 個文件被更改,包括 203 次插入768 次删除
  1. 0 4
      ansible.cfg
  2. 0 69
      filter_plugins/openshift_version.py
  3. 0 1
      lookup_plugins/README.md
  4. 3 86
      openshift-ansible.spec
  5. 0 1
      playbooks/aws/openshift-cluster/filter_plugins
  6. 0 1
      playbooks/aws/openshift-cluster/lookup_plugins
  7. 0 1
      playbooks/byo/filter_plugins
  8. 0 1
      playbooks/byo/lookup_plugins
  9. 0 1
      playbooks/byo/openshift-cluster/filter_plugins
  10. 0 1
      playbooks/byo/openshift-cluster/lookup_plugins
  11. 0 1
      playbooks/common/openshift-cluster/filter_plugins
  12. 0 1
      playbooks/common/openshift-cluster/library
  13. 0 1
      playbooks/common/openshift-cluster/lookup_plugins
  14. 0 1
      playbooks/common/openshift-cluster/upgrades/filter_plugins
  15. 0 1
      playbooks/common/openshift-cluster/upgrades/lookup_plugins
  16. 2 2
      playbooks/common/openshift-cluster/upgrades/post_control_plane.yml
  17. 2 2
      playbooks/common/openshift-cluster/upgrades/pre/config.yml
  18. 4 4
      playbooks/common/openshift-cluster/upgrades/upgrade_control_plane.yml
  19. 0 1
      playbooks/common/openshift-cluster/upgrades/v3_6/filter_plugins
  20. 0 1
      playbooks/common/openshift-cluster/upgrades/v3_7/filter_plugins
  21. 0 1
      playbooks/common/openshift-cluster/upgrades/v3_8/filter_plugins
  22. 0 1
      playbooks/common/openshift-cluster/upgrades/v3_9/filter_plugins
  23. 2 2
      playbooks/init/facts.yml
  24. 0 1
      playbooks/openshift-etcd/private/filter_plugins
  25. 0 1
      playbooks/openshift-etcd/private/lookup_plugins
  26. 4 4
      playbooks/openshift-etcd/private/migrate.yml
  27. 12 12
      playbooks/openshift-etcd/private/redeploy-ca.yml
  28. 2 2
      playbooks/openshift-etcd/private/scaleup.yml
  29. 2 2
      playbooks/openshift-etcd/private/upgrade_backup.yml
  30. 1 1
      playbooks/openshift-etcd/redeploy-certificates.yml
  31. 0 1
      playbooks/openshift-glusterfs/private/filter_plugins
  32. 0 1
      playbooks/openshift-glusterfs/private/lookup_plugins
  33. 3 3
      playbooks/openshift-hosted/private/redeploy-registry-certificates.yml
  34. 3 3
      playbooks/openshift-hosted/private/redeploy-router-certificates.yml
  35. 2 2
      playbooks/openshift-loadbalancer/private/config.yml
  36. 0 1
      playbooks/openshift-loadbalancer/private/filter_plugins
  37. 0 1
      playbooks/openshift-loadbalancer/private/lookup_plugins
  38. 0 1
      playbooks/openshift-logging/private/filter_plugins
  39. 0 1
      playbooks/openshift-logging/private/library
  40. 0 1
      playbooks/openshift-logging/private/lookup_plugins
  41. 0 1
      playbooks/openshift-management/private/filter_plugins
  42. 0 1
      playbooks/openshift-management/private/library
  43. 2 2
      playbooks/openshift-master/private/certificates.yml
  44. 8 8
      playbooks/openshift-master/private/config.yml
  45. 0 1
      playbooks/openshift-master/private/filter_plugins
  46. 0 1
      playbooks/openshift-master/private/library
  47. 0 1
      playbooks/openshift-master/private/lookup_plugins
  48. 24 24
      playbooks/openshift-master/private/redeploy-openshift-ca.yml
  49. 0 1
      playbooks/openshift-metrics/private/library
  50. 0 1
      playbooks/openshift-nfs/private/filter_plugins
  51. 0 1
      playbooks/openshift-nfs/private/lookup_plugins
  52. 2 2
      playbooks/openshift-node/private/configure_nodes.yml
  53. 2 2
      playbooks/openshift-node/private/containerized_nodes.yml
  54. 0 1
      playbooks/openshift-node/private/filter_plugins
  55. 0 1
      playbooks/openshift-node/private/lookup_plugins
  56. 1 1
      playbooks/redeploy-certificates.yml
  57. 1 0
      roles/ansible_service_broker/meta/main.yml
  58. 1 0
      roles/calico/meta/main.yml
  59. 1 0
      roles/calico_master/meta/main.yml
  60. 1 0
      roles/cockpit-ui/meta/main.yml
  61. 1 1
      roles/cockpit/meta/main.yml
  62. 1 1
      roles/container_runtime/defaults/main.yml
  63. 0 1
      roles/container_runtime/meta/main.yml
  64. 2 2
      roles/container_runtime/tasks/package_docker.yml
  65. 1 0
      roles/contiv/meta/main.yml
  66. 0 1
      roles/etcd/meta/main.yml
  67. 1 1
      roles/etcd/tasks/certificates/fetch_client_certificates_from_ca.yml
  68. 1 1
      roles/etcd/tasks/certificates/fetch_server_certificates_from_ca.yml
  69. 2 1
      roles/flannel/meta/main.yml
  70. 2 1
      roles/flannel_register/meta/main.yml
  71. 3 2
      roles/kuryr/meta/main.yml
  72. 0 63
      roles/lib_os_firewall/README.md
  73. 0 0
      roles/lib_utils/callback_plugins/aa_version_requirement.py
  74. 0 0
      roles/lib_utils/callback_plugins/openshift_quick_installer.py
  75. 73 404
      filter_plugins/oo_filters.py
  76. 0 0
      roles/lib_utils/library/kubeclient_ca.py
  77. 0 0
      library/modify_yaml.py
  78. 0 0
      roles/lib_os_firewall/library/os_firewall_manage_iptables.py
  79. 0 0
      roles/lib_utils/library/rpm_q.py
  80. 1 1
      roles/nuage_ca/meta/main.yml
  81. 1 1
      roles/nuage_master/meta/main.yml
  82. 1 1
      roles/nuage_node/meta/main.yml
  83. 1 0
      roles/openshift_builddefaults/meta/main.yml
  84. 1 0
      roles/openshift_buildoverrides/meta/main.yml
  85. 1 0
      roles/openshift_ca/meta/main.yml
  86. 6 6
      roles/openshift_ca/tasks/main.yml
  87. 2 1
      roles/openshift_certificate_expiry/meta/main.yml
  88. 1 0
      roles/openshift_cli/meta/main.yml
  89. 1 0
      roles/openshift_cloud_provider/meta/main.yml
  90. 1 0
      roles/openshift_cluster_autoscaler/meta/main.yml
  91. 1 0
      roles/openshift_default_storage_class/meta/main.yml
  92. 1 0
      roles/openshift_docker_gc/meta/main.yml
  93. 1 0
      roles/openshift_etcd/meta/main.yml
  94. 2 1
      roles/openshift_etcd_client_certificates/meta/main.yml
  95. 1 0
      roles/openshift_etcd_facts/meta/main.yml
  96. 2 1
      roles/openshift_examples/meta/main.yml
  97. 4 4
      roles/openshift_excluder/tasks/install.yml
  98. 1 0
      roles/openshift_health_checker/meta/main.yml
  99. 1 1
      roles/openshift_hosted/meta/main.yml
  100. 0 0
      roles/openshift_hosted/tasks/router.yml

+ 0 - 4
ansible.cfg

@@ -10,10 +10,6 @@
 #log_path = /tmp/ansible.log
 
 # Additional default options for OpenShift Ansible
-callback_plugins = callback_plugins/
-filter_plugins = filter_plugins/
-lookup_plugins = lookup_plugins/
-library = library/
 forks = 20
 host_key_checking = False
 retry_files_enabled = False

+ 0 - 69
filter_plugins/openshift_version.py

@@ -1,69 +0,0 @@
-#!/usr/bin/python
-# -*- coding: utf-8 -*-
-"""
-Custom version comparison filters for use in openshift-ansible
-"""
-
-# pylint can't locate distutils.version within virtualenv
-# https://github.com/PyCQA/pylint/issues/73
-# pylint: disable=no-name-in-module, import-error
-from distutils.version import LooseVersion
-
-
-def gte_function_builder(name, gte_version):
-    """
-    Build and return a version comparison function.
-
-    Ex: name = 'oo_version_gte_3_6'
-        version = '3.6'
-
-        returns oo_version_gte_3_6, a function which based on the
-        version will return true if the provided version is greater
-        than or equal to the function's version
-    """
-    def _gte_function(version):
-        """
-        Dynamic function created by gte_function_builder.
-
-        Ex: version = '3.1'
-            returns True/False
-        """
-        version_gte = False
-        if str(version) >= LooseVersion(gte_version):
-            version_gte = True
-        return version_gte
-    _gte_function.__name__ = name
-    return _gte_function
-
-
-# pylint: disable=too-few-public-methods
-class FilterModule(object):
-    """
-    Filters for version checking.
-    """
-    # Each element of versions is composed of (major, minor_start, minor_end)
-    # Origin began versioning 3.x with 3.6, so begin 3.x with 3.6.
-    versions = [(3, 6, 10)]
-
-    def __init__(self):
-        """
-        Creates a new FilterModule for ose version checking.
-        """
-        self._filters = {}
-
-        # For each set of (major, minor, minor_iterations)
-        for major, minor_start, minor_end in self.versions:
-            # For each minor version in the range
-            for minor in range(minor_start, minor_end):
-                # Create the function name
-                func_name = 'oo_version_gte_{}_{}'.format(major, minor)
-                # Create the function with the builder
-                func = gte_function_builder(func_name, "{}.{}.0".format(major, minor))
-                # Add the function to the mapping
-                self._filters[func_name] = func
-
-    def filters(self):
-        """
-        Return the filters mapping.
-        """
-        return self._filters

+ 0 - 1
lookup_plugins/README.md

@@ -1 +0,0 @@
-openshift-ansible lookup plugins.

+ 3 - 86
openshift-ansible.spec

@@ -24,9 +24,6 @@ Requires:      tar
 Requires:      %{name}-docs = %{version}-%{release}
 Requires:      %{name}-playbooks = %{version}-%{release}
 Requires:      %{name}-roles = %{version}-%{release}
-Requires:      %{name}-filter-plugins = %{version}-%{release}
-Requires:      %{name}-lookup-plugins = %{version}-%{release}
-Requires:      %{name}-callback-plugins = %{version}-%{release}
 Requires:      java-1.8.0-openjdk-headless
 Requires:      httpd-tools
 Requires:      libselinux-python
@@ -52,8 +49,6 @@ popd
 # Base openshift-ansible install
 mkdir -p %{buildroot}%{_datadir}/%{name}
 mkdir -p %{buildroot}%{_datadir}/ansible/%{name}
-mkdir -p %{buildroot}%{_datadir}/ansible_plugins
-cp -rp library %{buildroot}%{_datadir}/ansible/%{name}/
 
 # openshift-ansible-bin install
 mkdir -p %{buildroot}%{_bindir}
@@ -88,31 +83,6 @@ rm -rf %{buildroot}%{_datadir}/ansible/%{name}/roles/contiv/*
 # touch a file in contiv so that it can be added to SCM's
 touch %{buildroot}%{_datadir}/ansible/%{name}/roles/contiv/.empty_dir
 
-# openshift_master_facts symlinks filter_plugins/oo_filters.py from ansible_plugins/filter_plugins
-pushd %{buildroot}%{_datadir}/ansible/%{name}/roles/openshift_master_facts/filter_plugins
-ln -sf ../../../../../ansible_plugins/filter_plugins/oo_filters.py oo_filters.py
-popd
-
-# openshift-ansible-filter-plugins install
-cp -rp filter_plugins %{buildroot}%{_datadir}/ansible_plugins/
-
-# openshift-ansible-lookup-plugins install
-cp -rp lookup_plugins %{buildroot}%{_datadir}/ansible_plugins/
-
-# openshift-ansible-callback-plugins install
-cp -rp callback_plugins %{buildroot}%{_datadir}/ansible_plugins/
-
-# create symlinks from /usr/share/ansible/plugins/lookup ->
-# /usr/share/ansible_plugins/lookup_plugins
-pushd %{buildroot}%{_datadir}
-mkdir -p ansible/plugins
-pushd ansible/plugins
-ln -s ../../ansible_plugins/lookup_plugins lookup
-ln -s ../../ansible_plugins/filter_plugins filter
-ln -s ../../ansible_plugins/callback_plugins callback
-popd
-popd
-
 # atomic-openshift-utils install
 pushd utils
 %{__python} setup.py install --skip-build --root %{buildroot}
@@ -131,7 +101,6 @@ popd
 %license LICENSE
 %dir %{_datadir}/ansible/%{name}
 %{_datadir}/ansible/%{name}/files
-%{_datadir}/ansible/%{name}/library
 %ghost %{_datadir}/ansible/%{name}/playbooks/common/openshift-master/library.rpmmoved
 
 # ----------------------------------------------------------------------------------
@@ -155,9 +124,6 @@ BuildArch:     noarch
 Summary:       Openshift and Atomic Enterprise Ansible Playbooks
 Requires:      %{name} = %{version}-%{release}
 Requires:      %{name}-roles = %{version}-%{release}
-Requires:      %{name}-lookup-plugins = %{version}-%{release}
-Requires:      %{name}-filter-plugins = %{version}-%{release}
-Requires:      %{name}-callback-plugins = %{version}-%{release}
 BuildArch:     noarch
 
 %description playbooks
@@ -198,9 +164,9 @@ end
 # ----------------------------------------------------------------------------------
 Summary:       Openshift and Atomic Enterprise Ansible roles
 Requires:      %{name} = %{version}-%{release}
-Requires:      %{name}-lookup-plugins = %{version}-%{release}
-Requires:      %{name}-filter-plugins = %{version}-%{release}
-Requires:      %{name}-callback-plugins = %{version}-%{release}
+Obsoletes:      %{name}-lookup-plugins
+Obsoletes:      %{name}-filter-plugins
+Obsoletes:      %{name}-callback-plugins
 BuildArch:     noarch
 
 %description roles
@@ -209,55 +175,6 @@ BuildArch:     noarch
 %files roles
 %{_datadir}/ansible/%{name}/roles
 
-
-# ----------------------------------------------------------------------------------
-# openshift-ansible-filter-plugins subpackage
-# ----------------------------------------------------------------------------------
-%package filter-plugins
-Summary:       Openshift and Atomic Enterprise Ansible filter plugins
-Requires:      %{name} = %{version}-%{release}
-BuildArch:     noarch
-Requires:      pyOpenSSL
-
-%description filter-plugins
-%{summary}.
-
-%files filter-plugins
-%{_datadir}/ansible_plugins/filter_plugins
-%{_datadir}/ansible/plugins/filter
-
-
-# ----------------------------------------------------------------------------------
-# openshift-ansible-lookup-plugins subpackage
-# ----------------------------------------------------------------------------------
-%package lookup-plugins
-Summary:       Openshift and Atomic Enterprise Ansible lookup plugins
-Requires:      %{name} = %{version}-%{release}
-BuildArch:     noarch
-
-%description lookup-plugins
-%{summary}.
-
-%files lookup-plugins
-%{_datadir}/ansible_plugins/lookup_plugins
-%{_datadir}/ansible/plugins/lookup
-
-
-# ----------------------------------------------------------------------------------
-# openshift-ansible-callback-plugins subpackage
-# ----------------------------------------------------------------------------------
-%package callback-plugins
-Summary:       Openshift and Atomic Enterprise Ansible callback plugins
-Requires:      %{name} = %{version}-%{release}
-BuildArch:     noarch
-
-%description callback-plugins
-%{summary}.
-
-%files callback-plugins
-%{_datadir}/ansible_plugins/callback_plugins
-%{_datadir}/ansible/plugins/callback
-
 # ----------------------------------------------------------------------------------
 # atomic-openshift-utils subpackage
 # ----------------------------------------------------------------------------------

+ 0 - 1
playbooks/aws/openshift-cluster/filter_plugins

@@ -1 +0,0 @@
-../../../filter_plugins

+ 0 - 1
playbooks/aws/openshift-cluster/lookup_plugins

@@ -1 +0,0 @@
-../../../lookup_plugins

+ 0 - 1
playbooks/byo/filter_plugins

@@ -1 +0,0 @@
-../../filter_plugins

+ 0 - 1
playbooks/byo/lookup_plugins

@@ -1 +0,0 @@
-../../lookup_plugins

+ 0 - 1
playbooks/byo/openshift-cluster/filter_plugins

@@ -1 +0,0 @@
-../../../filter_plugins

+ 0 - 1
playbooks/byo/openshift-cluster/lookup_plugins

@@ -1 +0,0 @@
-../../../lookup_plugins

+ 0 - 1
playbooks/common/openshift-cluster/filter_plugins

@@ -1 +0,0 @@
-../../../filter_plugins

+ 0 - 1
playbooks/common/openshift-cluster/library

@@ -1 +0,0 @@
-../../../library/

+ 0 - 1
playbooks/common/openshift-cluster/lookup_plugins

@@ -1 +0,0 @@
-../../../lookup_plugins

+ 0 - 1
playbooks/common/openshift-cluster/upgrades/filter_plugins

@@ -1 +0,0 @@
-../../../../filter_plugins

+ 0 - 1
playbooks/common/openshift-cluster/upgrades/lookup_plugins

@@ -1 +0,0 @@
-../../../../lookup_plugins

+ 2 - 2
playbooks/common/openshift-cluster/upgrades/post_control_plane.yml

@@ -27,8 +27,8 @@
 
   - set_fact:
       haproxy_routers: "{{ all_routers.results.results[0]['items'] |
-                           oo_pods_match_component(openshift_deployment_type, 'haproxy-router') |
-                           oo_select_keys_from_list(['metadata']) }}"
+                           lib_utils_oo_pods_match_component(openshift_deployment_type, 'haproxy-router') |
+                           lib_utils_oo_select_keys_from_list(['metadata']) }}"
     when:
     - all_routers.results.returncode == 0
 

+ 2 - 2
playbooks/common/openshift-cluster/upgrades/pre/config.yml

@@ -14,10 +14,10 @@
   hosts: "{{ l_upgrade_no_proxy_hosts }}"
   tasks:
   - set_fact:
-      openshift_no_proxy_internal_hostnames: "{{ hostvars | oo_select_keys(groups['oo_nodes_to_config']
+      openshift_no_proxy_internal_hostnames: "{{ hostvars | lib_utils_oo_select_keys(groups['oo_nodes_to_config']
                                                     | union(groups['oo_masters_to_config'])
                                                     | union(groups['oo_etcd_to_config'] | default([])))
-                                                | oo_collect('openshift.common.hostname') | default([]) | join (',')
+                                                | lib_utils_oo_collect('openshift.common.hostname') | default([]) | join (',')
                                                 }}"
     when:
     - openshift_http_proxy is defined or openshift_https_proxy is defined

+ 4 - 4
playbooks/common/openshift-cluster/upgrades/upgrade_control_plane.yml

@@ -112,8 +112,8 @@
   tasks:
   - set_fact:
       master_update_completed: "{{ hostvars
-                                 | oo_select_keys(groups.oo_masters_to_config)
-                                 | oo_collect('inventory_hostname', {'master_update_complete': true}) }}"
+                                 | lib_utils_oo_select_keys(groups.oo_masters_to_config)
+                                 | lib_utils_oo_collect('inventory_hostname', {'master_update_complete': true}) }}"
   - set_fact:
       master_update_failed: "{{ groups.oo_masters_to_config | difference(master_update_completed) | list }}"
   - fail:
@@ -246,8 +246,8 @@
   tasks:
   - set_fact:
       reconcile_completed: "{{ hostvars
-                                 | oo_select_keys(groups.oo_masters_to_config)
-                                 | oo_collect('inventory_hostname', {'reconcile_complete': true}) }}"
+                                 | lib_utils_oo_select_keys(groups.oo_masters_to_config)
+                                 | lib_utils_oo_collect('inventory_hostname', {'reconcile_complete': true}) }}"
   - set_fact:
       reconcile_failed: "{{ groups.oo_masters_to_config | difference(reconcile_completed) | list }}"
   - fail:

+ 0 - 1
playbooks/common/openshift-cluster/upgrades/v3_6/filter_plugins

@@ -1 +0,0 @@
-../../../../../filter_plugins/

+ 0 - 1
playbooks/common/openshift-cluster/upgrades/v3_7/filter_plugins

@@ -1 +0,0 @@
-../../../../../filter_plugins/

+ 0 - 1
playbooks/common/openshift-cluster/upgrades/v3_8/filter_plugins

@@ -1 +0,0 @@
-../../../../../filter_plugins/

+ 0 - 1
playbooks/common/openshift-cluster/upgrades/v3_9/filter_plugins

@@ -1 +0,0 @@
-../../../../../filter_plugins/

+ 2 - 2
playbooks/init/facts.yml

@@ -126,10 +126,10 @@
     openshift_facts:
       role: common
       local_facts:
-        no_proxy_internal_hostnames: "{{ hostvars | oo_select_keys(groups['oo_nodes_to_config']
+        no_proxy_internal_hostnames: "{{ hostvars | lib_utils_oo_select_keys(groups['oo_nodes_to_config']
                                              | union(groups['oo_masters_to_config'])
                                              | union(groups['oo_etcd_to_config'] | default([])))
-                                         | oo_collect('openshift.common.hostname') | default([]) | join (',')
+                                         | lib_utils_oo_collect('openshift.common.hostname') | default([]) | join (',')
                                          }}"
     when:
     - openshift_http_proxy is defined or openshift_https_proxy is defined

+ 0 - 1
playbooks/openshift-etcd/private/filter_plugins

@@ -1 +0,0 @@
-../../../filter_plugins

+ 0 - 1
playbooks/openshift-etcd/private/lookup_plugins

@@ -1 +0,0 @@
-../../../lookup_plugins

+ 4 - 4
playbooks/openshift-etcd/private/migrate.yml

@@ -57,8 +57,8 @@
   tasks:
   - set_fact:
       etcd_backup_completed: "{{ hostvars
-                                 | oo_select_keys(groups.oo_etcd_to_migrate)
-                                 | oo_collect('inventory_hostname', {'r_etcd_common_backup_complete': true}) }}"
+                                 | lib_utils_oo_select_keys(groups.oo_etcd_to_migrate)
+                                 | lib_utils_oo_collect('inventory_hostname', {'r_etcd_common_backup_complete': true}) }}"
   - set_fact:
       etcd_backup_failed: "{{ groups.oo_etcd_to_migrate | difference(etcd_backup_completed) | list }}"
   - fail:
@@ -118,8 +118,8 @@
   tasks:
   - set_fact:
       etcd_migration_completed: "{{ hostvars
-                                 | oo_select_keys(groups.oo_etcd_to_migrate)
-                                 | oo_collect('inventory_hostname', {'r_etcd_migrate_success': true}) }}"
+                                 | lib_utils_oo_select_keys(groups.oo_etcd_to_migrate)
+                                 | lib_utils_oo_collect('inventory_hostname', {'r_etcd_migrate_success': true}) }}"
   - set_fact:
       etcd_migration_failed: "{{ groups.oo_etcd_to_migrate | difference(etcd_migration_completed) | list }}"
 

+ 12 - 12
playbooks/openshift-etcd/private/redeploy-ca.yml

@@ -47,9 +47,9 @@
 - import_playbook: restart.yml
   # Do not restart etcd when etcd certificates were previously expired.
   when: ('expired' not in (hostvars
-                           | oo_select_keys(groups['etcd'])
-                           | oo_collect('check_results.check_results.etcd')
-                           | oo_collect('health')))
+                           | lib_utils_oo_select_keys(groups['etcd'])
+                           | lib_utils_oo_collect('check_results.check_results.etcd')
+                           | lib_utils_oo_collect('health')))
 
 - name: Retrieve etcd CA certificate
   hosts: oo_first_etcd
@@ -87,15 +87,15 @@
   when:
   # masters
   - ('expired' not in hostvars
-      | oo_select_keys(groups['oo_masters_to_config'])
-      | oo_collect('check_results.check_results.ocp_certs')
-      | oo_collect('health', {'path':hostvars[groups.oo_first_master.0].openshift.common.config_base ~ "/master/master.server.crt"}))
+      | lib_utils_oo_select_keys(groups['oo_masters_to_config'])
+      | lib_utils_oo_collect('check_results.check_results.ocp_certs')
+      | lib_utils_oo_collect('health', {'path':hostvars[groups.oo_first_master.0].openshift.common.config_base ~ "/master/master.server.crt"}))
   - ('expired' not in hostvars
-      | oo_select_keys(groups['oo_masters_to_config'])
-      | oo_collect('check_results.check_results.ocp_certs')
-      | oo_collect('health', {'path':hostvars[groups.oo_first_master.0].openshift.common.config_base ~ "/master/ca-bundle.crt"}))
+      | lib_utils_oo_select_keys(groups['oo_masters_to_config'])
+      | lib_utils_oo_collect('check_results.check_results.ocp_certs')
+      | lib_utils_oo_collect('health', {'path':hostvars[groups.oo_first_master.0].openshift.common.config_base ~ "/master/ca-bundle.crt"}))
   # etcd
   - ('expired' not in (hostvars
-      | oo_select_keys(groups['etcd'])
-      | oo_collect('check_results.check_results.etcd')
-      | oo_collect('health')))
+      | lib_utils_oo_select_keys(groups['etcd'])
+      | lib_utils_oo_collect('check_results.check_results.etcd')
+      | lib_utils_oo_collect('health')))

+ 2 - 2
playbooks/openshift-etcd/private/scaleup.yml

@@ -69,8 +69,8 @@
     etcd_ca_host: "{{ groups.oo_etcd_to_config.0 }}"
     openshift_ca_host: "{{ groups.oo_first_master.0 }}"
     openshift_master_etcd_hosts: "{{ hostvars
-                                     | oo_select_keys(groups['oo_etcd_to_config'] | union(groups['oo_new_etcd_to_config'] | default([]) ))
-                                     | oo_collect('openshift.common.hostname')
+                                     | lib_utils_oo_select_keys(groups['oo_etcd_to_config'] | union(groups['oo_new_etcd_to_config'] | default([]) ))
+                                     | lib_utils_oo_collect('openshift.common.hostname')
                                      | default(none, true) }}"
     openshift_master_etcd_port: "{{ (etcd_client_port | default('2379')) if (groups.oo_etcd_to_config is defined and groups.oo_etcd_to_config) else none }}"
   roles:

+ 2 - 2
playbooks/openshift-etcd/private/upgrade_backup.yml

@@ -18,8 +18,8 @@
   tasks:
   - set_fact:
       etcd_backup_completed: "{{ hostvars
-                                 | oo_select_keys(groups.oo_etcd_hosts_to_backup)
-                                 | oo_collect('inventory_hostname', {'r_etcd_common_backup_complete': true}) }}"
+                                 | lib_utils_oo_select_keys(groups.oo_etcd_hosts_to_backup)
+                                 | lib_utils_oo_collect('inventory_hostname', {'r_etcd_common_backup_complete': true}) }}"
   - set_fact:
       etcd_backup_failed: "{{ groups.oo_etcd_hosts_to_backup | difference(etcd_backup_completed) | list }}"
   - fail:

+ 1 - 1
playbooks/openshift-etcd/redeploy-certificates.yml

@@ -5,6 +5,6 @@
 
 - import_playbook: private/restart.yml
   vars:
-    g_etcd_certificates_expired: "{{ ('expired' in (hostvars | oo_select_keys(groups['etcd']) | oo_collect('check_results.check_results.etcd') | oo_collect('health'))) | bool }}"
+    g_etcd_certificates_expired: "{{ ('expired' in (hostvars | lib_utils_oo_select_keys(groups['etcd']) | lib_utils_oo_collect('check_results.check_results.etcd') | lib_utils_oo_collect('health'))) | bool }}"
 
 - import_playbook: ../openshift-master/private/restart.yml

+ 0 - 1
playbooks/openshift-glusterfs/private/filter_plugins

@@ -1 +0,0 @@
-../../../filter_plugins

+ 0 - 1
playbooks/openshift-glusterfs/private/lookup_plugins

@@ -1 +0,0 @@
-../../../lookup_plugins

+ 3 - 3
playbooks/openshift-hosted/private/redeploy-registry-certificates.yml

@@ -26,11 +26,11 @@
 
   - set_fact:
       docker_registry_env_vars: "{{ ((l_docker_registry_dc.stdout | from_json)['spec']['template']['spec']['containers'][0]['env']
-                                      | oo_collect('name'))
+                                      | lib_utils_oo_collect('name'))
                                       | default([]) }}"
       docker_registry_secrets: "{{ ((l_docker_registry_dc.stdout | from_json)['spec']['template']['spec']['volumes']
-                                     | oo_collect('secret')
-                                     | oo_collect('secretName'))
+                                     | lib_utils_oo_collect('secret')
+                                     | lib_utils_oo_collect('secretName'))
                                      | default([]) }}"
     changed_when: false
     when: l_docker_registry_dc.rc == 0

+ 3 - 3
playbooks/openshift-hosted/private/redeploy-router-certificates.yml

@@ -36,11 +36,11 @@
   - name: Collect router environment variables and secrets
     set_fact:
       router_env_vars: "{{ ((l_router_dc.stdout | from_json)['spec']['template']['spec']['containers'][0]['env']
-                             | oo_collect('name'))
+                             | lib_utils_oo_collect('name'))
                              | default([]) }}"
       router_secrets: "{{ ((l_router_dc.stdout | from_json)['spec']['template']['spec']['volumes']
-                            | oo_collect('secret')
-                            | oo_collect('secretName'))
+                            | lib_utils_oo_collect('secret')
+                            | lib_utils_oo_collect('secretName'))
                             | default([]) }}"
     changed_when: false
     when: l_router_dc.rc == 0

+ 2 - 2
playbooks/openshift-loadbalancer/private/config.yml

@@ -15,12 +15,12 @@
   hosts: oo_lb_to_config
   vars:
     openshift_loadbalancer_frontends: "{{ (openshift_master_api_port | default(8443)
-                                           | oo_openshift_loadbalancer_frontends(hostvars | oo_select_keys(groups['oo_masters']),
+                                           | lib_utils_oo_loadbalancer_frontends(hostvars | lib_utils_oo_select_keys(groups['oo_masters']),
                                                                                  openshift_use_nuage | default(false),
                                                                                  nuage_mon_rest_server_port | default(none)))
                                            + openshift_loadbalancer_additional_frontends | default([]) }}"
     openshift_loadbalancer_backends: "{{ (openshift_master_api_port | default(8443)
-                                          | oo_openshift_loadbalancer_backends(hostvars | oo_select_keys(groups['oo_masters']),
+                                          | lib_utils_oo_loadbalancer_backends(hostvars | lib_utils_oo_select_keys(groups['oo_masters']),
                                                                                openshift_use_nuage | default(false),
                                                                                nuage_mon_rest_server_port | default(none)))
                                           + openshift_loadbalancer_additional_backends | default([]) }}"

+ 0 - 1
playbooks/openshift-loadbalancer/private/filter_plugins

@@ -1 +0,0 @@
-../../../filter_plugins

+ 0 - 1
playbooks/openshift-loadbalancer/private/lookup_plugins

@@ -1 +0,0 @@
-../../../lookup_plugins

+ 0 - 1
playbooks/openshift-logging/private/filter_plugins

@@ -1 +0,0 @@
-../../../filter_plugins

+ 0 - 1
playbooks/openshift-logging/private/library

@@ -1 +0,0 @@
-../../../library

+ 0 - 1
playbooks/openshift-logging/private/lookup_plugins

@@ -1 +0,0 @@
-../../../lookup_plugins

+ 0 - 1
playbooks/openshift-management/private/filter_plugins

@@ -1 +0,0 @@
-../../../filter_plugins

+ 0 - 1
playbooks/openshift-management/private/library

@@ -1 +0,0 @@
-../../../library

+ 2 - 2
playbooks/openshift-master/private/certificates.yml

@@ -9,6 +9,6 @@
   - role: openshift_ca
   - role: openshift_master_certificates
     openshift_master_etcd_hosts: "{{ hostvars
-                                     | oo_select_keys(groups['oo_etcd_to_config'] | default([]))
-                                     | oo_collect('openshift.common.hostname')
+                                     | lib_utils_oo_select_keys(groups['oo_etcd_to_config'] | default([]))
+                                     | lib_utils_oo_collect('openshift.common.hostname')
                                      | default(none, true) }}"

+ 8 - 8
playbooks/openshift-master/private/config.yml

@@ -56,9 +56,9 @@
   - set_fact:
       openshift_master_etcd_port: "{{ (etcd_client_port | default('2379')) if (groups.oo_etcd_to_config is defined and groups.oo_etcd_to_config) else none }}"
       openshift_master_etcd_hosts: "{{ hostvars
-                                       | oo_select_keys(groups['oo_etcd_to_config']
+                                       | lib_utils_oo_select_keys(groups['oo_etcd_to_config']
                                                         | default([]))
-                                       | oo_collect('openshift.common.hostname')
+                                       | lib_utils_oo_collect('openshift.common.hostname')
                                        | default(none, true) }}"
   roles:
   - openshift_facts
@@ -150,8 +150,8 @@
   hosts: oo_first_master
   vars:
     g_session_secrets_present: "{{ (openshift.master.session_auth_secrets | default([])) | length > 0 and (openshift.master.session_encryption_secrets | default([])) | length > 0 }}"
-    g_session_auth_secrets: "{{ [ 24 | oo_generate_secret ] }}"
-    g_session_encryption_secrets: "{{ [ 24 | oo_generate_secret ] }}"
+    g_session_auth_secrets: "{{ [ 24 | lib_utils_oo_generate_secret ] }}"
+    g_session_encryption_secrets: "{{ [ 24 | lib_utils_oo_generate_secret ] }}"
   roles:
   - role: openshift_facts
   tasks:
@@ -172,11 +172,11 @@
     openshift_master_session_encryption_secrets: "{{ hostvars[groups.oo_first_master.0].openshift.master.session_encryption_secrets }}"
     openshift_ca_host: "{{ groups.oo_first_master.0 }}"
     openshift_master_etcd_hosts: "{{ hostvars
-                                     | oo_select_keys(groups['oo_etcd_to_config'] | default([]))
-                                     | oo_collect('openshift.common.hostname')
+                                     | lib_utils_oo_select_keys(groups['oo_etcd_to_config'] | default([]))
+                                     | lib_utils_oo_collect('openshift.common.hostname')
                                      | default(none, true) }}"
-    openshift_no_proxy_etcd_host_ips: "{{ hostvars | oo_select_keys(groups['oo_etcd_to_config'] | default([]))
-                                                | oo_collect('openshift.common.ip') | default([]) | join(',')
+    openshift_no_proxy_etcd_host_ips: "{{ hostvars | lib_utils_oo_select_keys(groups['oo_etcd_to_config'] | default([]))
+                                                | lib_utils_oo_collect('openshift.common.ip') | default([]) | join(',')
                                                 }}"
   roles:
   - role: openshift_master_facts

+ 0 - 1
playbooks/openshift-master/private/filter_plugins

@@ -1 +0,0 @@
-../../../filter_plugins

+ 0 - 1
playbooks/openshift-master/private/library

@@ -1 +0,0 @@
-../../../library/

+ 0 - 1
playbooks/openshift-master/private/lookup_plugins

@@ -1 +0,0 @@
-../../../lookup_plugins

+ 24 - 24
playbooks/openshift-master/private/redeploy-openshift-ca.yml

@@ -212,18 +212,18 @@
   when:
   # masters
   - ('expired' not in hostvars
-      | oo_select_keys(groups['oo_masters_to_config'])
-      | oo_collect('check_results.check_results.ocp_certs')
-      | oo_collect('health', {'path':hostvars[groups.oo_first_master.0].openshift.common.config_base ~ "/master/master.server.crt"}))
+      | lib_utils_oo_select_keys(groups['oo_masters_to_config'])
+      | lib_utils_oo_collect('check_results.check_results.ocp_certs')
+      | lib_utils_oo_collect('health', {'path':hostvars[groups.oo_first_master.0].openshift.common.config_base ~ "/master/master.server.crt"}))
   - ('expired' not in hostvars
-      | oo_select_keys(groups['oo_masters_to_config'])
-      | oo_collect('check_results.check_results.ocp_certs')
-      | oo_collect('health', {'path':hostvars[groups.oo_first_master.0].openshift.common.config_base ~ "/master/ca-bundle.crt"}))
+      | lib_utils_oo_select_keys(groups['oo_masters_to_config'])
+      | lib_utils_oo_collect('check_results.check_results.ocp_certs')
+      | lib_utils_oo_collect('health', {'path':hostvars[groups.oo_first_master.0].openshift.common.config_base ~ "/master/ca-bundle.crt"}))
   # etcd
   - ('expired' not in (hostvars
-      | oo_select_keys(groups['etcd'])
-      | oo_collect('check_results.check_results.etcd')
-      | oo_collect('health')))
+      | lib_utils_oo_select_keys(groups['etcd'])
+      | lib_utils_oo_collect('check_results.check_results.etcd')
+      | lib_utils_oo_collect('health')))
 
 - name: Distribute OpenShift CA certificate to nodes
   hosts: oo_nodes_to_config
@@ -277,24 +277,24 @@
   when:
   # nodes
   - ('expired' not in hostvars
-      | oo_select_keys(groups['oo_nodes_to_config'])
-      | oo_collect('check_results.check_results.ocp_certs')
-      | oo_collect('health', {'path':hostvars[groups.oo_nodes_to_config.0].openshift.common.config_base ~ "/node/server.crt"}))
+      | lib_utils_oo_select_keys(groups['oo_nodes_to_config'])
+      | lib_utils_oo_collect('check_results.check_results.ocp_certs')
+      | lib_utils_oo_collect('health', {'path':hostvars[groups.oo_nodes_to_config.0].openshift.common.config_base ~ "/node/server.crt"}))
   - ('expired' not in hostvars
-      | oo_select_keys(groups['oo_nodes_to_config'])
-      | oo_collect('check_results.check_results.ocp_certs')
-      | oo_collect('health', {'path':hostvars[groups.oo_nodes_to_config.0].openshift.common.config_base ~ "/node/ca.crt"}))
+      | lib_utils_oo_select_keys(groups['oo_nodes_to_config'])
+      | lib_utils_oo_collect('check_results.check_results.ocp_certs')
+      | lib_utils_oo_collect('health', {'path':hostvars[groups.oo_nodes_to_config.0].openshift.common.config_base ~ "/node/ca.crt"}))
   # masters
   - ('expired' not in hostvars
-      | oo_select_keys(groups['oo_masters_to_config'])
-      | oo_collect('check_results.check_results.ocp_certs')
-      | oo_collect('health', {'path':hostvars[groups.oo_first_master.0].openshift.common.config_base ~ "/master/master.server.crt"}))
+      | lib_utils_oo_select_keys(groups['oo_masters_to_config'])
+      | lib_utils_oo_collect('check_results.check_results.ocp_certs')
+      | lib_utils_oo_collect('health', {'path':hostvars[groups.oo_first_master.0].openshift.common.config_base ~ "/master/master.server.crt"}))
   - ('expired' not in hostvars
-      | oo_select_keys(groups['oo_masters_to_config'])
-      | oo_collect('check_results.check_results.ocp_certs')
-      | oo_collect('health', {'path':hostvars[groups.oo_first_master.0].openshift.common.config_base ~ "/master/ca-bundle.crt"}))
+      | lib_utils_oo_select_keys(groups['oo_masters_to_config'])
+      | lib_utils_oo_collect('check_results.check_results.ocp_certs')
+      | lib_utils_oo_collect('health', {'path':hostvars[groups.oo_first_master.0].openshift.common.config_base ~ "/master/ca-bundle.crt"}))
   # etcd
   - ('expired' not in (hostvars
-      | oo_select_keys(groups['etcd'])
-      | oo_collect('check_results.check_results.etcd')
-      | oo_collect('health')))
+      | lib_utils_oo_select_keys(groups['etcd'])
+      | lib_utils_oo_collect('check_results.check_results.etcd')
+      | lib_utils_oo_collect('health')))

+ 0 - 1
playbooks/openshift-metrics/private/library

@@ -1 +0,0 @@
-../../../library

+ 0 - 1
playbooks/openshift-nfs/private/filter_plugins

@@ -1 +0,0 @@
-../../../filter_plugins

+ 0 - 1
playbooks/openshift-nfs/private/lookup_plugins

@@ -1 +0,0 @@
-../../../lookup_plugins

+ 2 - 2
playbooks/openshift-node/private/configure_nodes.yml

@@ -4,10 +4,10 @@
   vars:
     openshift_node_master_api_url: "{{ hostvars[groups.oo_first_master.0].openshift.master.api_url }}"
     openshift_node_first_master_ip: "{{ hostvars[groups.oo_first_master.0].openshift.common.ip }}"
-    openshift_no_proxy_internal_hostnames: "{{ hostvars | oo_select_keys(groups['oo_nodes_to_config']
+    openshift_no_proxy_internal_hostnames: "{{ hostvars | lib_utils_oo_select_keys(groups['oo_nodes_to_config']
                                                     | union(groups['oo_masters_to_config'])
                                                     | union(groups['oo_etcd_to_config'] | default([])))
-                                                | oo_collect('openshift.common.hostname') | default([]) | join (',')
+                                                | lib_utils_oo_collect('openshift.common.hostname') | default([]) | join (',')
                                                 }}"
   roles:
   - role: openshift_clock

+ 2 - 2
playbooks/openshift-node/private/containerized_nodes.yml

@@ -5,10 +5,10 @@
   vars:
     openshift_node_master_api_url: "{{ hostvars[groups.oo_first_master.0].openshift.master.api_url }}"
     openshift_node_first_master_ip: "{{ hostvars[groups.oo_first_master.0].openshift.common.ip }}"
-    openshift_no_proxy_internal_hostnames: "{{ hostvars | oo_select_keys(groups['oo_nodes_to_config']
+    openshift_no_proxy_internal_hostnames: "{{ hostvars | lib_utils_oo_select_keys(groups['oo_nodes_to_config']
                                                     | union(groups['oo_masters_to_config'])
                                                     | union(groups['oo_etcd_to_config'] | default([])))
-                                                | oo_collect('openshift.common.hostname') | default([]) | join (',')
+                                                | lib_utils_oo_collect('openshift.common.hostname') | default([]) | join (',')
                                                 }}"
 
   roles:

+ 0 - 1
playbooks/openshift-node/private/filter_plugins

@@ -1 +0,0 @@
-../../../filter_plugins

+ 0 - 1
playbooks/openshift-node/private/lookup_plugins

@@ -1 +0,0 @@
-../../../lookup_plugins

+ 1 - 1
playbooks/redeploy-certificates.yml

@@ -9,7 +9,7 @@
 
 - import_playbook: openshift-etcd/private/restart.yml
   vars:
-    g_etcd_certificates_expired: "{{ ('expired' in (hostvars | oo_select_keys(groups['etcd']) | oo_collect('check_results.check_results.etcd') | oo_collect('health'))) | bool }}"
+    g_etcd_certificates_expired: "{{ ('expired' in (hostvars | lib_utils_oo_select_keys(groups['etcd']) | lib_utils_oo_collect('check_results.check_results.etcd') | lib_utils_oo_collect('health'))) | bool }}"
 
 - import_playbook: openshift-master/private/restart.yml
 

+ 1 - 0
roles/ansible_service_broker/meta/main.yml

@@ -12,4 +12,5 @@ galaxy_info:
   categories:
   - cloud
 dependencies:
+- role: lib_utils
 - role: lib_openshift

+ 1 - 0
roles/calico/meta/main.yml

@@ -13,5 +13,6 @@ galaxy_info:
   - cloud
   - system
 dependencies:
+- role: lib_utils
 - role: openshift_facts
 - role: openshift_master_facts

+ 1 - 0
roles/calico_master/meta/main.yml

@@ -13,5 +13,6 @@ galaxy_info:
   - cloud
   - system
 dependencies:
+- role: lib_utils
 - role: calico
 - role: openshift_facts

+ 1 - 0
roles/cockpit-ui/meta/main.yml

@@ -12,4 +12,5 @@ galaxy_info:
   categories:
   - cloud
 dependencies:
+- role: lib_utils
 - role: lib_openshift

+ 1 - 1
roles/cockpit/meta/main.yml

@@ -12,4 +12,4 @@ galaxy_info:
   categories:
   - cloud
 dependencies:
-- role: lib_os_firewall
+- role: lib_utils

+ 1 - 1
roles/container_runtime/defaults/main.yml

@@ -59,7 +59,7 @@ docker_default_storage_path: /var/lib/docker
 # Set local versions of facts that must be in json format for container-daemon.json
 # NOTE: When jinja2.9+ is used the container-daemon.json file can move to using tojson
 l_docker_log_options: "{{ l2_docker_log_options | to_json }}"
-l_docker_log_options_dict: "{{ l2_docker_log_options | oo_list_to_dict | to_json }}"
+l_docker_log_options_dict: "{{ l2_docker_log_options | lib_utils_oo_list_to_dict | to_json }}"
 l_docker_additional_registries: "{{ l2_docker_additional_registries | to_json }}"
 l_docker_blocked_registries: "{{ l2_docker_blocked_registries | to_json }}"
 l_docker_insecure_registries: "{{ l2_docker_insecure_registries | to_json }}"

+ 0 - 1
roles/container_runtime/meta/main.yml

@@ -11,5 +11,4 @@ galaxy_info:
     - 7
 dependencies:
 - role: lib_openshift
-- role: lib_os_firewall
 - role: lib_utils

+ 2 - 2
roles/container_runtime/tasks/package_docker.yml

@@ -48,7 +48,7 @@
   lineinfile:
     dest: /etc/sysconfig/docker
     regexp: '^{{ item.reg_conf_var }}=.*$'
-    line: "{{ item.reg_conf_var }}='{{ item.reg_fact_val | oo_prepend_strings_in_list(item.reg_flag ~ ' ') | join(' ') }}'"
+    line: "{{ item.reg_conf_var }}='{{ item.reg_fact_val | lib_utils_oo_prepend_strings_in_list(item.reg_flag ~ ' ') | join(' ') }}'"
   when:
   - item.reg_fact_val != []
   - docker_check.stat.isreg is defined
@@ -101,7 +101,7 @@
     line: "OPTIONS='\
       {% if ansible_selinux.status | default(None) == 'enabled' and openshift_docker_selinux_enabled | default(true) | bool %} --selinux-enabled {% endif %} \
       {% if openshift_docker_log_driver | bool %} --log-driver {{ openshift_docker_log_driver }}{% endif %} \
-      {% if l2_docker_log_options != [] %} {{ l2_docker_log_options |  oo_split() | oo_prepend_strings_in_list('--log-opt ') | join(' ')}}{% endif %} \
+      {% if l2_docker_log_options != [] %} {{ l2_docker_log_options |  lib_utils_oo_split() | lib_utils_oo_prepend_strings_in_list('--log-opt ') | join(' ')}}{% endif %} \
       {% if openshift_docker_hosted_registry_insecure and (openshift_docker_hosted_registry_network | bool) %} --insecure-registry={{ openshift_docker_hosted_registry_network }} {% endif %} \
       {% if docker_options is defined %} {{ docker_options }}{% endif %} \
       {% if openshift_docker_options %} {{ openshift_docker_options }}{% endif %} \

+ 1 - 0
roles/contiv/meta/main.yml

@@ -13,6 +13,7 @@ galaxy_info:
   - cloud
   - system
 dependencies:
+- role: lib_utils
 - role: contiv_facts
 - role: etcd
   etcd_service: contiv-etcd

+ 0 - 1
roles/etcd/meta/main.yml

@@ -17,6 +17,5 @@ galaxy_info:
   - system
 dependencies:
 - role: lib_openshift
-- role: lib_os_firewall
 - role: lib_utils
 - role: openshift_facts

+ 1 - 1
roles/etcd/tasks/certificates/fetch_client_certificates_from_ca.yml

@@ -28,7 +28,7 @@
     etcd_client_certs_missing: "{{ true if etcd_certificates_redeploy | default(false) | bool
                                    else (False in (g_external_etcd_cert_stat_result.results
                                                    | default({})
-                                                   | oo_collect(attribute='stat.exists')
+                                                   | lib_utils_oo_collect(attribute='stat.exists')
                                                    | list)) }}"
 
 - name: Ensure generated_certs directory present

+ 1 - 1
roles/etcd/tasks/certificates/fetch_server_certificates_from_ca.yml

@@ -21,7 +21,7 @@
     etcd_server_certs_missing: "{{ true if etcd_certificates_redeploy | default(false) | bool
                                    else (False in (g_etcd_server_cert_stat_result.results
                                                    | default({})
-                                                   | oo_collect(attribute='stat.exists')
+                                                   | lib_utils_oo_collect(attribute='stat.exists')
                                                    | list)) }}"
 
 - name: Ensure generated_certs directory present

+ 2 - 1
roles/flannel/meta/main.yml

@@ -12,4 +12,5 @@ galaxy_info:
   categories:
   - cloud
   - system
-dependencies: []
+dependencies:
+- role: lib_utils

+ 2 - 1
roles/flannel_register/meta/main.yml

@@ -13,4 +13,5 @@ galaxy_info:
   - cloud
   - system
 dependencies:
-- { role: openshift_facts }
+- role: openshift_facts
+- role: lib_utils

+ 3 - 2
roles/kuryr/meta/main.yml

@@ -13,5 +13,6 @@ galaxy_info:
   - cloud
   - system
 dependencies:
-- { role: lib_openshift }
-- { role: openshift_facts }
+- role: lib_utils
+- role: lib_openshift
+- role: openshift_facts

+ 0 - 63
roles/lib_os_firewall/README.md

@@ -1,63 +0,0 @@
-lib_os_firewall
-===========
-
-lib_os_firewall manages iptables firewall settings for a minimal use
-case (Adding/Removing rules based on protocol and port number).
-
-Note: firewalld is not supported on Atomic Host
-https://bugzilla.redhat.com/show_bug.cgi?id=1403331
-
-Requirements
-------------
-
-Ansible 2.2
-
-Role Variables
---------------
-
-| Name                      | Default |                                        |
-|---------------------------|---------|----------------------------------------|
-| os_firewall_allow         | []      | List of service,port mappings to allow |
-| os_firewall_deny          | []      | List of service, port mappings to deny |
-
-Dependencies
-------------
-
-None.
-
-Example Playbook
-----------------
-
-Use iptables and open tcp ports 80 and 443:
-```
----
-- hosts: servers
-  vars:
-    os_firewall_use_firewalld: false
-    os_firewall_allow:
-    - service: httpd
-      port: 80/tcp
-    - service: https
-      port: 443/tcp
-  tasks:
-  - include_role:
-      name: lib_os_firewall
-
-  - name: set allow rules
-    os_firewall_manage_iptables:
-      name: "{{ item.service }}"
-      action: add
-      protocol: "{{ item.port.split('/')[1] }}"
-      port: "{{ item.port.split('/')[0] }}"
-    with_items: "{{ os_firewall_allow }}"
-```
-
-
-License
--------
-
-Apache License, Version 2.0
-
-Author Information
-------------------
-Jason DeTiberus - jdetiber@redhat.com

callback_plugins/aa_version_requirement.py → roles/lib_utils/callback_plugins/aa_version_requirement.py


callback_plugins/openshift_quick_installer.py → roles/lib_utils/callback_plugins/openshift_quick_installer.py


+ 73 - 404
filter_plugins/oo_filters.py

@@ -4,7 +4,6 @@
 """
 Custom filters for use in openshift-ansible
 """
-import json
 import os
 import pdb
 import random
@@ -15,10 +14,8 @@ from collections import Mapping
 # pylint no-name-in-module and import-error disabled here because pylint
 # fails to properly detect the packages when installed in a virtualenv
 from distutils.util import strtobool  # pylint:disable=no-name-in-module,import-error
-from distutils.version import LooseVersion  # pylint:disable=no-name-in-module,import-error
 from operator import itemgetter
 
-import pkg_resources
 import yaml
 
 from ansible import errors
@@ -40,10 +37,12 @@ except ImportError:
     pass
 
 
-def oo_pdb(arg):
+# pylint: disable=C0103
+
+def lib_utils_oo_pdb(arg):
     """ This pops you into a pdb instance where arg is the data passed in
         from the filter.
-        Ex: "{{ hostvars | oo_pdb }}"
+        Ex: "{{ hostvars | lib_utils_oo_pdb }}"
     """
     pdb.set_trace()
     return arg
@@ -81,55 +80,7 @@ def oo_flatten(data):
     return [item for sublist in data for item in sublist]
 
 
-def oo_merge_dicts(first_dict, second_dict):
-    """ Merge two dictionaries where second_dict values take precedence.
-        Ex: first_dict={'a': 1, 'b': 2}
-            second_dict={'b': 3, 'c': 4}
-            returns {'a': 1, 'b': 3, 'c': 4}
-    """
-    if not isinstance(first_dict, dict) or not isinstance(second_dict, dict):
-        raise errors.AnsibleFilterError("|failed expects to merge two dicts")
-    merged = first_dict.copy()
-    merged.update(second_dict)
-    return merged
-
-
-def oo_merge_hostvars(hostvars, variables, inventory_hostname):
-    """ Merge host and play variables.
-
-        When ansible version is greater than or equal to 2.0.0,
-        merge hostvars[inventory_hostname] with variables (ansible vars)
-        otherwise merge hostvars with hostvars['inventory_hostname'].
-
-        Ex: hostvars={'master1.example.com': {'openshift_variable': '3'},
-                      'openshift_other_variable': '7'}
-            variables={'openshift_other_variable': '6'}
-            inventory_hostname='master1.example.com'
-            returns {'openshift_variable': '3', 'openshift_other_variable': '7'}
-
-            hostvars=<ansible.vars.hostvars.HostVars object> (Mapping)
-            variables={'openshift_other_variable': '6'}
-            inventory_hostname='master1.example.com'
-            returns {'openshift_variable': '3', 'openshift_other_variable': '6'}
-    """
-    if not isinstance(hostvars, Mapping):
-        raise errors.AnsibleFilterError("|failed expects hostvars is dictionary or object")
-    if not isinstance(variables, dict):
-        raise errors.AnsibleFilterError("|failed expects variables is a dictionary")
-    if not isinstance(inventory_hostname, string_types):
-        raise errors.AnsibleFilterError("|failed expects inventory_hostname is a string")
-    ansible_version = pkg_resources.get_distribution("ansible").version  # pylint: disable=maybe-no-member
-    merged_hostvars = {}
-    if LooseVersion(ansible_version) >= LooseVersion('2.0.0'):
-        merged_hostvars = oo_merge_dicts(
-            hostvars[inventory_hostname], variables)
-    else:
-        merged_hostvars = oo_merge_dicts(
-            hostvars[inventory_hostname], hostvars)
-    return merged_hostvars
-
-
-def oo_collect(data_list, attribute=None, filters=None):
+def lib_utils_oo_collect(data_list, attribute=None, filters=None):
     """ This takes a list of dict and collects all attributes specified into a
         list. If filter is specified then we will include all items that
         match _ALL_ of filters.  If a dict entry is missing the key in a
@@ -158,24 +109,24 @@ def oo_collect(data_list, attribute=None, filters=None):
             returns [1, 2, 3, 5]
     """
     if not isinstance(data_list, list):
-        raise errors.AnsibleFilterError("oo_collect expects to filter on a List")
+        raise errors.AnsibleFilterError("lib_utils_oo_collect expects to filter on a List")
 
     if not attribute:
-        raise errors.AnsibleFilterError("oo_collect expects attribute to be set")
+        raise errors.AnsibleFilterError("lib_utils_oo_collect expects attribute to be set")
 
     data = []
     retval = []
 
     for item in data_list:
         if isinstance(item, list):
-            retval.extend(oo_collect(item, attribute, filters))
+            retval.extend(lib_utils_oo_collect(item, attribute, filters))
         else:
             data.append(item)
 
     if filters is not None:
         if not isinstance(filters, dict):
             raise errors.AnsibleFilterError(
-                "oo_collect expects filter to be a dict")
+                "lib_utils_oo_collect expects filter to be a dict")
         retval.extend([get_attr(d, attribute) for d in data if (
             all([d.get(key, None) == filters[key] for key in filters]))])
     else:
@@ -186,7 +137,7 @@ def oo_collect(data_list, attribute=None, filters=None):
     return retval
 
 
-def oo_select_keys_from_list(data, keys):
+def lib_utils_oo_select_keys_from_list(data, keys):
     """ This returns a list, which contains the value portions for the keys
         Ex: data = { 'a':1, 'b':2, 'c':3 }
             keys = ['a', 'c']
@@ -194,18 +145,18 @@ def oo_select_keys_from_list(data, keys):
     """
 
     if not isinstance(data, list):
-        raise errors.AnsibleFilterError("|oo_select_keys_from_list failed expects to filter on a list")
+        raise errors.AnsibleFilterError("|lib_utils_oo_select_keys_from_list failed expects to filter on a list")
 
     if not isinstance(keys, list):
-        raise errors.AnsibleFilterError("|oo_select_keys_from_list failed expects first param is a list")
+        raise errors.AnsibleFilterError("|lib_utils_oo_select_keys_from_list failed expects first param is a list")
 
     # Gather up the values for the list of keys passed in
-    retval = [oo_select_keys(item, keys) for item in data]
+    retval = [lib_utils_oo_select_keys(item, keys) for item in data]
 
     return oo_flatten(retval)
 
 
-def oo_select_keys(data, keys):
+def lib_utils_oo_select_keys(data, keys):
     """ This returns a list, which contains the value portions for the keys
         Ex: data = { 'a':1, 'b':2, 'c':3 }
             keys = ['a', 'c']
@@ -213,10 +164,10 @@ def oo_select_keys(data, keys):
     """
 
     if not isinstance(data, Mapping):
-        raise errors.AnsibleFilterError("|oo_select_keys failed expects to filter on a dict or object")
+        raise errors.AnsibleFilterError("|lib_utils_oo_select_keys failed expects to filter on a dict or object")
 
     if not isinstance(keys, list):
-        raise errors.AnsibleFilterError("|oo_select_keys failed expects first param is a list")
+        raise errors.AnsibleFilterError("|lib_utils_oo_select_keys failed expects first param is a list")
 
     # Gather up the values for the list of keys passed in
     retval = [data[key] for key in keys if key in data]
@@ -224,7 +175,7 @@ def oo_select_keys(data, keys):
     return retval
 
 
-def oo_prepend_strings_in_list(data, prepend):
+def lib_utils_oo_prepend_strings_in_list(data, prepend):
     """ This takes a list of strings and prepends a string to each item in the
         list
         Ex: data = ['cart', 'tree']
@@ -240,44 +191,7 @@ def oo_prepend_strings_in_list(data, prepend):
     return retval
 
 
-def oo_combine_key_value(data, joiner='='):
-    """Take a list of dict in the form of { 'key': 'value'} and
-       arrange them as a list of strings ['key=value']
-    """
-    if not isinstance(data, list):
-        raise errors.AnsibleFilterError("|failed expects first param is a list")
-
-    rval = []
-    for item in data:
-        rval.append("%s%s%s" % (item['key'], joiner, item['value']))
-
-    return rval
-
-
-def oo_combine_dict(data, in_joiner='=', out_joiner=' '):
-    """Take a dict in the form of { 'key': 'value', 'key': 'value' } and
-       arrange them as a string 'key=value key=value'
-    """
-    if not isinstance(data, dict):
-        # pylint: disable=line-too-long
-        raise errors.AnsibleFilterError("|failed expects first param is a dict [oo_combine_dict]. Got %s. Type: %s" % (str(data), str(type(data))))
-
-    return out_joiner.join([in_joiner.join([k, str(v)]) for k, v in data.items()])
-
-
-def oo_dict_to_keqv_list(data):
-    """Take a dict and return a list of k=v pairs
-
-        Input data:
-        {'a': 1, 'b': 2}
-
-        Return data:
-        ['a=1', 'b=2']
-    """
-    return ['='.join(str(e) for e in x) for x in data.items()]
-
-
-def oo_dict_to_list_of_dict(data, key_title='key', value_title='value'):
+def lib_utils_oo_dict_to_list_of_dict(data, key_title='key', value_title='value'):
     """Take a dict and arrange them as a list of dicts
 
        Input data:
@@ -318,67 +232,7 @@ def oo_ami_selector(data, image_name):
             return ami['ami_id']
 
 
-def oo_ec2_volume_definition(data, host_type, docker_ephemeral=False):
-    """ This takes a dictionary of volume definitions and returns a valid ec2
-        volume definition based on the host_type and the values in the
-        dictionary.
-        The dictionary should look similar to this:
-            { 'master':
-                { 'root':
-                    { 'volume_size': 10, 'device_type': 'gp2',
-                      'iops': 500
-                    },
-                    'docker':
-                      { 'volume_size': 40, 'device_type': 'gp2',
-                        'iops': 500, 'ephemeral': 'true'
-                      }
-                },
-              'node':
-                { 'root':
-                    { 'volume_size': 10, 'device_type': 'io1',
-                      'iops': 1000
-                    },
-                  'docker':
-                    { 'volume_size': 40, 'device_type': 'gp2',
-                      'iops': 500, 'ephemeral': 'true'
-                    }
-                }
-            }
-    """
-    if not isinstance(data, dict):
-        # pylint: disable=line-too-long
-        raise errors.AnsibleFilterError("|failed expects first param is a dict [oo_ec2_volume_def]. Got %s. Type: %s" % (str(data), str(type(data))))
-    if host_type not in ['master', 'node', 'etcd']:
-        raise errors.AnsibleFilterError("|failed expects etcd, master or node"
-                                        " as the host type")
-
-    root_vol = data[host_type]['root']
-    root_vol['device_name'] = '/dev/sda1'
-    root_vol['delete_on_termination'] = True
-    if root_vol['device_type'] != 'io1':
-        root_vol.pop('iops', None)
-    if host_type in ['master', 'node'] and 'docker' in data[host_type]:
-        docker_vol = data[host_type]['docker']
-        docker_vol['device_name'] = '/dev/xvdb'
-        docker_vol['delete_on_termination'] = True
-        if docker_vol['device_type'] != 'io1':
-            docker_vol.pop('iops', None)
-        if docker_ephemeral:
-            docker_vol.pop('device_type', None)
-            docker_vol.pop('delete_on_termination', None)
-            docker_vol['ephemeral'] = 'ephemeral0'
-        return [root_vol, docker_vol]
-    elif host_type == 'etcd' and 'etcd' in data[host_type]:
-        etcd_vol = data[host_type]['etcd']
-        etcd_vol['device_name'] = '/dev/xvdb'
-        etcd_vol['delete_on_termination'] = True
-        if etcd_vol['device_type'] != 'io1':
-            etcd_vol.pop('iops', None)
-        return [root_vol, etcd_vol]
-    return [root_vol]
-
-
-def oo_split(string, separator=','):
+def lib_utils_oo_split(string, separator=','):
     """ This splits the input string into a list. If the input string is
     already a list we will return it as is.
     """
@@ -387,14 +241,26 @@ def oo_split(string, separator=','):
     return string.split(separator)
 
 
-def oo_list_to_dict(lst, separator='='):
+def lib_utils_oo_dict_to_keqv_list(data):
+    """Take a dict and return a list of k=v pairs
+
+        Input data:
+        {'a': 1, 'b': 2}
+
+        Return data:
+        ['a=1', 'b=2']
+    """
+    return ['='.join(str(e) for e in x) for x in data.items()]
+
+
+def lib_utils_oo_list_to_dict(lst, separator='='):
     """ This converts a list of ["k=v"] to a dictionary {k: v}.
     """
     kvs = [i.split(separator) for i in lst]
     return {k: v for k, v in kvs}
 
 
-def oo_haproxy_backend_masters(hosts, port):
+def haproxy_backend_masters(hosts, port):
     """ This takes an array of dicts and returns an array of dicts
         to be used as a backend for the haproxy role
     """
@@ -408,95 +274,8 @@ def oo_haproxy_backend_masters(hosts, port):
     return servers
 
 
-def oo_filter_list(data, filter_attr=None):
-    """ This returns a list, which contains all items where filter_attr
-        evaluates to true
-        Ex: data = [ { a: 1, b: True },
-                     { a: 3, b: False },
-                     { a: 5, b: True } ]
-            filter_attr = 'b'
-            returns [ { a: 1, b: True },
-                      { a: 5, b: True } ]
-    """
-    if not isinstance(data, list):
-        raise errors.AnsibleFilterError("|failed expects to filter on a list")
-
-    if not isinstance(filter_attr, string_types):
-        raise errors.AnsibleFilterError("|failed expects filter_attr is a str or unicode")
-
-    # Gather up the values for the list of keys passed in
-    return [x for x in data if filter_attr in x and x[filter_attr]]
-
-
-def oo_parse_heat_stack_outputs(data):
-    """ Formats the HEAT stack output into a usable form
-
-        The goal is to transform something like this:
-
-        +---------------+-------------------------------------------------+
-        | Property      | Value                                           |
-        +---------------+-------------------------------------------------+
-        | capabilities  | [] |                                            |
-        | creation_time | 2015-06-26T12:26:26Z |                          |
-        | description   | OpenShift cluster |                             |
-        | …             | …                                               |
-        | outputs       | [                                               |
-        |               |   {                                             |
-        |               |     "output_value": "value_A"                   |
-        |               |     "description": "This is the value of Key_A" |
-        |               |     "output_key": "Key_A"                       |
-        |               |   },                                            |
-        |               |   {                                             |
-        |               |     "output_value": [                           |
-        |               |       "value_B1",                               |
-        |               |       "value_B2"                                |
-        |               |     ],                                          |
-        |               |     "description": "This is the value of Key_B" |
-        |               |     "output_key": "Key_B"                       |
-        |               |   },                                            |
-        |               | ]                                               |
-        | parameters    | {                                               |
-        | …             | …                                               |
-        +---------------+-------------------------------------------------+
-
-        into something like this:
-
-        {
-          "Key_A": "value_A",
-          "Key_B": [
-            "value_B1",
-            "value_B2"
-          ]
-        }
-    """
-
-    # Extract the “outputs” JSON snippet from the pretty-printed array
-    in_outputs = False
-    outputs = ''
-
-    line_regex = re.compile(r'\|\s*(.*?)\s*\|\s*(.*?)\s*\|')
-    for line in data['stdout_lines']:
-        match = line_regex.match(line)
-        if match:
-            if match.group(1) == 'outputs':
-                in_outputs = True
-            elif match.group(1) != '':
-                in_outputs = False
-            if in_outputs:
-                outputs += match.group(2)
-
-    outputs = json.loads(outputs)
-
-    # Revamp the “outputs” to put it in the form of a “Key: value” map
-    revamped_outputs = {}
-    for output in outputs:
-        revamped_outputs[output['output_key']] = output['output_value']
-
-    return revamped_outputs
-
-
 # pylint: disable=too-many-branches
-def oo_parse_named_certificates(certificates, named_certs_dir, internal_hostnames):
+def lib_utils_oo_parse_named_certificates(certificates, named_certs_dir, internal_hostnames):
     """ Parses names from list of certificate hashes.
 
         Ex: certificates = [{ "certfile": "/root/custom1.crt",
@@ -564,67 +343,7 @@ def oo_parse_named_certificates(certificates, named_certs_dir, internal_hostname
     return certificates
 
 
-def oo_pretty_print_cluster(data, prefix='tag_'):
-    """ Read a subset of hostvars and build a summary of the cluster
-        in the following layout:
-
-"c_id": {
-"master": {
-"default": [
-  { "name": "c_id-master-12345",       "public IP": "172.16.0.1", "private IP": "192.168.0.1" }
-]
-"node": {
-"infra": [
-  { "name": "c_id-node-infra-23456",   "public IP": "172.16.0.2", "private IP": "192.168.0.2" }
-],
-"compute": [
-  { "name": "c_id-node-compute-23456", "public IP": "172.16.0.3", "private IP": "192.168.0.3" },
-...
-]
-}
-    """
-
-    def _get_tag_value(tags, key):
-        """ Extract values of a map implemented as a set.
-            Ex: tags = { 'tag_foo_value1', 'tag_bar_value2', 'tag_baz_value3' }
-                key = 'bar'
-                returns 'value2'
-        """
-        for tag in tags:
-            if tag[:len(prefix) + len(key)] == prefix + key:
-                return tag[len(prefix) + len(key) + 1:]
-        raise KeyError(key)
-
-    def _add_host(clusters,
-                  clusterid,
-                  host_type,
-                  sub_host_type,
-                  host):
-        """ Add a new host in the clusters data structure """
-        if clusterid not in clusters:
-            clusters[clusterid] = {}
-        if host_type not in clusters[clusterid]:
-            clusters[clusterid][host_type] = {}
-        if sub_host_type not in clusters[clusterid][host_type]:
-            clusters[clusterid][host_type][sub_host_type] = []
-        clusters[clusterid][host_type][sub_host_type].append(host)
-
-    clusters = {}
-    for host in data:
-        try:
-            _add_host(clusters=clusters,
-                      clusterid=_get_tag_value(host['group_names'], 'clusterid'),
-                      host_type=_get_tag_value(host['group_names'], 'host-type'),
-                      sub_host_type=_get_tag_value(host['group_names'], 'sub-host-type'),
-                      host={'name': host['inventory_hostname'],
-                            'public IP': host['oo_public_ipv4'],
-                            'private IP': host['oo_private_ipv4']})
-        except KeyError:
-            pass
-    return clusters
-
-
-def oo_generate_secret(num_bytes):
+def lib_utils_oo_generate_secret(num_bytes):
     """ generate a session secret """
 
     if not isinstance(num_bytes, int):
@@ -633,7 +352,7 @@ def oo_generate_secret(num_bytes):
     return b64encode(os.urandom(num_bytes)).decode('utf-8')
 
 
-def to_padded_yaml(data, level=0, indent=2, **kw):
+def lib_utils_to_padded_yaml(data, level=0, indent=2, **kw):
     """ returns a yaml snippet padded to match the indent level you specify """
     if data in [None, ""]:
         return ""
@@ -648,31 +367,7 @@ def to_padded_yaml(data, level=0, indent=2, **kw):
         raise errors.AnsibleFilterError('Failed to convert: %s' % my_e)
 
 
-def oo_31_rpm_rename_conversion(rpms, openshift_version=None):
-    """ Filters a list of 3.0 rpms and return the corresponding 3.1 rpms
-        names with proper version (if provided)
-
-        If 3.1 rpms are passed in they will only be augmented with the
-        correct version.  This is important for hosts that are running both
-        Masters and Nodes.
-    """
-    if not isinstance(rpms, list):
-        raise errors.AnsibleFilterError("failed expects to filter on a list")
-    if openshift_version is not None and not isinstance(openshift_version, string_types):
-        raise errors.AnsibleFilterError("failed expects openshift_version to be a string")
-
-    rpms_31 = []
-    for rpm in rpms:
-        if 'atomic' not in rpm:
-            rpm = rpm.replace("openshift", "atomic-openshift")
-        if openshift_version:
-            rpm = rpm + openshift_version
-        rpms_31.append(rpm)
-
-    return rpms_31
-
-
-def oo_pods_match_component(pods, deployment_type, component):
+def lib_utils_oo_pods_match_component(pods, deployment_type, component):
     """ Filters a list of Pods and returns the ones matching the deployment_type and component
     """
     if not isinstance(pods, list):
@@ -697,20 +392,7 @@ def oo_pods_match_component(pods, deployment_type, component):
     return matching_pods
 
 
-def oo_get_hosts_from_hostvars(hostvars, hosts):
-    """ Return a list of hosts from hostvars """
-    retval = []
-    for host in hosts:
-        try:
-            retval.append(hostvars[host])
-        except errors.AnsibleError:
-            # host does not exist
-            pass
-
-    return retval
-
-
-def oo_image_tag_to_rpm_version(version, include_dash=False):
+def lib_utils_oo_image_tag_to_rpm_version(version, include_dash=False):
     """ Convert an image tag string to an RPM version if necessary
         Empty strings and strings that are already in rpm version format
         are ignored. Also remove non semantic version components.
@@ -731,7 +413,7 @@ def oo_image_tag_to_rpm_version(version, include_dash=False):
     return version
 
 
-def oo_hostname_from_url(url):
+def lib_utils_oo_hostname_from_url(url):
     """ Returns the hostname contained in a URL
 
         Ex: https://ose3-master.example.com/v1/api -> ose3-master.example.com
@@ -747,7 +429,7 @@ def oo_hostname_from_url(url):
 
 
 # pylint: disable=invalid-name, unused-argument
-def oo_openshift_loadbalancer_frontends(
+def lib_utils_oo_loadbalancer_frontends(
         api_port, servers_hostvars, use_nuage=False, nuage_rest_port=None):
     """TODO: Document me."""
     loadbalancer_frontends = [{'name': 'atomic-openshift-api',
@@ -765,25 +447,25 @@ def oo_openshift_loadbalancer_frontends(
 
 
 # pylint: disable=invalid-name
-def oo_openshift_loadbalancer_backends(
+def lib_utils_oo_loadbalancer_backends(
         api_port, servers_hostvars, use_nuage=False, nuage_rest_port=None):
     """TODO: Document me."""
     loadbalancer_backends = [{'name': 'atomic-openshift-api',
                               'mode': 'tcp',
                               'option': 'tcplog',
                               'balance': 'source',
-                              'servers': oo_haproxy_backend_masters(servers_hostvars, api_port)}]
+                              'servers': haproxy_backend_masters(servers_hostvars, api_port)}]
     if bool(strtobool(str(use_nuage))) and nuage_rest_port is not None:
         # pylint: disable=line-too-long
         loadbalancer_backends.append({'name': 'nuage-monitor',
                                       'mode': 'tcp',
                                       'option': 'tcplog',
                                       'balance': 'source',
-                                      'servers': oo_haproxy_backend_masters(servers_hostvars, nuage_rest_port)})
+                                      'servers': haproxy_backend_masters(servers_hostvars, nuage_rest_port)})
     return loadbalancer_backends
 
 
-def oo_chomp_commit_offset(version):
+def lib_utils_oo_chomp_commit_offset(version):
     """Chomp any "+git.foo" commit offset string from the given `version`
     and return the modified version string.
 
@@ -803,17 +485,17 @@ Ex:
         return str(version).split('+')[0]
 
 
-def oo_random_word(length, source='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'):
+def lib_utils_oo_random_word(length, source='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'):
     """Generates a random string of given length from a set of alphanumeric characters.
        The default source uses [a-z][A-Z][0-9]
        Ex:
-       - oo_random_word(3)                => aB9
-       - oo_random_word(4, source='012')  => 0123
+       - lib_utils_oo_random_word(3)                => aB9
+       - lib_utils_oo_random_word(4, source='012')  => 0123
     """
     return ''.join(random.choice(source) for i in range(length))
 
 
-def oo_contains_rule(source, apiGroups, resources, verbs):
+def lib_utils_oo_contains_rule(source, apiGroups, resources, verbs):
     '''Return true if the specified rule is contained within the provided source'''
 
     rules = source['rules']
@@ -828,7 +510,7 @@ def oo_contains_rule(source, apiGroups, resources, verbs):
     return False
 
 
-def oo_selector_to_string_list(user_dict):
+def lib_utils_oo_selector_to_string_list(user_dict):
     """Convert a dict of selectors to a key=value list of strings
 
 Given input of {'region': 'infra', 'zone': 'primary'} returns a list
@@ -840,7 +522,7 @@ of items as ['region=infra', 'zone=primary']
     return selectors
 
 
-def oo_filter_sa_secrets(sa_secrets, secret_hint='-token-'):
+def lib_utils_oo_filter_sa_secrets(sa_secrets, secret_hint='-token-'):
     """Parse the Service Account Secrets list, `sa_secrets`, (as from
 oc_serviceaccount_secret:state=list) and return the name of the secret
 containing the `secret_hint` string. For example, by default this will
@@ -879,7 +561,7 @@ that result to this filter plugin.
 
     - name: Save the SA bearer token secret name
       set_fact:
-        management_token: "{{ sa.results | oo_filter_sa_secrets }}"
+        management_token: "{{ sa.results | lib_utils_oo_filter_sa_secrets }}"
 
     - name: Get the SA bearer token value
       oc_secret:
@@ -914,39 +596,26 @@ class FilterModule(object):
     def filters(self):
         """ returns a mapping of filters to methods """
         return {
-            "oo_select_keys": oo_select_keys,
-            "oo_select_keys_from_list": oo_select_keys_from_list,
-            "oo_chomp_commit_offset": oo_chomp_commit_offset,
-            "oo_collect": oo_collect,
-            "oo_flatten": oo_flatten,
-            "oo_pdb": oo_pdb,
-            "oo_prepend_strings_in_list": oo_prepend_strings_in_list,
-            "oo_ami_selector": oo_ami_selector,
-            "oo_ec2_volume_definition": oo_ec2_volume_definition,
-            "oo_combine_key_value": oo_combine_key_value,
-            "oo_combine_dict": oo_combine_dict,
-            "oo_dict_to_keqv_list": oo_dict_to_keqv_list,
-            "oo_dict_to_list_of_dict": oo_dict_to_list_of_dict,
-            "oo_split": oo_split,
-            "oo_list_to_dict": oo_list_to_dict,
-            "oo_filter_list": oo_filter_list,
-            "oo_parse_heat_stack_outputs": oo_parse_heat_stack_outputs,
-            "oo_parse_named_certificates": oo_parse_named_certificates,
-            "oo_haproxy_backend_masters": oo_haproxy_backend_masters,
-            "oo_pretty_print_cluster": oo_pretty_print_cluster,
-            "oo_generate_secret": oo_generate_secret,
-            "oo_31_rpm_rename_conversion": oo_31_rpm_rename_conversion,
-            "oo_pods_match_component": oo_pods_match_component,
-            "oo_get_hosts_from_hostvars": oo_get_hosts_from_hostvars,
-            "oo_image_tag_to_rpm_version": oo_image_tag_to_rpm_version,
-            "oo_merge_dicts": oo_merge_dicts,
-            "oo_hostname_from_url": oo_hostname_from_url,
-            "oo_merge_hostvars": oo_merge_hostvars,
-            "oo_openshift_loadbalancer_frontends": oo_openshift_loadbalancer_frontends,
-            "oo_openshift_loadbalancer_backends": oo_openshift_loadbalancer_backends,
-            "to_padded_yaml": to_padded_yaml,
-            "oo_random_word": oo_random_word,
-            "oo_contains_rule": oo_contains_rule,
-            "oo_selector_to_string_list": oo_selector_to_string_list,
-            "oo_filter_sa_secrets": oo_filter_sa_secrets,
+            "lib_utils_oo_select_keys": lib_utils_oo_select_keys,
+            "lib_utils_oo_select_keys_from_list": lib_utils_oo_select_keys_from_list,
+            "lib_utils_oo_chomp_commit_offset": lib_utils_oo_chomp_commit_offset,
+            "lib_utils_oo_collect": lib_utils_oo_collect,
+            "lib_utils_oo_pdb": lib_utils_oo_pdb,
+            "lib_utils_oo_prepend_strings_in_list": lib_utils_oo_prepend_strings_in_list,
+            "lib_utils_oo_dict_to_list_of_dict": lib_utils_oo_dict_to_list_of_dict,
+            "lib_utils_oo_split": lib_utils_oo_split,
+            "lib_utils_oo_dict_to_keqv_list": lib_utils_oo_dict_to_keqv_list,
+            "lib_utils_oo_list_to_dict": lib_utils_oo_list_to_dict,
+            "lib_utils_oo_parse_named_certificates": lib_utils_oo_parse_named_certificates,
+            "lib_utils_oo_generate_secret": lib_utils_oo_generate_secret,
+            "lib_utils_oo_pods_match_component": lib_utils_oo_pods_match_component,
+            "lib_utils_oo_image_tag_to_rpm_version": lib_utils_oo_image_tag_to_rpm_version,
+            "lib_utils_oo_hostname_from_url": lib_utils_oo_hostname_from_url,
+            "lib_utils_oo_loadbalancer_frontends": lib_utils_oo_loadbalancer_frontends,
+            "lib_utils_oo_loadbalancer_backends": lib_utils_oo_loadbalancer_backends,
+            "lib_utils_to_padded_yaml": lib_utils_to_padded_yaml,
+            "lib_utils_oo_random_word": lib_utils_oo_random_word,
+            "lib_utils_oo_contains_rule": lib_utils_oo_contains_rule,
+            "lib_utils_oo_selector_to_string_list": lib_utils_oo_selector_to_string_list,
+            "lib_utils_oo_filter_sa_secrets": lib_utils_oo_filter_sa_secrets,
         }

library/kubeclient_ca.py → roles/lib_utils/library/kubeclient_ca.py


+ 0 - 0
library/modify_yaml.py


+ 0 - 0
roles/lib_os_firewall/library/os_firewall_manage_iptables.py


library/rpm_q.py → roles/lib_utils/library/rpm_q.py


+ 1 - 1
roles/nuage_ca/meta/main.yml

@@ -13,4 +13,4 @@ galaxy_info:
   - cloud
   - system
 dependencies:
-- { role: nuage_common }
+- role: nuage_common

+ 1 - 1
roles/nuage_master/meta/main.yml

@@ -14,4 +14,4 @@ galaxy_info:
   - system
 dependencies:
 - role: lib_openshift
-- role: lib_os_firewall
+- role: lib_utils

+ 1 - 1
roles/nuage_node/meta/main.yml

@@ -15,4 +15,4 @@ galaxy_info:
 dependencies:
 - role: nuage_common
 - role: nuage_ca
-- role: lib_os_firewall
+- role: lib_utils

+ 1 - 0
roles/openshift_builddefaults/meta/main.yml

@@ -13,3 +13,4 @@ galaxy_info:
   - cloud
 dependencies:
 - role: openshift_facts
+- role: lib_utils

+ 1 - 0
roles/openshift_buildoverrides/meta/main.yml

@@ -13,3 +13,4 @@ galaxy_info:
   - cloud
 dependencies:
 - role: openshift_facts
+- role: lib_utils

+ 1 - 0
roles/openshift_ca/meta/main.yml

@@ -15,3 +15,4 @@ galaxy_info:
 dependencies:
 - role: openshift_cli
 - role: openshift_facts
+- role: lib_utils

+ 6 - 6
roles/openshift_ca/tasks/main.yml

@@ -9,7 +9,7 @@
 
 - name: Install the base package for admin tooling
   package:
-    name: "{{ openshift_service_type }}{{ openshift_pkg_version | default('') | oo_image_tag_to_rpm_version(include_dash=True) }}"
+    name: "{{ openshift_service_type }}{{ openshift_pkg_version | default('') | lib_utils_oo_image_tag_to_rpm_version(include_dash=True) }}"
     state: present
   when: not openshift.common.is_containerized | bool
   register: install_result
@@ -41,7 +41,7 @@
 
 - set_fact:
     master_ca_missing: "{{ False in (g_master_ca_stat_result.results
-                                     | oo_collect(attribute='stat.exists')
+                                     | lib_utils_oo_collect(attribute='stat.exists')
                                      | list) }}"
   run_once: true
 
@@ -88,10 +88,10 @@
 - name: Create the master certificates if they do not already exist
   command: >
     {{ hostvars[openshift_ca_host].openshift.common.client_binary }} adm ca create-master-certs
-    {% for named_ca_certificate in openshift.master.named_certificates | default([]) | oo_collect('cafile') %}
+    {% for named_ca_certificate in openshift.master.named_certificates | default([]) | lib_utils_oo_collect('cafile') %}
     --certificate-authority {{ named_ca_certificate }}
     {% endfor %}
-    {% for legacy_ca_certificate in g_master_legacy_ca_result.files | default([]) | oo_collect('path') %}
+    {% for legacy_ca_certificate in g_master_legacy_ca_result.files | default([]) | lib_utils_oo_collect('path') %}
     --certificate-authority {{ legacy_ca_certificate }}
     {% endfor %}
     --hostnames={{ hostvars[openshift_ca_host].openshift.common.all_hostnames | join(',') }}
@@ -117,7 +117,7 @@
       src: "{{ item }}"
       dest: "{{ openshift_ca_clientconfig_tmpdir.stdout }}/"
       remote_src: true
-    with_items: "{{ g_master_legacy_ca_result.files | default([]) | oo_collect('path') }}"
+    with_items: "{{ g_master_legacy_ca_result.files | default([]) | lib_utils_oo_collect('path') }}"
     delegate_to: "{{ openshift_ca_host }}"
     run_once: true
   - copy:
@@ -156,7 +156,7 @@
     command: >
       {{ hostvars[openshift_ca_host].openshift.common.client_binary }} adm create-api-client-config
         --certificate-authority={{ openshift_ca_cert }}
-        {% for named_ca_certificate in openshift.master.named_certificates | default([]) | oo_collect('cafile') %}
+        {% for named_ca_certificate in openshift.master.named_certificates | default([]) | lib_utils_oo_collect('cafile') %}
         --certificate-authority {{ named_ca_certificate }}
         {% endfor %}
         --client-dir={{ openshift_ca_loopback_tmpdir.stdout }}

+ 2 - 1
roles/openshift_certificate_expiry/meta/main.yml

@@ -13,4 +13,5 @@ galaxy_info:
   categories:
   - cloud
   - system
-dependencies: []
+dependencies:
+- role: lib_utils

+ 1 - 0
roles/openshift_cli/meta/main.yml

@@ -13,3 +13,4 @@ galaxy_info:
   - cloud
 dependencies:
 - role: openshift_facts
+- role: lib_utils

+ 1 - 0
roles/openshift_cloud_provider/meta/main.yml

@@ -13,3 +13,4 @@ galaxy_info:
   - cloud
 dependencies:
 - role: openshift_facts
+- role: lib_utils

+ 1 - 0
roles/openshift_cluster_autoscaler/meta/main.yml

@@ -1,3 +1,4 @@
 ---
 dependencies:
 - lib_openshift
+- role: lib_utils

+ 1 - 0
roles/openshift_default_storage_class/meta/main.yml

@@ -13,3 +13,4 @@ galaxy_info:
   - cloud
 dependencies:
 - role: lib_openshift
+- role: lib_utils

+ 1 - 0
roles/openshift_docker_gc/meta/main.yml

@@ -11,3 +11,4 @@ galaxy_info:
     - 7
 dependencies:
 - role: lib_openshift
+- role: lib_utils

+ 1 - 0
roles/openshift_etcd/meta/main.yml

@@ -14,3 +14,4 @@ galaxy_info:
 dependencies:
 - role: openshift_etcd_facts
 - role: etcd
+- role: lib_utils

+ 2 - 1
roles/openshift_etcd_client_certificates/meta/main.yml

@@ -11,4 +11,5 @@ galaxy_info:
     - 7
   categories:
   - cloud
-dependencies: []
+dependencies:
+- role: lib_utils

+ 1 - 0
roles/openshift_etcd_facts/meta/main.yml

@@ -13,3 +13,4 @@ galaxy_info:
   - cloud
 dependencies:
 - role: openshift_facts
+- role: lib_utils

+ 2 - 1
roles/openshift_examples/meta/main.yml

@@ -11,4 +11,5 @@ galaxy_info:
     - 7
   categories:
   - cloud
-dependencies: []
+dependencies:
+- role: lib_utils

+ 4 - 4
roles/openshift_excluder/tasks/install.yml

@@ -8,7 +8,7 @@
 
   - name: Install docker excluder - yum
     package:
-      name: "{{ r_openshift_excluder_service_type }}-docker-excluder{{ openshift_pkg_version | default('') | oo_image_tag_to_rpm_version(include_dash=True) +  '*' }}"
+      name: "{{ r_openshift_excluder_service_type }}-docker-excluder{{ openshift_pkg_version | default('') | lib_utils_oo_image_tag_to_rpm_version(include_dash=True) +  '*' }}"
       state: "{{ r_openshift_excluder_docker_package_state }}"
     when:
     - r_openshift_excluder_enable_docker_excluder | bool
@@ -23,7 +23,7 @@
   # https://bugzilla.redhat.com/show_bug.cgi?id=1199432
   - name: Install docker excluder - dnf
     package:
-      name: "{{ r_openshift_excluder_service_type }}-docker-excluder{{ openshift_pkg_version | default('') | oo_image_tag_to_rpm_version(include_dash=True) }}"
+      name: "{{ r_openshift_excluder_service_type }}-docker-excluder{{ openshift_pkg_version | default('') | lib_utils_oo_image_tag_to_rpm_version(include_dash=True) }}"
       state: "{{ r_openshift_excluder_docker_package_state }}"
     when:
     - r_openshift_excluder_enable_docker_excluder | bool
@@ -33,7 +33,7 @@
 
   - name: Install openshift excluder - yum
     package:
-      name: "{{ r_openshift_excluder_service_type }}-excluder{{ openshift_pkg_version | default('') | oo_image_tag_to_rpm_version(include_dash=True) + '*' }}"
+      name: "{{ r_openshift_excluder_service_type }}-excluder{{ openshift_pkg_version | default('') | lib_utils_oo_image_tag_to_rpm_version(include_dash=True) + '*' }}"
       state: "{{ r_openshift_excluder_package_state }}"
     when:
     - r_openshift_excluder_enable_openshift_excluder | bool
@@ -47,7 +47,7 @@
   # https://bugzilla.redhat.com/show_bug.cgi?id=1199432
   - name: Install openshift excluder - dnf
     package:
-      name: "{{ r_openshift_excluder_service_type }}-excluder{{ openshift_pkg_version | default('') | oo_image_tag_to_rpm_version(include_dash=True) }}"
+      name: "{{ r_openshift_excluder_service_type }}-excluder{{ openshift_pkg_version | default('') | lib_utils_oo_image_tag_to_rpm_version(include_dash=True) }}"
       state: "{{ r_openshift_excluder_package_state }}"
     when:
     - r_openshift_excluder_enable_openshift_excluder | bool

+ 1 - 0
roles/openshift_health_checker/meta/main.yml

@@ -1,3 +1,4 @@
 ---
 dependencies:
 - role: openshift_facts
+- role: lib_utils

+ 1 - 1
roles/openshift_hosted/meta/main.yml

@@ -14,4 +14,4 @@ galaxy_info:
 dependencies:
 - role: openshift_facts
 - role: lib_openshift
-- role: lib_os_firewall
+- role: lib_utils

+ 0 - 0
roles/openshift_hosted/tasks/router.yml


Some files were not shown because too many files changed in this diff