summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott Dodson <sdodson@redhat.com>2016-08-09 16:39:10 -0400
committerGitHub <noreply@github.com>2016-08-09 16:39:10 -0400
commitf555b4c341ff96d3c4f6bd86919c1a47b1193b0e (patch)
tree4300cedf15cc9e94c8e35b07199fd7b7a5220276
parent4a87e79b695c08392cebc20135a2e38300863d18 (diff)
parentaf64e08020e94566f27e4f44b48d485b37b236c1 (diff)
downloadopenshift-f555b4c341ff96d3c4f6bd86919c1a47b1193b0e.tar.gz
openshift-f555b4c341ff96d3c4f6bd86919c1a47b1193b0e.tar.bz2
openshift-f555b4c341ff96d3c4f6bd86919c1a47b1193b0e.tar.xz
openshift-f555b4c341ff96d3c4f6bd86919c1a47b1193b0e.zip
Merge pull request #2268 from abutcher/ansible-2.2
Ansible 2.2 Support
-rwxr-xr-xroles/openshift_facts/library/openshift_facts.py37
-rw-r--r--roles/openshift_hosted/tasks/registry/registry.yml2
-rw-r--r--roles/openshift_node/tasks/main.yml16
-rw-r--r--roles/openshift_node/tasks/storage_plugins/main.yml17
-rw-r--r--roles/openshift_repos/files/fedora-openshift-enterprise/gpg_keys/.gitkeep0
-rw-r--r--roles/openshift_repos/files/fedora-openshift-enterprise/repos/.gitkeep0
-rw-r--r--roles/openshift_repos/files/openshift-enterprise/gpg_keys/.gitkeep0
-rw-r--r--roles/openshift_repos/files/openshift-enterprise/repos/.gitkeep0
-rw-r--r--roles/openshift_repos/tasks/main.yaml16
9 files changed, 53 insertions, 35 deletions
diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py
index f89087aea..30cec82ce 100755
--- a/roles/openshift_facts/library/openshift_facts.py
+++ b/roles/openshift_facts/library/openshift_facts.py
@@ -944,7 +944,12 @@ def format_url(use_ssl, hostname, port, path=''):
netloc = hostname
if (use_ssl and port != '443') or (not use_ssl and port != '80'):
netloc += ":%s" % port
- return urlparse.urlunparse((scheme, netloc, path, '', '', ''))
+ try:
+ url = urlparse.urlunparse((scheme, netloc, path, '', '', ''))
+ except AttributeError:
+ # pylint: disable=undefined-variable
+ url = urlunparse((scheme, netloc, path, '', '', ''))
+ return url
def get_current_config(facts):
""" Get current openshift config
@@ -1599,11 +1604,13 @@ class OpenShiftFacts(object):
try:
# ansible-2.1
- # pylint: disable=too-many-function-args
+ # pylint: disable=too-many-function-args,invalid-name
self.system_facts = ansible_facts(module, ['hardware', 'network', 'virtual', 'facter'])
- except TypeError:
- # ansible-1.9.x,ansible-2.0.x
- self.system_facts = ansible_facts(module)
+ for (k, v) in self.system_facts.items():
+ self.system_facts["ansible_%s" % k.replace('-', '_')] = v
+ except UnboundLocalError:
+ # ansible-2.2
+ self.system_facts = get_all_facts(module)['ansible_facts']
self.facts = self.generate_facts(local_facts,
additive_facts_to_overwrite,
@@ -1684,11 +1691,11 @@ class OpenShiftFacts(object):
dict: The generated default facts
"""
defaults = {}
- ip_addr = self.system_facts['default_ipv4']['address']
+ ip_addr = self.system_facts['ansible_default_ipv4']['address']
exit_code, output, _ = module.run_command(['hostname', '-f'])
hostname_f = output.strip() if exit_code == 0 else ''
- hostname_values = [hostname_f, self.system_facts['nodename'],
- self.system_facts['fqdn']]
+ hostname_values = [hostname_f, self.system_facts['ansible_nodename'],
+ self.system_facts['ansible_fqdn']]
hostname = choose_hostname(hostname_values, ip_addr)
defaults['common'] = dict(use_openshift_sdn=True, ip=ip_addr,
@@ -1822,10 +1829,10 @@ class OpenShiftFacts(object):
dict: The generated default facts for the detected provider
"""
# TODO: cloud provider facts should probably be submitted upstream
- product_name = self.system_facts['product_name']
- product_version = self.system_facts['product_version']
- virt_type = self.system_facts['virtualization_type']
- virt_role = self.system_facts['virtualization_role']
+ product_name = self.system_facts['ansible_product_name']
+ product_version = self.system_facts['ansible_product_version']
+ virt_type = self.system_facts['ansible_virtualization_type']
+ virt_role = self.system_facts['ansible_virtualization_role']
provider = None
metadata = None
@@ -2108,12 +2115,16 @@ def main():
additive_facts_to_overwrite=dict(default=[], type='list', required=False),
openshift_env=dict(default={}, type='dict', required=False),
openshift_env_structures=dict(default=[], type='list', required=False),
- protected_facts_to_overwrite=dict(default=[], type='list', required=False),
+ protected_facts_to_overwrite=dict(default=[], type='list', required=False)
),
supports_check_mode=True,
add_file_common_args=True,
)
+ module.params['gather_subset'] = ['hardware', 'network', 'virtual', 'facter']
+ module.params['gather_timeout'] = 10
+ module.params['filter'] = '*'
+
role = module.params['role']
local_facts = module.params['local_facts']
additive_facts_to_overwrite = module.params['additive_facts_to_overwrite']
diff --git a/roles/openshift_hosted/tasks/registry/registry.yml b/roles/openshift_hosted/tasks/registry/registry.yml
index fc037ceda..b28974236 100644
--- a/roles/openshift_hosted/tasks/registry/registry.yml
+++ b/roles/openshift_hosted/tasks/registry/registry.yml
@@ -50,7 +50,9 @@
when: replicas | int > 0
- include: storage/object_storage.yml
+ static: no
when: replicas | int > 0 and openshift.hosted.registry.storage.kind | default(none) == 'object'
- include: storage/persistent_volume.yml
+ static: no
when: replicas | int > 0 and openshift.hosted.registry.storage.kind | default(none) in ['nfs', 'openstack']
diff --git a/roles/openshift_node/tasks/main.yml b/roles/openshift_node/tasks/main.yml
index 889541e25..9c71af6d9 100644
--- a/roles/openshift_node/tasks/main.yml
+++ b/roles/openshift_node/tasks/main.yml
@@ -106,8 +106,20 @@
notify:
- restart node
-- name: Additional storage plugin configuration
- include: storage_plugins/main.yml
+- name: NFS storage plugin configuration
+ include: storage_plugins/nfs.yml
+
+- name: GlusterFS storage plugin configuration
+ include: storage_plugins/glusterfs.yml
+ when: "'glusterfs' in openshift.node.storage_plugin_deps"
+
+- name: Ceph storage plugin configuration
+ include: storage_plugins/ceph.yml
+ when: "'ceph' in openshift.node.storage_plugin_deps"
+
+- name: iSCSI storage plugin configuration
+ include: storage_plugins/iscsi.yml
+ when: "'iscsi' in openshift.node.storage_plugin_deps"
# Necessary because when you're on a node that's also a master the master will be
# restarted after the node restarts docker and it will take up to 60 seconds for
diff --git a/roles/openshift_node/tasks/storage_plugins/main.yml b/roles/openshift_node/tasks/storage_plugins/main.yml
deleted file mode 100644
index fe638718d..000000000
--- a/roles/openshift_node/tasks/storage_plugins/main.yml
+++ /dev/null
@@ -1,17 +0,0 @@
----
-# The NFS storage plugin is always enabled since it doesn't require any
-# additional package dependencies
-- name: NFS storage plugin configuration
- include: nfs.yml
-
-- name: GlusterFS storage plugin configuration
- include: glusterfs.yml
- when: "'glusterfs' in openshift.node.storage_plugin_deps"
-
-- name: Ceph storage plugin configuration
- include: ceph.yml
- when: "'ceph' in openshift.node.storage_plugin_deps"
-
-- name: iSCSI storage plugin configuration
- include: iscsi.yml
- when: "'iscsi' in openshift.node.storage_plugin_deps"
diff --git a/roles/openshift_repos/files/fedora-openshift-enterprise/gpg_keys/.gitkeep b/roles/openshift_repos/files/fedora-openshift-enterprise/gpg_keys/.gitkeep
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/roles/openshift_repos/files/fedora-openshift-enterprise/gpg_keys/.gitkeep
diff --git a/roles/openshift_repos/files/fedora-openshift-enterprise/repos/.gitkeep b/roles/openshift_repos/files/fedora-openshift-enterprise/repos/.gitkeep
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/roles/openshift_repos/files/fedora-openshift-enterprise/repos/.gitkeep
diff --git a/roles/openshift_repos/files/openshift-enterprise/gpg_keys/.gitkeep b/roles/openshift_repos/files/openshift-enterprise/gpg_keys/.gitkeep
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/roles/openshift_repos/files/openshift-enterprise/gpg_keys/.gitkeep
diff --git a/roles/openshift_repos/files/openshift-enterprise/repos/.gitkeep b/roles/openshift_repos/files/openshift-enterprise/repos/.gitkeep
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/roles/openshift_repos/files/openshift-enterprise/repos/.gitkeep
diff --git a/roles/openshift_repos/tasks/main.yaml b/roles/openshift_repos/tasks/main.yaml
index d8e43438a..07a8d28fd 100644
--- a/roles/openshift_repos/tasks/main.yaml
+++ b/roles/openshift_repos/tasks/main.yaml
@@ -34,7 +34,12 @@
path: "/etc/yum.repos.d/{{ item | basename }}"
state: absent
with_fileglob:
- - '*/repos/*'
+ - "fedora-openshift-enterprise/repos/*"
+ - "fedora-origin/repos/*"
+ - "online/repos/*"
+ - "openshift-enterprise/repos/*"
+ - "origin/repos/*"
+ - "removed/repos/*"
when: not openshift.common.is_containerized | bool
and not (item | search("/files/" ~ openshift_deployment_type ~ "/repos"))
and (ansible_os_family == "RedHat" and ansible_distribution != "Fedora")
@@ -42,10 +47,15 @@
- name: Remove any yum repo files for other deployment types Fedora
file:
- path: "/etc/yum.repos.d/{{ item | basename }}"
+ path: "{{ item | basename }}"
state: absent
with_fileglob:
- - '*/repos/*'
+ - "fedora-openshift-enterprise/repos/*"
+ - "fedora-origin/repos/*"
+ - "online/repos/*"
+ - "openshift-enterprise/repos/*"
+ - "origin/repos/*"
+ - "removed/repos/*"
when: not openshift.common.is_containerized | bool
and not (item | search("/files/fedora-" ~ openshift_deployment_type ~ "/repos"))
and (ansible_distribution == "Fedora")