diff options
27 files changed, 367 insertions, 42 deletions
| @@ -11,11 +11,11 @@ they may in the future.  - Install base dependencies:    - Fedora:    ``` -    dnf install -y ansible-1.9.4 pyOpenSSL python-cryptography +    dnf install -y ansible-2.1.0.0 pyOpenSSL python-cryptography    ```     - OSX:    ``` -    # Install ansible 1.9.4 and python 2 +    # Install ansible 2.1.0.0 and python 2      brew install ansible python    ```  - Setup for a specific cloud: diff --git a/README_AEP.md b/README_AEP.md index 1b926f2ab..c588ebbd3 100644 --- a/README_AEP.md +++ b/README_AEP.md @@ -10,7 +10,7 @@  * [Overriding detected ip addresses and hostnames](#overriding-detected-ip-addresses-and-hostnames)  ## Requirements -* ansible 1.9.4 +* ansible 2.1.0.0    * Available in Fedora channels    * Available for EL with EPEL and Optional channel  * One or more RHEL 7.1 VMs diff --git a/filter_plugins/oo_filters.py b/filter_plugins/oo_filters.py index d706d0304..ec00a1646 100644 --- a/filter_plugins/oo_filters.py +++ b/filter_plugins/oo_filters.py @@ -660,7 +660,7 @@ class FilterModule(object):                          if kind == 'nfs':                              host = params['host']                              if host == None: -                                if len(groups['oo_nfs_to_config']) > 0: +                                if 'oo_nfs_to_config' in groups and len(groups['oo_nfs_to_config']) > 0:                                      host = groups['oo_nfs_to_config'][0]                                  else:                                      raise errors.AnsibleFilterError("|failed no storage host detected") diff --git a/openshift-ansible.spec b/openshift-ansible.spec index 822070e43..f70193367 100644 --- a/openshift-ansible.spec +++ b/openshift-ansible.spec @@ -13,7 +13,7 @@ URL:            https://github.com/openshift/openshift-ansible  Source0:        https://github.com/openshift/openshift-ansible/archive/%{commit}/%{name}-%{version}.tar.gz  BuildArch:      noarch -Requires:      ansible >= 1.9.4 +Requires:      ansible >= 2.1.0.0  Requires:      python2  Requires:      openshift-ansible-docs = %{version}-%{release} diff --git a/playbooks/aws/openshift-cluster/config.yml b/playbooks/aws/openshift-cluster/config.yml index 71ce9e787..d6b5700b0 100644 --- a/playbooks/aws/openshift-cluster/config.yml +++ b/playbooks/aws/openshift-cluster/config.yml @@ -6,7 +6,7 @@    - add_host:        name: "{{ item }}"        groups: l_oo_all_hosts -    with_items: g_all_hosts +    with_items: "{{ g_all_hosts | default([]) }}"  - hosts: l_oo_all_hosts    gather_facts: no diff --git a/playbooks/byo/openshift-cluster/config.yml b/playbooks/byo/openshift-cluster/config.yml index c5479d098..3477b2dc4 100644 --- a/playbooks/byo/openshift-cluster/config.yml +++ b/playbooks/byo/openshift-cluster/config.yml @@ -8,7 +8,7 @@    - add_host:        name: "{{ item }}"        groups: l_oo_all_hosts -    with_items: g_all_hosts +    with_items: "{{ g_all_hosts | default([]) }}"  - hosts: l_oo_all_hosts    gather_facts: no diff --git a/playbooks/common/openshift-cluster/evaluate_groups.yml b/playbooks/common/openshift-cluster/evaluate_groups.yml index c5273b08f..3fb42a7fa 100644 --- a/playbooks/common/openshift-cluster/evaluate_groups.yml +++ b/playbooks/common/openshift-cluster/evaluate_groups.yml @@ -35,7 +35,7 @@        groups: oo_all_hosts        ansible_ssh_user: "{{ g_ssh_user | default(omit) }}"        ansible_become: "{{ g_sudo | default(omit) }}" -    with_items: g_all_hosts | default([]) +    with_items: "{{ g_all_hosts | default([]) }}"    - name: Evaluate oo_masters      add_host: diff --git a/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/pre.yml b/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/pre.yml index 7a8dfdf91..a27b62971 100644 --- a/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/pre.yml +++ b/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/pre.yml @@ -87,7 +87,7 @@      # Request openshift_release 3.2 and let the openshift_version role handle converting this      # to a more specific version, respecting openshift_image_tag and openshift_pkg_version if      # defined, and overriding the normal behavior of protecting the installed version -    openshift_release: "3.2" +    openshift_release: "{{ '1.2' if deployment_type == 'origin' else '3.2' }}"      openshift_protect_installed_version: False      # Docker role (a dependency) should be told not to do anything to installed version      # of docker, we handle this separately during upgrade. (the inventory may have a @@ -176,8 +176,12 @@    - name: Verify OpenShift 3.2 RPMs are available for upgrade      fail:        msg: "OpenShift {{ avail_openshift_version.stdout }} is available, but 3.2 or greater is required" -    when: not openshift.common.is_containerized | bool and not avail_openshift_version | skipped and avail_openshift_version.stdout | default('0.0', True) | version_compare('3.2', '<') +    when: deployment_type != 'origin' and not openshift.common.is_containerized | bool and not avail_openshift_version | skipped and avail_openshift_version.stdout | default('0.0', True) | version_compare(openshift_release, '<') +  - name: Verify Origin 1.2 RPMs are available for upgrade +    fail: +      msg: "OpenShift {{ avail_openshift_version.stdout }} is available, but 1.2 or greater is required" +    when: deployment_type == 'origin' and not openshift.common.is_containerized | bool and not avail_openshift_version | skipped and avail_openshift_version.stdout | default('0.0', True) | version_compare(openshift_release, '<')    # TODO: Are these two grep checks necessary anymore?    # Note: the version number is hardcoded here in hopes of catching potential diff --git a/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/upgrade.yml b/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/upgrade.yml index 0ea315d0a..59cedc839 100644 --- a/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/upgrade.yml +++ b/playbooks/common/openshift-cluster/upgrades/v3_1_to_v3_2/upgrade.yml @@ -84,10 +84,10 @@    # Only check if docker upgrade is required if docker_upgrade is not    # already set to False.    - include: ../docker/upgrade_check.yml -    when: docker_upgrade is not defined or docker_upgrade | bool +    when: docker_upgrade is not defined or docker_upgrade | bool and not openshift.common.is_atomic | bool    - include: ../docker/upgrade.yml -    when: l_docker_upgrade is defined and l_docker_upgrade | bool +    when: l_docker_upgrade is defined and l_docker_upgrade | bool and not openshift.common.is_atomic | bool    - include: rpm_upgrade.yml      vars: diff --git a/playbooks/gce/openshift-cluster/config.yml b/playbooks/gce/openshift-cluster/config.yml index 97572b930..8e46c5919 100644 --- a/playbooks/gce/openshift-cluster/config.yml +++ b/playbooks/gce/openshift-cluster/config.yml @@ -9,7 +9,7 @@        groups: l_oo_all_hosts        ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"        ansible_become: "{{ deployment_vars[deployment_type].become }}" -    with_items: g_all_hosts +    with_items: "{{ g_all_hosts | default([]) }}"  - hosts: l_oo_all_hosts    gather_facts: no diff --git a/playbooks/libvirt/openshift-cluster/config.yml b/playbooks/libvirt/openshift-cluster/config.yml index 21d82f422..a28e59a87 100644 --- a/playbooks/libvirt/openshift-cluster/config.yml +++ b/playbooks/libvirt/openshift-cluster/config.yml @@ -10,7 +10,7 @@    - add_host:        name: "{{ item }}"        groups: l_oo_all_hosts -    with_items: g_all_hosts +    with_items: "{{ g_all_hosts | default([]) }}"  - hosts: l_oo_all_hosts    gather_facts: no diff --git a/playbooks/openstack/openshift-cluster/config.yml b/playbooks/openstack/openshift-cluster/config.yml index 6fff31826..1366c83ca 100644 --- a/playbooks/openstack/openshift-cluster/config.yml +++ b/playbooks/openstack/openshift-cluster/config.yml @@ -7,7 +7,7 @@    - add_host:        name: "{{ item }}"        groups: l_oo_all_hosts -    with_items: g_all_hosts +    with_items: "{{ g_all_hosts | default([]) }}"  - hosts: l_oo_all_hosts    gather_facts: no diff --git a/roles/openshift_examples/README.md b/roles/openshift_examples/README.md index 6ddbe7017..8cc479c73 100644 --- a/roles/openshift_examples/README.md +++ b/roles/openshift_examples/README.md @@ -25,7 +25,7 @@ Role Variables  |-------------------------------------|-----------------------------------------------------|------------------------------------------|  | openshift_examples_load_centos      | true when openshift_deployment_typenot 'enterprise' | Load centos image streams                |  | openshift_examples_load_rhel        | true if openshift_deployment_type is 'enterprise'   | Load rhel image streams                  | -| openshift_examples_load_db_templates| true                                                | Loads databcase templates                | +| openshift_examples_load_db_templates| true                                                | Loads database templates                 |  | openshift_examples_load_quickstarts | true                                                | Loads quickstarts ie: nodejs, rails, etc |  | openshift_examples_load_xpaas       | false                                               | Loads xpass streams and templates        | diff --git a/roles/openshift_examples/examples-sync.sh b/roles/openshift_examples/examples-sync.sh index 7b4a8440e..ef2da946a 100755 --- a/roles/openshift_examples/examples-sync.sh +++ b/roles/openshift_examples/examples-sync.sh @@ -29,6 +29,7 @@ unzip cakephp-ex-master.zip  unzip application-templates-master.zip  cp origin-master/examples/db-templates/* ${EXAMPLES_BASE}/db-templates/  cp origin-master/examples/jenkins/jenkins-*template.json ${EXAMPLES_BASE}/quickstart-templates/ +cp origin-master/examples/jenkins/pipeline/jenkinstemplate.json ${EXAMPLES_BASE}/quickstart-templates/  cp origin-master/examples/image-streams/* ${EXAMPLES_BASE}/image-streams/  cp django-ex-master/openshift/templates/* ${EXAMPLES_BASE}/quickstart-templates/  cp rails-ex-master/openshift/templates/* ${EXAMPLES_BASE}/quickstart-templates/ diff --git a/roles/openshift_examples/files/examples/v1.3/image-streams/image-streams-centos7.json b/roles/openshift_examples/files/examples/v1.3/image-streams/image-streams-centos7.json index d971e5e7a..8aedf80fe 100644 --- a/roles/openshift_examples/files/examples/v1.3/image-streams/image-streams-centos7.json +++ b/roles/openshift_examples/files/examples/v1.3/image-streams/image-streams-centos7.json @@ -92,7 +92,7 @@              },              "from": {                "kind": "ImageStreamTag", -              "name": "0.10" +              "name": "4"              }            },            { @@ -109,6 +109,21 @@                "kind": "DockerImage",                "name": "openshift/nodejs-010-centos7:latest"              } +          }, +          { +            "name": "4", +            "annotations": { +              "description": "Build and run NodeJS 4 applications", +              "iconClass": "icon-nodejs", +              "tags": "builder,nodejs", +              "supports":"nodejs:4,nodejs", +              "version": "4", +              "sampleRepo": "https://github.com/openshift/nodejs-ex.git" +            }, +            "from": { +              "kind": "DockerImage", +              "name": "centos/nodejs-4-centos7:latest" +            }            }          ]        } diff --git a/roles/openshift_examples/files/examples/v1.3/quickstart-templates/dancer-mysql.json b/roles/openshift_examples/files/examples/v1.3/quickstart-templates/dancer-mysql.json index bc9c8e8fd..cc7920b7d 100644 --- a/roles/openshift_examples/files/examples/v1.3/quickstart-templates/dancer-mysql.json +++ b/roles/openshift_examples/files/examples/v1.3/quickstart-templates/dancer-mysql.json @@ -207,9 +207,9 @@                    }                  ],                  "resources": { -		      "limits": { -			  "memory": "${MEMORY_LIMIT}" -		      } +                  "limits": { +                    "memory": "${MEMORY_LIMIT}" +                  }                  }                }              ] diff --git a/roles/openshift_examples/files/examples/v1.3/quickstart-templates/django-postgresql.json b/roles/openshift_examples/files/examples/v1.3/quickstart-templates/django-postgresql.json index 0b7fd7cab..7d1dea11b 100644 --- a/roles/openshift_examples/files/examples/v1.3/quickstart-templates/django-postgresql.json +++ b/roles/openshift_examples/files/examples/v1.3/quickstart-templates/django-postgresql.json @@ -83,7 +83,7 @@              "from": {                "kind": "ImageStreamTag",                "namespace": "${NAMESPACE}", -              "name": "python:3.4" +              "name": "python:3.5"              },              "env": [                { @@ -273,7 +273,7 @@                "from": {                  "kind": "ImageStreamTag",                  "namespace": "${NAMESPACE}", -                "name": "postgresql:9.4" +                "name": "postgresql:9.5"                }              }            }, diff --git a/roles/openshift_examples/files/examples/v1.3/quickstart-templates/django.json b/roles/openshift_examples/files/examples/v1.3/quickstart-templates/django.json index 9e84e27e1..1c2e40d70 100644 --- a/roles/openshift_examples/files/examples/v1.3/quickstart-templates/django.json +++ b/roles/openshift_examples/files/examples/v1.3/quickstart-templates/django.json @@ -83,7 +83,7 @@              "from": {                "kind": "ImageStreamTag",                "namespace": "${NAMESPACE}", -              "name": "python:3.4" +              "name": "python:3.5"              },              "env": [                { diff --git a/roles/openshift_examples/files/examples/v1.3/quickstart-templates/jenkinstemplate.json b/roles/openshift_examples/files/examples/v1.3/quickstart-templates/jenkinstemplate.json new file mode 100644 index 000000000..325663313 --- /dev/null +++ b/roles/openshift_examples/files/examples/v1.3/quickstart-templates/jenkinstemplate.json @@ -0,0 +1,255 @@ +{ +  "kind": "Template", +  "apiVersion": "v1", +  "metadata": { +    "name": "jenkins", +    "creationTimestamp": null, +    "annotations": { +      "description": "Jenkins service, without persistent storage. WARNING: Any data stored will be lost upon pod destruction. Only use this template for testing", +      "iconClass": "icon-jenkins", +      "tags": "instant-app,jenkins" +    } +  }, +  "objects": [ +    { +      "kind": "Route", +      "apiVersion": "v1", +      "metadata": { +        "name": "jenkins", +        "creationTimestamp": null +      }, +      "spec": { +        "to": { +          "kind": "Service", +          "name": "${JENKINS_SERVICE_NAME}" +        }, +        "tls": { +          "termination": "edge", +          "insecureEdgeTerminationPolicy": "Redirect", +          "certificate": "-----BEGIN CERTIFICATE-----\nMIIDIjCCAgqgAwIBAgIBATANBgkqhkiG9w0BAQUFADCBoTELMAkGA1UEBhMCVVMx\nCzAJBgNVBAgMAlNDMRUwEwYDVQQHDAxEZWZhdWx0IENpdHkxHDAaBgNVBAoME0Rl\nZmF1bHQgQ29tcGFueSBMdGQxEDAOBgNVBAsMB1Rlc3QgQ0ExGjAYBgNVBAMMEXd3\ndy5leGFtcGxlY2EuY29tMSIwIAYJKoZIhvcNAQkBFhNleGFtcGxlQGV4YW1wbGUu\nY29tMB4XDTE1MDExMjE0MTk0MVoXDTE2MDExMjE0MTk0MVowfDEYMBYGA1UEAwwP\nd3d3LmV4YW1wbGUuY29tMQswCQYDVQQIDAJTQzELMAkGA1UEBhMCVVMxIjAgBgkq\nhkiG9w0BCQEWE2V4YW1wbGVAZXhhbXBsZS5jb20xEDAOBgNVBAoMB0V4YW1wbGUx\nEDAOBgNVBAsMB0V4YW1wbGUwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAMrv\ngu6ZTTefNN7jjiZbS/xvQjyXjYMN7oVXv76jbX8gjMOmg9m0xoVZZFAE4XyQDuCm\n47VRx5Qrf/YLXmB2VtCFvB0AhXr5zSeWzPwaAPrjA4ebG+LUo24ziS8KqNxrFs1M\nmNrQUgZyQC6XIe1JHXc9t+JlL5UZyZQC1IfaJulDAgMBAAGjDTALMAkGA1UdEwQC\nMAAwDQYJKoZIhvcNAQEFBQADggEBAFCi7ZlkMnESvzlZCvv82Pq6S46AAOTPXdFd\nTMvrh12E1sdVALF1P1oYFJzG1EiZ5ezOx88fEDTW+Lxb9anw5/KJzwtWcfsupf1m\nV7J0D3qKzw5C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YZAS9G56E4+wIDAQABo1AwTjAdBgNVHQ4EFgQUugLrSJshOBk5TSsU\nANs4+SmJUGwwHwYDVR0jBBgwFoAUugLrSJshOBk5TSsUANs4+SmJUGwwDAYDVR0T\nBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAQEAaMJ33zAMV4korHo5aPfayV3uHoYZ\n1ChzP3eSsF+FjoscpoNSKs91ZXZF6LquzoNezbfiihK4PYqgwVD2+O0/Ty7UjN4S\nqzFKVR4OS/6lCJ8YncxoFpTntbvjgojf1DEataKFUN196PAANc3yz8cWHF4uvjPv\nWkgFqbIjb+7D1YgglNyovXkRDlRZl0LD1OQ0ZWhd4Ge1qx8mmmanoBeYZ9+DgpFC\nj9tQAbS867yeOryNe7sEOIpXAAqK/DTu0hB6+ySsDfMo4piXCc2aA/eI2DCuw08e\nw17Dz9WnupZjVdwTKzDhFgJZMLDqn37HQnT6EemLFqbcR0VPEnfyhDtZIQ==\n-----END CERTIFICATE-----" +        } +      } +    }, +    { +      "kind": "DeploymentConfig", +      "apiVersion": "v1", +      "metadata": { +        "name": "${JENKINS_SERVICE_NAME}", +        "creationTimestamp": null +      }, +      "spec": { +        "strategy": { +          "type": "Recreate" +        }, +        "triggers": [ +          { +            "type": "ImageChange", +            "imageChangeParams": { +              "automatic": true, +              "containerNames": [ +                "jenkins" +              ], +              "from": { +                "kind": "ImageStreamTag", +                "name": "jenkins:1", +                "namespace": "openshift" +              } +            } +          }, +          { +            "type": "ConfigChange" +          } +        ], +        "replicas": 1, +        "selector": { +          "name": "${JENKINS_SERVICE_NAME}" +        }, +        "template": { +          "metadata": { +            "creationTimestamp": null, +            "labels": { +              "name": "${JENKINS_SERVICE_NAME}" +            } +          }, +          "spec": { +            "serviceAccountName": "${JENKINS_SERVICE_NAME}", +            "containers": [ +              { +                "name": "jenkins", +                "image": " ", +                "readinessProbe": { +                  "timeoutSeconds": 3, +                  "initialDelaySeconds": 3, +                  "httpGet": { +                    "path": "/login", +                    "port": 8080 +                  } +                }, +                "livenessProbe": { +                    "timeoutSeconds": 3, +                    "initialDelaySeconds": 120, +                    "httpGet": { +                        "path": "/login", +                        "port": 8080 +                    } +                }, +                "env": [ +                  { +                    "name": "JENKINS_PASSWORD", +                    "value": "${JENKINS_PASSWORD}" +                  }, +                  { +                    "name": "KUBERNETES_MASTER", +                    "value": "https://kubernetes.default:443" +                  }, +                  { +                    "name": "KUBERNETES_TRUST_CERTIFICATES", +                    "value": "true" +                  } +                ], +                "resources": { +                  "limits": { +                    "memory": "${MEMORY_LIMIT}" +                  } +                }, +                "volumeMounts": [ +                  { +                    "name": "${JENKINS_SERVICE_NAME}-data", +                    "mountPath": "/var/lib/jenkins" +                  } +                ], +                "terminationMessagePath": "/dev/termination-log", +                "imagePullPolicy": "IfNotPresent", +                "capabilities": {}, +                "securityContext": { +                  "capabilities": {}, +                  "privileged": false +                } +              } +            ], +            "volumes": [ +              { +                "name": "${JENKINS_SERVICE_NAME}-data", +                "emptyDir": { +                  "medium": "" +                } +              } +            ], +            "restartPolicy": "Always", +            "dnsPolicy": "ClusterFirst" +          } +        } +      } +    }, +    { +      "kind": "ServiceAccount", +        "apiVersion": "v1", +        "metadata": { +            "name": "${JENKINS_SERVICE_NAME}" +        } +    }, +    { +      "kind": "RoleBinding", +      "apiVersion": "v1", +      "metadata": { +          "name": "${JENKINS_SERVICE_NAME}_edit" +      }, +      "groupNames": null, +      "subjects": [ +          { +              "kind": "ServiceAccount", +              "name": "${JENKINS_SERVICE_NAME}" +          } +      ], +      "roleRef": { +          "name": "edit" +      } +    }, +    { +      "kind": "Service", +      "apiVersion": "v1", +      "metadata": { +        "name": "jenkins-jnlp", +        "creationTimestamp": null +      }, +      "spec": { +        "ports": [ +          { +            "name": "agent", +            "protocol": "TCP", +            "port": 50000, +            "targetPort": 50000, +            "nodePort": 0 +          } +        ], +        "selector": { +          "name": "${JENKINS_SERVICE_NAME}" +        }, +        "portalIP": "", +        "type": "ClusterIP", +        "sessionAffinity": "None" +      } +    }, +    { +       "kind": "Service", +       "apiVersion": "v1", +       "metadata": { +         "name": "${JENKINS_SERVICE_NAME}", +         "annotations": { +           "service.alpha.openshift.io/dependencies": "[{\"name\": \"jenkins-jnlp\", \"namespace\": \"\", \"kind\": \"Service\"}]", +           "service.openshift.io/infrastructure": "true" +         }, +         "creationTimestamp": null +       }, +       "spec": { +         "ports": [ +           { +             "name": "web", +             "protocol": "TCP", +             "port": 80, +             "targetPort": 8080, +             "nodePort": 0 +           } +         ], +         "selector": { +           "name": "${JENKINS_SERVICE_NAME}" +         }, +         "portalIP": "", +         "type": "ClusterIP", +         "sessionAffinity": "None" +       } +    } +  ], +  "parameters": [ +    { +      "name": "MEMORY_LIMIT", +      "displayName": "Memory Limit", +      "description": "Maximum amount of memory the container can use.", +      "value": "512Mi" +    }, +    { +      "name": "NAMESPACE", +      "displayName": "Namespace", +      "description": "The OpenShift Namespace where the ImageStream resides.", +      "value": "openshift" +    }, +    { +      "name": "JENKINS_SERVICE_NAME", +      "displayName": "Jenkins Service Name", +      "description": "The name of the OpenShift Service exposed for the Jenkins container.", +      "value": "jenkins" +    }, +    { +      "name": "JENKINS_PASSWORD", +      "displayName": "Jenkins Password", +      "description": "Password for the Jenkins user.", +      "generate": "expression", +      "value": "password" +    } +  ], +  "labels": { +    "template": "jenkins-ephemeral-template" +  } +} diff --git a/roles/openshift_examples/files/examples/v1.3/quickstart-templates/nodejs-mongodb.json b/roles/openshift_examples/files/examples/v1.3/quickstart-templates/nodejs-mongodb.json index b2b9f2478..6ab4a1781 100644 --- a/roles/openshift_examples/files/examples/v1.3/quickstart-templates/nodejs-mongodb.json +++ b/roles/openshift_examples/files/examples/v1.3/quickstart-templates/nodejs-mongodb.json @@ -83,7 +83,7 @@              "from": {                "kind": "ImageStreamTag",                "namespace": "${NAMESPACE}", -              "name": "nodejs:0.10" +              "name": "nodejs:4"              },              "env":  [                { @@ -271,7 +271,7 @@                "from": {                  "kind": "ImageStreamTag",                  "namespace": "${NAMESPACE}", -                "name": "mongodb:2.6" +                "name": "mongodb:3.2"                }              }            }, @@ -322,7 +322,7 @@                    "timeoutSeconds": 1,                    "initialDelaySeconds": 3,                    "exec": { -                    "command": [ "/bin/sh", "-i", "-c", "mongostat --host 127.0.0.1 -u admin -p ${DATABASE_ADMIN_PASSWORD} -n 1 --noheaders"] +                    "command": [ "/bin/sh", "-i", "-c", "mongo 127.0.0.1:27017/$MONGODB_DATABASE -u $MONGODB_USER -p $MONGODB_PASSWORD --eval=\"quit()\""]                    }                  },                  "livenessProbe": { diff --git a/roles/openshift_examples/files/examples/v1.3/quickstart-templates/nodejs.json b/roles/openshift_examples/files/examples/v1.3/quickstart-templates/nodejs.json index 08c7d3106..ec262e4e8 100644 --- a/roles/openshift_examples/files/examples/v1.3/quickstart-templates/nodejs.json +++ b/roles/openshift_examples/files/examples/v1.3/quickstart-templates/nodejs.json @@ -83,7 +83,7 @@              "from": {                "kind": "ImageStreamTag",                "namespace": "${NAMESPACE}", -              "name": "nodejs:0.10" +              "name": "nodejs:4"              },              "env":  [                { diff --git a/roles/openshift_examples/files/examples/v1.3/quickstart-templates/rails-postgresql.json b/roles/openshift_examples/files/examples/v1.3/quickstart-templates/rails-postgresql.json index e64e2feeb..50d60f2bb 100644 --- a/roles/openshift_examples/files/examples/v1.3/quickstart-templates/rails-postgresql.json +++ b/roles/openshift_examples/files/examples/v1.3/quickstart-templates/rails-postgresql.json @@ -83,7 +83,7 @@              "from": {                "kind": "ImageStreamTag",                "namespace": "${NAMESPACE}", -              "name": "ruby:2.2" +              "name": "ruby:2.3"              },              "env": [                { @@ -300,7 +300,7 @@                "from": {                  "kind": "ImageStreamTag",                  "namespace": "${NAMESPACE}", -                "name": "postgresql:9.4" +                "name": "postgresql:9.5"                }              }            }, diff --git a/roles/openshift_examples/tasks/main.yml b/roles/openshift_examples/tasks/main.yml index 7ea39f51e..8d2248578 100644 --- a/roles/openshift_examples/tasks/main.yml +++ b/roles/openshift_examples/tasks/main.yml @@ -1,9 +1,46 @@  --- -- name: Copy openshift examples -  copy: -    src: "examples/{{ content_version }}/" +###################################################################### +# Copying Examples +# +# We used to use the copy module to transfer the openshift examples to +# the remote. Then it started taking more than a minute to transfer +# the files. As noted in the module: +# +#   "The 'copy' module recursively copy facility does not scale to +#   lots (>hundreds) of files." +# +# The `synchronize` module is suggested as an alternative, we can't +# use it either due to changes introduced in Ansible 2.x. +- name: Create local temp dir for OpenShift examples copy +  local_action: command mktemp -d /tmp/openshift-ansible-XXXXXXX +  become: False +  register: copy_examples_mktemp +  run_once: True + +- name: Create tar of OpenShift examples +  local_action: command tar -C "{{ role_path }}/files/examples/{{ content_version }}/" -cvf "{{ copy_examples_mktemp.stdout }}/openshift-examples.tar" . +  become: False +  register: copy_examples_tar + +- name: Create the remote OpenShift examples directory +  file: +    dest: "{{ examples_base }}" +    state: directory +    mode: 0755 + +- name: Unarchive the OpenShift examples on the remote +  unarchive: +    src: "{{ copy_examples_mktemp.stdout }}/openshift-examples.tar"      dest: "{{ examples_base }}/" +- name: Cleanup the OpenShift Examples temp dir +  become: False +  local_action: file dest="{{ copy_examples_mktemp.stdout }}" state=absent + +# Done copying examples +###################################################################### +# Begin image streams +  - name: Modify registry paths if registry_url is not registry.access.redhat.com    shell: >      find {{ examples_base }} -type f | xargs -n 1 sed -i 's|registry.access.redhat.com|{{ registry_host | quote }}|g' diff --git a/roles/openshift_facts/tasks/main.yml b/roles/openshift_facts/tasks/main.yml index c3723672d..2aca35ce1 100644 --- a/roles/openshift_facts/tasks/main.yml +++ b/roles/openshift_facts/tasks/main.yml @@ -1,8 +1,8 @@  --- -- name: Verify Ansible version is greater than or equal to 1.9.4 +- name: Verify Ansible version is greater than or equal to 2.1.0.0    fail: -    msg: "Unsupported ansible version: {{ ansible_version }} found" -  when: not ansible_version.full | version_compare('1.9.4', 'ge') +    msg: "Unsupported ansible version: {{ ansible_version.full }} found" +  when: not ansible_version.full | version_compare('2.1.0.0', 'ge')  - name: Detecting Operating System    stat: diff --git a/roles/openshift_hosted/tasks/router/router.yml b/roles/openshift_hosted/tasks/router/router.yml index c011db762..dfea8ca4b 100644 --- a/roles/openshift_hosted/tasks/router/router.yml +++ b/roles/openshift_hosted/tasks/router/router.yml @@ -9,10 +9,15 @@      module: slurp      src: "{{ item }}"    register: openshift_router_certificate_output +  # Defaulting dictionary keys to none to avoid deprecation warnings +  # (future fatal errors) during template evaluation. Dictionary keys +  # won't be accessed unless openshift_hosted_router_certificate is +  # defined and has all keys (certfile, keyfile, cafile) which we +  # check above.    with_items: -  - "{{ openshift_hosted_router_certificate.certfile }}" -  - "{{ openshift_hosted_router_certificate.keyfile }}" -  - "{{ openshift_hosted_router_certificate.cafile }}" +  - "{{ (openshift_hosted_router_certificate | default({'certfile':none})).certfile }}" +  - "{{ (openshift_hosted_router_certificate | default({'keyfile':none})).keyfile }}" +  - "{{ (openshift_hosted_router_certificate | default({'cafile':none})).cafile }}"    when: openshift_hosted_router_certificate is defined  - name: Persist certificate contents @@ -27,7 +32,7 @@      content: "{{ openshift.hosted.router.certificate.contents }}"      dest: "{{ openshift_master_config_dir }}/openshift-router.pem"      mode: 0600 -  when: openshift.hosted.router.certificate | default(none) is not none +  when: "'certificate' in openshift.hosted.router and 'contents' in openshift.hosted.router.certificate"  - name: Retrieve list of openshift nodes matching router selector    command: > @@ -48,7 +53,7 @@      {% if replicas > 1 -%}      --replicas={{ replicas }}      {% endif -%} -    {% if openshift.hosted.router.certificate | default(none) is not none -%} +    {% if 'certificate' in openshift.hosted.router and 'contents' in openshift.hosted.router.certificate -%}      --default-cert={{ openshift_master_config_dir }}/openshift-router.pem      {% endif -%}      --namespace={{ openshift.hosted.router.namespace | default('default') }} diff --git a/roles/openshift_version/tasks/main.yml b/roles/openshift_version/tasks/main.yml index 0a134f557..6e5d2b22c 100644 --- a/roles/openshift_version/tasks/main.yml +++ b/roles/openshift_version/tasks/main.yml @@ -76,5 +76,12 @@  # We can't map an openshift_release to full rpm version like we can with containers, make sure  # the rpm version we looked up matches the release requested and error out if not.  - fail: -    msg: "Detected openshift version {{ openshift_version }} does not match requested openshift_release {{ openshift_release }}. You may need to adjust your yum repositories or specify an exact openshift_pkg_version." +    msg: "Detected OpenShift version {{ openshift_version }} does not match requested openshift_release {{ openshift_release }}. You may need to adjust your yum repositories, inventory, or run the appropriate OpenShift upgrade playbook."    when: not is_containerized | bool and openshift_release is defined and not openshift_version.startswith(openshift_release) | bool + +# The end result of these three variables is quite important so make sure they are displayed and logged: +- debug: var=openshift_release + +- debug: var=openshift_image_tag + +- debug: var=openshift_pkg_version diff --git a/utils/src/ooinstall/openshift_ansible.py b/utils/src/ooinstall/openshift_ansible.py index 8f7cf07e7..352955026 100644 --- a/utils/src/ooinstall/openshift_ansible.py +++ b/utils/src/ooinstall/openshift_ansible.py @@ -164,7 +164,8 @@ def write_inventory_vars(base_inventory, multiple_masters, proxy):      for name, role_obj in CFG.deployment.roles.iteritems():          if role_obj.variables: -            base_inventory.write("{}:vars".format(name)) +            group_name = ROLES_TO_GROUPS_MAP.get(name, name) +            base_inventory.write("\n[{}:vars]\n".format(group_name))              for variable, value in role_obj.variables.iteritems():                  inventory_var = VARIABLES_MAP.get(variable, variable)                  if value: | 
