From 745f618fee98485b951cf35f09ccb185b7247d77 Mon Sep 17 00:00:00 2001 From: Christopher Chase Date: Mon, 15 May 2017 14:48:29 -0400 Subject: [PATCH 01/21] Added docker_org_name. (#45) Set reset variable based on script. Removed some unneeded demo specific vars. Added source of my_vars for user specific variables. --- ansible/group_vars/all.yml | 3 --- .../roles/ansible_service_broker_setup/tasks/main.yml | 10 ++++++++-- local/.gitignore | 1 + local/common_vars | 2 +- local/reset_environment.sh | 2 ++ local/run_setup_local.sh | 2 ++ 6 files changed, 14 insertions(+), 6 deletions(-) create mode 100644 local/.gitignore diff --git a/ansible/group_vars/all.yml b/ansible/group_vars/all.yml index 56e040d..33d0519 100644 --- a/ansible/group_vars/all.yml +++ b/ansible/group_vars/all.yml @@ -76,9 +76,6 @@ oadm_cmd: "{{ oc_client_install_path }}/oadm" kubectl_cmd: "{{ oc_client_install_path }}/kubectl" -dockerhub_user_name: "foo" -dockerhub_user_password: "foo" - deploy_rds_demo_instance: true aws_sec_group_name: "{{ aws_tag_prefix }}_security_group" diff --git a/ansible/roles/ansible_service_broker_setup/tasks/main.yml b/ansible/roles/ansible_service_broker_setup/tasks/main.yml index a3c9bab..f455359 100644 --- a/ansible/roles/ansible_service_broker_setup/tasks/main.yml +++ b/ansible/roles/ansible_service_broker_setup/tasks/main.yml @@ -4,7 +4,7 @@ git: repo: https://github.com/fusor/ansible-service-broker.git dest: "{{ asb_src_dir }}" - version: "demo" + version: "master" register: git_clone_asb - name: Install asbcli requirements @@ -22,7 +22,13 @@ register: oc_get_projects_asb - name: Use asbcli up to install Ansible Service Broker - shell: "./asbcli up {{ openshift_url }} --cluster-user={{ cluster_user }} --cluster-pass={{ cluster_user_password }} --dockerhub-user={{ dockerhub_user_name }} --dockerhub-pass={{ dockerhub_user_password }}" + shell: > + ./asbcli up {{ openshift_url }} + --cluster-user={{ cluster_user }} + --cluster-pass={{ cluster_user_password }} + --dockerhub-user={{ dockerhub_user_name }} + --dockerhub-pass={{ dockerhub_user_password }} + --dockerhub-org={{ dockerhub_org_name }} args: chdir: "{{ asb_src_dir }}/scripts/asbcli" retries: 2 diff --git a/local/.gitignore b/local/.gitignore new file mode 100644 index 0000000..90de3d7 --- /dev/null +++ b/local/.gitignore @@ -0,0 +1 @@ +my_vars diff --git a/local/common_vars b/local/common_vars index 704211b..a858fae 100644 --- a/local/common_vars +++ b/local/common_vars @@ -2,4 +2,4 @@ export CLUSTER_IP="$(ifconfig docker0 | grep inet | awk '{print $2}' | head -1)" export OPENSHIFT_HOSTNAME="${CLUSTER_IP}.nip.io" -export EXTRA_VARS="{\"ec2_install\":False, \"use_ssl\":False, \"openshift_hostname\":\"${OPENSHIFT_HOSTNAME}\"}" +export EXTRA_VARS="{\"remove_docker_images\":${RESET_ENV}, \"ec2_install\":False, \"use_ssl\":False, \"openshift_hostname\":\"${OPENSHIFT_HOSTNAME}\", \"dockerhub_user_name\":\"${DOCKERHUB_USER_NAME}\", \"dockerhub_user_password\":\"${DOCKERHUB_USER_PASSWORD}\", \"dockerhub_org_name\":\"${DOCKERHUB_ORG_NAME}\"}" diff --git a/local/reset_environment.sh b/local/reset_environment.sh index a6d90f3..2345a5c 100755 --- a/local/reset_environment.sh +++ b/local/reset_environment.sh @@ -1,5 +1,7 @@ #!/bin/sh +export RESET_ENV="True" ANS_CODE="../ansible" +source ./my_vars source ./common_vars ansible-playbook ${ANS_CODE}/reset_local_environment.yml --extra-vars "${EXTRA_VARS}" diff --git a/local/run_setup_local.sh b/local/run_setup_local.sh index 7f26d86..95ccc36 100755 --- a/local/run_setup_local.sh +++ b/local/run_setup_local.sh @@ -1,5 +1,7 @@ #!/bin/sh +export RESET_ENV="False" ANS_CODE="../ansible" +source ./my_vars source ./common_vars ansible-playbook ${ANS_CODE}/setup_local_environment.yml --extra-vars "${EXTRA_VARS}" From b7688a947964b7acdff02585dc684cd1d81f75f5 Mon Sep 17 00:00:00 2001 From: John Matthews Date: Fri, 12 May 2017 17:20:48 -0400 Subject: [PATCH 02/21] WIP for mac support, working up to launching ASB --- ansible/group_vars/all.yml | 2 + ansible/library/inventory/docker-machine.py | 49 ++++++++++ ansible/reset_mac_environment.yml | 22 +++++ ansible/roles/openshift_setup/tasks/main.yml | 91 +++++-------------- .../service_catalog_setup/tasks/main.yml | 6 +- ansible/setup_mac_environment.yml | 21 +++++ local/{ => linux}/README.md | 0 local/{ => linux}/common_vars | 0 local/{ => linux}/reset_environment.sh | 0 local/{ => linux}/run_setup_local.sh | 0 local/mac/README.md | 77 ++++++++++++++++ local/mac/common_vars | 5 + local/mac/reset_environment.sh | 5 + local/mac/run_mac_local.sh | 5 + 14 files changed, 214 insertions(+), 69 deletions(-) create mode 100755 ansible/library/inventory/docker-machine.py create mode 100644 ansible/reset_mac_environment.yml create mode 100644 ansible/setup_mac_environment.yml rename local/{ => linux}/README.md (100%) rename local/{ => linux}/common_vars (100%) rename local/{ => linux}/reset_environment.sh (100%) rename local/{ => linux}/run_setup_local.sh (100%) create mode 100644 local/mac/README.md create mode 100644 local/mac/common_vars create mode 100755 local/mac/reset_environment.sh create mode 100755 local/mac/run_mac_local.sh diff --git a/ansible/group_vars/all.yml b/ansible/group_vars/all.yml index 33d0519..657ff33 100644 --- a/ansible/group_vars/all.yml +++ b/ansible/group_vars/all.yml @@ -75,6 +75,8 @@ oc_cmd: "{{ oc_client_install_path }}/oc" oadm_cmd: "{{ oc_client_install_path }}/oadm" kubectl_cmd: "{{ oc_client_install_path }}/kubectl" +oc_host_config_dir: /docker_shared/origin +#oc_host_config_dir: /var/lib/origin/openshift.local.config deploy_rds_demo_instance: true diff --git a/ansible/library/inventory/docker-machine.py b/ansible/library/inventory/docker-machine.py new file mode 100755 index 0000000..8e9c094 --- /dev/null +++ b/ansible/library/inventory/docker-machine.py @@ -0,0 +1,49 @@ +#!/usr/bin/env python +# +# Original code from 'nathanleclaire' +# https://raw.githubusercontent.com/nathanleclaire/dockerfiles/master/ansible/machine.py +# +""" +Example Usage: +$ ansible -i machine.py machinename -m ping +""" + + +import argparse +import subprocess + +try: + import json +except ImportError: + import simplejson as json + +def dm(*args): + return subprocess.check_output(["docker-machine"] + list(args)).strip() + +def dminspect(fmt, mcn): + return dm("inspect", "-f", fmt, mcn) + +def get_host_and_vars(m): + hosts = [dminspect("{{.Driver.IPAddress}}", m)] + ssh_vars = { + "ansible_ssh_user": dminspect("{{.Driver.SSHUser}}", m), + "ansible_ssh_port": dminspect("{{.Driver.SSHPort}}", m), + "ansible_ssh_private_key_file": dminspect("{{.Driver.SSHKeyPath}}", m) + } + data = {"hosts": hosts, "vars": ssh_vars} + return data + +class DockerMachineInventory(object): + def __init__(self): + self.inventory = {} # Ansible Inventory + + parser = argparse.ArgumentParser(description='Produce an Ansible Inventory file based on Docker Machine status') + parser.add_argument('--list', action='store_true', help='List all active Droplets as Ansible inventory (default: True)') + self.args = parser.parse_args() + + machines = dm("ls", "-q").splitlines() + json_data = {m: get_host_and_vars(m) for m in machines} + + print json.dumps(json_data) + +DockerMachineInventory() diff --git a/ansible/reset_mac_environment.yml b/ansible/reset_mac_environment.yml new file mode 100644 index 0000000..1b57c20 --- /dev/null +++ b/ansible/reset_mac_environment.yml @@ -0,0 +1,22 @@ +- hosts: localhost + gather_facts: True + tasks: + roles: + - { role: openshift_setup, reset_cluster: True } + - service_catalog_setup + - ansible_service_broker_setup + - local_demo_prep + - env_hacks + post_tasks: + - set_fact: + msg: | + Hostname: {{ openshift_hostname }} + Next steps: + 1) Visit https://apiserver-service-catalog.{{ openshift_hostname }} + 2) Accept the certificate + 3) Visit https://{{ openshift_hostname }}:8443 for the console + OR + For CLI access: + oc login --insecure-skip-tls-verify {{ openshift_hostname }}:8443 -u {{ cluster_user }} -p {{ cluster_user_password }} + - debug: + msg: "{{ msg.split('\n') }}" diff --git a/ansible/roles/openshift_setup/tasks/main.yml b/ansible/roles/openshift_setup/tasks/main.yml index 383cab1..19f2020 100644 --- a/ansible/roles/openshift_setup/tasks/main.yml +++ b/ansible/roles/openshift_setup/tasks/main.yml @@ -119,9 +119,9 @@ - "{{ docker_images_group1 }}" - "{{ docker_images_group2 }}" - - name: Remove /var/lib/origin/openshift.local.config/master/master-config.yaml when resetting cluster + - name: Remove {{ oc_host_config_dir }}/master/master-config.yaml when resetting cluster file: - path: /var/lib/origin/openshift.local.config/master/master-config.yaml + path: "{{ oc_host_config_dir }}/master/master-config.yaml" state: absent become: true when: reset_cluster @@ -129,11 +129,11 @@ # When reset_cluster is True we do not want to have to wait for the extra oc cluster up/down if it's not required # so we are checking to see if the master-config.yaml exists, if it's there we will skip the extra oc cluster up/down - stat: - path: /var/lib/origin/openshift.local.config/master/master-config.yaml + path: "{{ oc_host_config_dir }}/master/master-config.yaml" register: master_config_stat - stat: - path: /var/lib/origin/openshift.local.config/console-fullchain.pem + path: "{{ oc_host_config_dir }}/console-fullchain.pem" register: console_ssl_stat - name: Set a fact to tell if SSL was previously configured and now disabled @@ -154,6 +154,7 @@ oc_cluster_up_first_run: True when: "not 'cluster was started' in oc_cluster_status.stdout" + # Intent of this oc cluster up is generate the master-config.yaml so we can make edits to it - name: Run oc cluster up shell: "{{ oc_cmd }} cluster up --routing-suffix={{ openshift_hostname }} --public-hostname={{ openshift_hostname }} --host-pv-dir={{ persistedvol_mount_point }} --version=summit --image=docker.io/ansibleplaybookbundle/origin" when: (oc_cluster_up_first_run and not master_config_stat.stat.exists) or ssl_changed is defined @@ -171,17 +172,6 @@ when: not ec2_install # Intent of this oc cluster up is generate the master-config.yaml so we can make edits to it - - set_fact: - base_oc_cluster_cmd_line: "--routing-suffix={{ openshift_hostname }} --public-hostname={{ openshift_hostname }} --host-pv-dir={{ persistedvol_mount_point }} --version=summit --image=docker.io/ansibleplaybookbundle/origin" - - - set_fact: - oc_cluster_cmd_line: "{{ base_oc_cluster_cmd_line }} --create-machine" - when: ansible_os_family == "Darwin" - - - set_fact: - oc_cluster_cmd_line: "{{ base_oc_cluster_cmd_line }}" - when: ansible_os_family == "RedHat" - - name: Run oc cluster down shell: "{{ oc_cmd }} cluster down" when: (oc_cluster_up_first_run and not master_config_stat.stat.exists) or ssl_changed is defined @@ -190,7 +180,7 @@ copy: remote_src: True src: /tmp/console-fullchain.pem - dest: /var/lib/origin/openshift.local.config/console-fullchain.pem + dest: "{{ oc_host_config_dir }}/console-fullchain.pem" owner: root group: root mode: 0644 @@ -200,7 +190,7 @@ copy: remote_src: True src: /tmp/console-privkey.pem - dest: /var/lib/origin/openshift.local.config/console-privkey.pem + dest: "{{ oc_host_config_dir }}/console-privkey.pem" owner: root group: root mode: 0644 @@ -210,7 +200,7 @@ copy: remote_src: True src: /tmp/apiserver-fullchain.pem - dest: /var/lib/origin/openshift.local.config/apiserver-fullchain.pem + dest: "{{ oc_host_config_dir }}/apiserver-fullchain.pem" owner: root group: root mode: 0644 @@ -220,7 +210,7 @@ copy: remote_src: True src: /tmp/apiserver-privkey.pem - dest: /var/lib/origin/openshift.local.config/apiserver-privkey.pem + dest: "{{ oc_host_config_dir }}/apiserver-privkey.pem" owner: root group: root mode: 0644 @@ -229,61 +219,61 @@ - name: Add extension script to oc config to talk to svc catalog template: src: extension.j2 - dest: /var/lib/origin/openshift.local.config/extension.js - owner: root - group: root + dest: "{{ oc_host_config_dir }}/extension.js" + #owner: root + #group: root mode: 0644 register: extension_script_result become: 'true' - name: Edit master-config to allow extension scripts lineinfile: - dest: /var/lib/origin/openshift.local.config/master/master-config.yaml + dest: "{{ oc_host_config_dir }}/master/master-config.yaml" regexp: "extensionDevelopment:" line: " extensionDevelopment: true" become: 'true' - name: Add extension script to assetConfig lineinfile: - dest: /var/lib/origin/openshift.local.config/master/master-config.yaml + dest: "{{ oc_host_config_dir }}/master/master-config.yaml" insertafter: "extensionScripts: null" line: " - /var/lib/origin/openshift.local.config/extension.js" become: 'true' - name: Edit master-config to add extension script lineinfile: - dest: /var/lib/origin/openshift.local.config/master/master-config.yaml + dest: "{{ oc_host_config_dir }}/master/master-config.yaml" regexp: "extensionScripts: null" line: " extensionScripts:" become: 'true' - name: Add SSL cert to namedCertificates lineinfile: - dest: /var/lib/origin/openshift.local.config/master/master-config.yaml + dest: "{{ oc_host_config_dir }}/master/master-config.yaml" insertafter: "namedCertificates: null" - line: " - certFile: /var/lib/origin/openshift.local.config/console-fullchain.pem" + line: " - certFile: {{ oc_host_config_dir }}/console-fullchain.pem" when: use_ssl == True become: 'true' - name: Add SSL cert to namedCertificates lineinfile: - dest: /var/lib/origin/openshift.local.config/master/master-config.yaml - insertafter: "certFile: /var/lib/origin/openshift.local.config/console-fullchain.pem" - line: " keyFile: /var/lib/origin/openshift.local.config/console-privkey.pem" + dest: "{{ oc_host_config_dir }}/master/master-config.yaml" + insertafter: "certFile: {{ oc_host_config_dir }}/console-fullchain.pem" + line: " keyFile: {{ oc_host_config_dir }}/console-privkey.pem" when: use_ssl == True become: 'true' - name: Add SSL cert to namedCertificates lineinfile: - dest: /var/lib/origin/openshift.local.config/master/master-config.yaml - insertafter: "keyFile: /var/lib/origin/openshift.local.config/console-privkey.pem" + dest: "{{ oc_host_config_dir }}/master/master-config.yaml" + insertafter: "keyFile: {{ oc_host_config_dir }}/console-privkey.pem" line: " names:" when: use_ssl == True become: 'true' - name: Add SSL cert to namedCertificates lineinfile: - dest: /var/lib/origin/openshift.local.config/master/master-config.yaml + dest: "{{ oc_host_config_dir }}/master/master-config.yaml" insertafter: "names:" line: " - \"apiserver-service-catalog.{{ openshift_hostname }}\"" when: use_ssl == True @@ -291,7 +281,7 @@ - name: Add SSL cert to namedCertificates lineinfile: - dest: /var/lib/origin/openshift.local.config/master/master-config.yaml + dest: "{{ oc_host_config_dir }}/master/master-config.yaml" insertafter: "names:" line: " - \"{{ openshift_hostname }}\"" when: use_ssl == True @@ -299,43 +289,12 @@ - name: Edit master-config to allow SSL cert lineinfile: - dest: /var/lib/origin/openshift.local.config/master/master-config.yaml + dest: "{{ oc_host_config_dir }}/master/master-config.yaml" regexp: "namedCertificates: null" line: " namedCertificates:" when: use_ssl == True become: 'true' - - name: Add extension script to oc config to talk to svc catalog - template: - src: extension.j2 - dest: /var/lib/origin/openshift.local.config/extension.js - owner: root - group: root - mode: 0644 - become: 'true' - register: extension_script_result - - - name: Edit master-config to allow extension scripts - lineinfile: - dest: /var/lib/origin/openshift.local.config/master/master-config.yaml - regexp: "extensionDevelopment:" - line: " extensionDevelopment: true" - become: 'true' - - - name: Add extension script to assetConfig - lineinfile: - dest: /var/lib/origin/openshift.local.config/master/master-config.yaml - insertafter: "extensionScripts: null" - line: " - /var/lib/origin/openshift.local.config/extension.js" - become: 'true' - - - name: Edit master-config to add extension script - lineinfile: - dest: /var/lib/origin/openshift.local.config/master/master-config.yaml - regexp: "extensionScripts: null" - line: " extensionScripts:" - become: 'true' - - name: Run oc cluster up shell: "{{ oc_cmd }} cluster up --routing-suffix={{ openshift_hostname }} --public-hostname={{ openshift_hostname }} --host-pv-dir={{ persistedvol_mount_point }} --version=summit --image=docker.io/ansibleplaybookbundle/origin --host-config-dir=/var/lib/origin/openshift.local.config --use-existing-config" when: oc_cluster_up_first_run diff --git a/ansible/roles/service_catalog_setup/tasks/main.yml b/ansible/roles/service_catalog_setup/tasks/main.yml index 31873eb..9403953 100644 --- a/ansible/roles/service_catalog_setup/tasks/main.yml +++ b/ansible/roles/service_catalog_setup/tasks/main.yml @@ -37,12 +37,12 @@ register: deployment - name: Get SSL credentials - shell: "cat /var/lib/origin/openshift.local.config/apiserver-fullchain.pem" + shell: "cat {{ oc_host_config_dir }}/apiserver-fullchain.pem" register: apiserver_crt_plain when: use_ssl == True - name: Get SSL credentials - shell: "cat /var/lib/origin/openshift.local.config/apiserver-privkey.pem" + shell: "cat {{ oc_host_config_dir }}/apiserver-privkey.pem" register: apiserver_key_plain when: use_ssl == True @@ -117,7 +117,7 @@ src: kubeconfig.templ.yaml.j2 dest: "{{ ansible_env.HOME }}/.kube/service-catalog.config" owner: "{{ ansible_env.USER }}" - group: "{{ ansible_env.USER }}" + #group: "{{ ansible_env.USER }}" mode: 0644 - lineinfile: dest={{ ansible_env.HOME }}/.bashrc line="{{ item }}" create=yes diff --git a/ansible/setup_mac_environment.yml b/ansible/setup_mac_environment.yml new file mode 100644 index 0000000..38ff038 --- /dev/null +++ b/ansible/setup_mac_environment.yml @@ -0,0 +1,21 @@ +- hosts: localhost + gather_facts: True + roles: + - openshift_setup + - service_catalog_setup + - ansible_service_broker_setup + #- local_demo_prep + #- env_hacks + post_tasks: + - set_fact: + msg: | + Hostname: {{ openshift_hostname }} + Next steps: + 1) Visit https://apiserver-service-catalog.{{ openshift_hostname }} + 2) Accept the certificate + 3) Visit https://{{ openshift_hostname }}:8443 for the console + OR + For CLI access: + oc login --insecure-skip-tls-verify {{ openshift_hostname }}:8443 -u {{ cluster_user }} -p {{ cluster_user_password }} + - debug: + msg: "{{ msg.split('\n') }}" diff --git a/local/README.md b/local/linux/README.md similarity index 100% rename from local/README.md rename to local/linux/README.md diff --git a/local/common_vars b/local/linux/common_vars similarity index 100% rename from local/common_vars rename to local/linux/common_vars diff --git a/local/reset_environment.sh b/local/linux/reset_environment.sh similarity index 100% rename from local/reset_environment.sh rename to local/linux/reset_environment.sh diff --git a/local/run_setup_local.sh b/local/linux/run_setup_local.sh similarity index 100% rename from local/run_setup_local.sh rename to local/linux/run_setup_local.sh diff --git a/local/mac/README.md b/local/mac/README.md new file mode 100644 index 0000000..19e20c6 --- /dev/null +++ b/local/mac/README.md @@ -0,0 +1,77 @@ +# CATalogASB Local Deployment + +catasb is a collection of playbooks to create an OpenShift environment with a Service Catalog & Ansible Service Broker in a local environment. + +### Overview +These playbooks will: + * Setup Origin through `oc cluster up` + * Install Service Catalog on Origin + * Install Ansible Service Broker on Origin + +### Pre-Reqs + * Ansible needs to be installed so its source code is available to Python. + * Check to see if Ansible modules are available to Python + $ python -c "import ansible;print(ansible.__version__)" + 2.2.2.0 + * MacOS requires Ansible to be installed from `pip` and not `brew` + $ python -c "import ansible;print(ansible.__version__)" + Traceback (most recent call last): + File "", line 1, in + ImportError: No module named ansible + + brew uninstall ansible + pip install ansible + + $ python -c "import ansible;print(ansible.__version__)" + 2.2.2.0 + * Install python dependencies + * `pip install six` + +### Notes + * $ time oc cluster up --create-machine + * docker-machine create openshift --virtualbox-memory 8096 + * docker-machine rm openshift + * Accessing the VM on OSX running docker: + * screen ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/tty + * Need to downgrade docker + * Error syncing pod, skipping: failed to "StartContainer" for "POD" with RunContainerError: "runContainer: docker: failed to parse docker version \"17.03.1-ce\": illegal zero-prefixed version component \"03\" in \"17.03.1-ce\"" + * https://github.com/openshift/origin/pull/13201 + * https://github.com/docker/for-mac/issues/1491 + + * https://download.docker.com/mac/stable/1.12.6.14937/Docker.dmg + * Then de-select check for updates + + * Insecure Registry setting needed 172.30.0.0/16 + * Shared Folders + * /docker_shared/origin + * /persistedvolumes + + + + +### Execute + * `cd local` + * Edit the variables file `local/common_vars` + * Update: + * CLUSTER_IP if your installation of Docker is not using the default bridge of `docker0` + * `./run_setup_local.sh` + * Sets up OpenShift + * In Web Browser + * Visit: `https://apiserver-service-catalog.CLUSTERIP.nip.io` + * Accept the certificate + * You will see some text on the screen, ignore this and proceed to the main openshift URL next + * Point of this step is just to accept the SSL cert for the apiserver-service-catalog endpoint + * Visit: `https://CLUSTERIP.nip.io:8443` + +### Cleanup + +To terminate the local instance run the below + * `oc cluster down` + +To reset the environment to a clean instance of origin with ASB and Service Catalog run the below + * `cd local` + * `./reset_environment.sh` + +### Tested with + * ansible 2.2.2.0 & 2.3.0.0 + * Problems were seen using ansible 2.0 diff --git a/local/mac/common_vars b/local/mac/common_vars new file mode 100644 index 0000000..59087f5 --- /dev/null +++ b/local/mac/common_vars @@ -0,0 +1,5 @@ +export CLUSTER_IP="172.17.0.1" + +export OPENSHIFT_HOSTNAME="${CLUSTER_IP}.nip.io" + +export EXTRA_VARS="{\"ec2_install\":False, \"use_ssl\":False, \"oc_host_config_dir\":\"/docker_shared/origin\", \"openshift_hostname\":\"${OPENSHIFT_HOSTNAME}\"}" diff --git a/local/mac/reset_environment.sh b/local/mac/reset_environment.sh new file mode 100755 index 0000000..2531e8e --- /dev/null +++ b/local/mac/reset_environment.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +ANS_CODE="../../ansible" +source ./common_vars +ansible-playbook -vvv ${ANS_CODE}/reset_mac_environment.yml --extra-vars "${EXTRA_VARS}" diff --git a/local/mac/run_mac_local.sh b/local/mac/run_mac_local.sh new file mode 100755 index 0000000..fffdcfb --- /dev/null +++ b/local/mac/run_mac_local.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +ANS_CODE="../../ansible" +source ./common_vars +ansible-playbook -i ${ANS_CODE}/library/inventory/docker-machine.py ${ANS_CODE}/setup_mac_environment.yml --extra-vars "${EXTRA_VARS}" From 5f89b7dcfda4de715a7e607cd1b4755e9c11af69 Mon Sep 17 00:00:00 2001 From: John Matthews Date: Fri, 19 May 2017 17:25:17 -0400 Subject: [PATCH 03/21] WIP --- local/mac/common_vars | 4 ++-- local/mac/reset_environment.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/local/mac/common_vars b/local/mac/common_vars index 59087f5..e1f6d39 100644 --- a/local/mac/common_vars +++ b/local/mac/common_vars @@ -1,5 +1,5 @@ -export CLUSTER_IP="172.17.0.1" +export CLUSTER_IP="127.0.0.1" export OPENSHIFT_HOSTNAME="${CLUSTER_IP}.nip.io" -export EXTRA_VARS="{\"ec2_install\":False, \"use_ssl\":False, \"oc_host_config_dir\":\"/docker_shared/origin\", \"openshift_hostname\":\"${OPENSHIFT_HOSTNAME}\"}" +export EXTRA_VARS="{\"ec2_install\":False, \"use_ssl\":False, \"oc_host_config_dir\":\"/docker_shared/origin\", \"openshift_hostname\":\"${OPENSHIFT_HOSTNAME}\", \"dockerhub_user_name\":\"${DOCKERHUB_USER_NAME}\", \"dockerhub_user_password\":\"${DOCKERHUB_USER_PASSWORD}\", \"dockerhub_org_name\":\"${DOCKERHUB_ORG_NAME}\" }" diff --git a/local/mac/reset_environment.sh b/local/mac/reset_environment.sh index 2531e8e..3c05b46 100755 --- a/local/mac/reset_environment.sh +++ b/local/mac/reset_environment.sh @@ -2,4 +2,4 @@ ANS_CODE="../../ansible" source ./common_vars -ansible-playbook -vvv ${ANS_CODE}/reset_mac_environment.yml --extra-vars "${EXTRA_VARS}" +ansible-playbook ${ANS_CODE}/reset_mac_environment.yml --extra-vars "${EXTRA_VARS}" From 035324326dfa354db0d30bab03d06d3ed9f1a72c Mon Sep 17 00:00:00 2001 From: John Matthews Date: Sat, 20 May 2017 12:29:21 -0400 Subject: [PATCH 04/21] WIP - At point of asb is up but not connect to service catalog. Next Issue to fix is that we need to run kubectl against the apiserver for service catalog. the kubectl runs from our mac host using ~/.kube/service-config The address we have in there is 172.17.0.3 which our host is not able to see. One thought is to execute this command inside of the container for ASB itself instead of from the MAC. Other thought is to change the apiserver for svc cat setup and use an authenticated endpoint, at moment we are using an internal endpoint to avoid authentication. --- .../defaults/main.yml | 3 +++ .../tasks/main.yml | 8 +++---- ansible/roles/openshift_setup/tasks/main.yml | 4 ++-- local/mac/README.md | 23 ++++++++----------- local/mac/common_vars | 2 +- local/mac/test_asb_up.sh | 6 +++++ 6 files changed, 26 insertions(+), 20 deletions(-) create mode 100755 local/mac/test_asb_up.sh diff --git a/ansible/roles/ansible_service_broker_setup/defaults/main.yml b/ansible/roles/ansible_service_broker_setup/defaults/main.yml index 1fb745c..0a66537 100644 --- a/ansible/roles/ansible_service_broker_setup/defaults/main.yml +++ b/ansible/roles/ansible_service_broker_setup/defaults/main.yml @@ -1 +1,4 @@ asb_src_dir: /tmp/ansible-service-broker +dockerhub_user_name: changeme +dockerhub_user_password: changeme +asbcli_openshift_url: https://172.17.0.1.nip.io:8443 diff --git a/ansible/roles/ansible_service_broker_setup/tasks/main.yml b/ansible/roles/ansible_service_broker_setup/tasks/main.yml index f455359..1b7e407 100644 --- a/ansible/roles/ansible_service_broker_setup/tasks/main.yml +++ b/ansible/roles/ansible_service_broker_setup/tasks/main.yml @@ -4,7 +4,7 @@ git: repo: https://github.com/fusor/ansible-service-broker.git dest: "{{ asb_src_dir }}" - version: "master" + version: "demo" register: git_clone_asb - name: Install asbcli requirements @@ -23,12 +23,12 @@ - name: Use asbcli up to install Ansible Service Broker shell: > - ./asbcli up {{ openshift_url }} + ./asbcli up {{ asbcli_openshift_url }} --cluster-user={{ cluster_user }} --cluster-pass={{ cluster_user_password }} --dockerhub-user={{ dockerhub_user_name }} --dockerhub-pass={{ dockerhub_user_password }} - --dockerhub-org={{ dockerhub_org_name }} + args: chdir: "{{ asb_src_dir }}/scripts/asbcli" retries: 2 @@ -75,7 +75,7 @@ src: ansible_service_broker.yaml.j2 dest: /tmp/ansible_service_broker.yaml owner: "{{ ansible_env.USER }}" - group: "{{ ansible_env.USER }}" + #group: "{{ ansible_env.USER }}" mode: 0644 register: ansible_service_broker_template diff --git a/ansible/roles/openshift_setup/tasks/main.yml b/ansible/roles/openshift_setup/tasks/main.yml index 19f2020..3e55d07 100644 --- a/ansible/roles/openshift_setup/tasks/main.yml +++ b/ansible/roles/openshift_setup/tasks/main.yml @@ -156,7 +156,7 @@ # Intent of this oc cluster up is generate the master-config.yaml so we can make edits to it - name: Run oc cluster up - shell: "{{ oc_cmd }} cluster up --routing-suffix={{ openshift_hostname }} --public-hostname={{ openshift_hostname }} --host-pv-dir={{ persistedvol_mount_point }} --version=summit --image=docker.io/ansibleplaybookbundle/origin" + shell: "{{ oc_cmd }} cluster up --routing-suffix={{ openshift_hostname }} --public-hostname={{ openshift_hostname }} --host-pv-dir={{ persistedvol_mount_point }} --version=summit --image=docker.io/ansibleplaybookbundle/origin --host-config-dir={{ oc_host_config_dir }}" when: (oc_cluster_up_first_run and not master_config_stat.stat.exists) or ssl_changed is defined - debug: @@ -296,7 +296,7 @@ become: 'true' - name: Run oc cluster up - shell: "{{ oc_cmd }} cluster up --routing-suffix={{ openshift_hostname }} --public-hostname={{ openshift_hostname }} --host-pv-dir={{ persistedvol_mount_point }} --version=summit --image=docker.io/ansibleplaybookbundle/origin --host-config-dir=/var/lib/origin/openshift.local.config --use-existing-config" + shell: "{{ oc_cmd }} cluster up --routing-suffix={{ openshift_hostname }} --public-hostname={{ openshift_hostname }} --host-pv-dir={{ persistedvol_mount_point }} --version=summit --image=docker.io/ansibleplaybookbundle/origin --host-config-dir={{ oc_host_config_dir }} --use-existing-config" when: oc_cluster_up_first_run register: oc_cluster_up # diff --git a/local/mac/README.md b/local/mac/README.md index 19e20c6..dc7ee0c 100644 --- a/local/mac/README.md +++ b/local/mac/README.md @@ -28,25 +28,22 @@ These playbooks will: * `pip install six` ### Notes - * $ time oc cluster up --create-machine - * docker-machine create openshift --virtualbox-memory 8096 - * docker-machine rm openshift * Accessing the VM on OSX running docker: * screen ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/tty * Need to downgrade docker - * Error syncing pod, skipping: failed to "StartContainer" for "POD" with RunContainerError: "runContainer: docker: failed to parse docker version \"17.03.1-ce\": illegal zero-prefixed version component \"03\" in \"17.03.1-ce\"" - * https://github.com/openshift/origin/pull/13201 - * https://github.com/docker/for-mac/issues/1491 + * Error syncing pod, skipping: failed to "StartContainer" for "POD" with RunContainerError: "runContainer: docker: failed to parse docker version \"17.03.1-ce\": illegal zero-prefixed version component \"03\" in \"17.03.1-ce\"" + * https://github.com/openshift/origin/pull/13201 + * https://github.com/docker/for-mac/issues/1491 - * https://download.docker.com/mac/stable/1.12.6.14937/Docker.dmg - * Then de-select check for updates + * https://download.docker.com/mac/stable/1.12.6.14937/Docker.dmg + * Then de-select check for updates - * Insecure Registry setting needed 172.30.0.0/16 - * Shared Folders - * /docker_shared/origin - * /persistedvolumes + * Insecure Registry setting needed 172.30.0.0/16 + * Shared Folders + * /docker_shared/origin + * /persistedvolumes + * Hardcoded workaround for asbcli up to see openshift url (pure docker run, outside of kube) - ### Execute diff --git a/local/mac/common_vars b/local/mac/common_vars index e1f6d39..e2d02cf 100644 --- a/local/mac/common_vars +++ b/local/mac/common_vars @@ -2,4 +2,4 @@ export CLUSTER_IP="127.0.0.1" export OPENSHIFT_HOSTNAME="${CLUSTER_IP}.nip.io" -export EXTRA_VARS="{\"ec2_install\":False, \"use_ssl\":False, \"oc_host_config_dir\":\"/docker_shared/origin\", \"openshift_hostname\":\"${OPENSHIFT_HOSTNAME}\", \"dockerhub_user_name\":\"${DOCKERHUB_USER_NAME}\", \"dockerhub_user_password\":\"${DOCKERHUB_USER_PASSWORD}\", \"dockerhub_org_name\":\"${DOCKERHUB_ORG_NAME}\" }" +export EXTRA_VARS="{\"ec2_install\":False, \"use_ssl\":False, \"oc_host_config_dir\":\"/docker_shared/origin\", \"openshift_hostname\":\"${OPENSHIFT_HOSTNAME}\" }" diff --git a/local/mac/test_asb_up.sh b/local/mac/test_asb_up.sh new file mode 100755 index 0000000..7d9bf75 --- /dev/null +++ b/local/mac/test_asb_up.sh @@ -0,0 +1,6 @@ +#URL="https://127.0.0.1.nip.io:8443" +#URL="https://172.31.0.19.nip.io:8443" +URL="https://172.17.0.1.nip.io:8443" + + +docker run -e OPENSHIFT_TARGET=${URL} -e OPENSHIFT_USER=admin -e OPENSHIFT_PASS=admin ansibleplaybookbundle/ansible-service-broker-apb:summit -e dockerhub_user=foo -e dockerhub_pass=foo -e openshift_target ${URL} -e openshift_user admin -e openshift_pass admin From f26433635d3b8dc93afc648f499e27fe1325ce94 Mon Sep 17 00:00:00 2001 From: John Matthews Date: Sat, 20 May 2017 15:18:01 -0400 Subject: [PATCH 05/21] WIP - Broker resource created in Service Catalog working Next need to fix controllermanager able to talk to asb route. Route is not working as it's resolving to 127.0.0.1 IP in the controller manager container --- .../service_catalog_setup/tasks/main.yml | 41 +++++++++++++++---- local/mac/README.md | 2 + 2 files changed, 34 insertions(+), 9 deletions(-) diff --git a/ansible/roles/service_catalog_setup/tasks/main.yml b/ansible/roles/service_catalog_setup/tasks/main.yml index 9403953..196c58e 100644 --- a/ansible/roles/service_catalog_setup/tasks/main.yml +++ b/ansible/roles/service_catalog_setup/tasks/main.yml @@ -93,14 +93,18 @@ # - SSL certs complained they didn't match the route name # - - name: Get route for apiserver + - name: Wait for route for apiserver to be available shell: "'{{ oc_cmd }}' get route -n service-catalog --no-headers=true | grep -E '^apiserver( |$)' | cat" register: result_get_route_apiserver retries: 6 delay: 10 + - name: Save route of apiserver + shell: "{{ oc_cmd}} get route -n service-catalog --no-headers=true | awk '{print $2}'" + register: result_service_catalog_endpoint + - set_fact: - service_catalog_endpoint: "{{ result_get_route_apiserver.stdout }}" + service_catalog_endpoint: "{{ result_service_catalog_endpoint.stdout }}" # Falling back to using the unauthenticated IP of the Pod/Port for now - name: Get IP of APIServer @@ -111,15 +115,34 @@ - set_fact: service_catalog_api_server_ip: "{{ result_apiserver_ip.stdout }}" + svc_cat_kube_config: "{{ ansible_env.HOME }}/.kube/service-catalog.config" - - name: Creating .kube/service-catalog.config from kubeconfig.templ.yaml.j2 - template: - src: kubeconfig.templ.yaml.j2 - dest: "{{ ansible_env.HOME }}/.kube/service-catalog.config" - owner: "{{ ansible_env.USER }}" + #- name: Creating .kube/service-catalog.config from kubeconfig.templ.yaml.j2 + # template: + # src: kubeconfig.templ.yaml.j2 + # dest: "{{ ansible_env.HOME }}/.kube/service-catalog.config" + # owner: "{{ ansible_env.USER }}" #group: "{{ ansible_env.USER }}" - mode: 0644 + # mode: 0644 + + - name: Remove {{ svc_cat_kube_config }} if present + file: + path: "{{ svc_cat_kube_config }}" + state: absent + become: true + + - name: Create cluster entry in kube config for apiserver of service catalog + shell: "{{ kubectl_cmd }} config set-cluster service-catalog-cluster --insecure-skip-tls-verify=true --server=https://{{ service_catalog_endpoint }} --kubeconfig={{ svc_cat_kube_config }}" + + - name: Create user credentials entry in kube config for apiserver of service catalog + shell: "{{ kubectl_cmd }} config set-credentials admin/service-catalog-cluster --username=admin --password=admin --kubeconfig={{ svc_cat_kube_config }}" + + - name: Create context entry in kube config for apiserver of service catalog + shell: "{{ kubectl_cmd }} config set-context default/service-catalog-cluster/admin --cluster service-catalog-cluster --user=admin/service-catalog-cluster --kubeconfig={{ svc_cat_kube_config }}" + + - name: Create context entry in kube config for apiserver of service catalog + shell: "{{ kubectl_cmd }} config use-context default/service-catalog-cluster/admin --kubeconfig={{ svc_cat_kube_config }}" - lineinfile: dest={{ ansible_env.HOME }}/.bashrc line="{{ item }}" create=yes with_items: - - alias catctl="kubectl --kubeconfig={{ ansible_env.HOME }}/.kube/service-catalog.config" + - alias catctl="kubectl --kubeconfig={{ svc_cat_kube_config }}" diff --git a/local/mac/README.md b/local/mac/README.md index dc7ee0c..9543822 100644 --- a/local/mac/README.md +++ b/local/mac/README.md @@ -43,6 +43,8 @@ These playbooks will: * /docker_shared/origin * /persistedvolumes * Hardcoded workaround for asbcli up to see openshift url (pure docker run, outside of kube) + * Performance Issues: + * https://github.com/docker/for-mac/issues/668 From df33144094d540bd76e7d512e8140fccdf4ffdc2 Mon Sep 17 00:00:00 2001 From: John Matthews Date: Sun, 21 May 2017 08:14:19 -0400 Subject: [PATCH 06/21] Successful run local on macOS, postgres/python bind worked. --- ansible/display_ec2_instance_information.yml | 2 +- ansible/group_vars/all.yml | 12 +++- ansible/library/inventory/docker-machine.py | 49 ------------- ansible/reset_environment.yml | 2 +- ansible/reset_local_environment.yml | 2 +- ansible/reset_mac_environment.yml | 2 +- ansible/roles/openshift_setup/tasks/main.yml | 20 +++++- .../openshift_setup/templates/extension.j2 | 2 +- ansible/setup_environment.yml | 2 +- ansible/setup_local_environment.yml | 2 +- ansible/setup_mac_environment.yml | 6 +- local/mac/README.md | 72 ++++++++++--------- local/mac/common_vars | 9 ++- local/mac/reset_environment.sh | 2 +- 14 files changed, 83 insertions(+), 101 deletions(-) delete mode 100755 ansible/library/inventory/docker-machine.py diff --git a/ansible/display_ec2_instance_information.yml b/ansible/display_ec2_instance_information.yml index b8557a5..ccb1f42 100644 --- a/ansible/display_ec2_instance_information.yml +++ b/ansible/display_ec2_instance_information.yml @@ -17,7 +17,7 @@ SSH Key Name: {{ ssh_key_name }} Region: {{ aws_region }} Next steps: - 1) Visit https://apiserver-service-catalog.{{ openshift_hostname }} + 1) Visit https://apiserver-service-catalog.{{ openshift_routing_suffix }} 2) Accept the certificate 3) Visit https://{{ openshift_hostname }}:8443 for the console 4) Provision a RDS APB into awsdemo project diff --git a/ansible/group_vars/all.yml b/ansible/group_vars/all.yml index 657ff33..8f20024 100644 --- a/ansible/group_vars/all.yml +++ b/ansible/group_vars/all.yml @@ -42,8 +42,18 @@ aws_ami_id: ami-b63769a1 instance_type: c4.4xlarge +# For local setup, especially on Mac the openshift_hostname will be +# different from the routing_suffix. +# We expect the openshift_hostname for Mac to be the public IP +# This is needed so oc cluster up and can ensure it's listening +# on the correct interface. +# +# For ec2 runs this is less important to differentiate and we expect +# openshift_hostname and openshift_routing_suffix to be the same +# openshift_hostname: "{{target_subdomain}}.{{target_dns_zone}}" -openshift_url: "{{ openshift_hostname }}:8443" +openshift_routing_suffix: "{{target_subdomain}}.{{target_dns_zone}}" +openshift_url: "{{ openshift_public_hostname }}:8443" use_ssl: True email_address: "foo@bar.com" diff --git a/ansible/library/inventory/docker-machine.py b/ansible/library/inventory/docker-machine.py deleted file mode 100755 index 8e9c094..0000000 --- a/ansible/library/inventory/docker-machine.py +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/env python -# -# Original code from 'nathanleclaire' -# https://raw.githubusercontent.com/nathanleclaire/dockerfiles/master/ansible/machine.py -# -""" -Example Usage: -$ ansible -i machine.py machinename -m ping -""" - - -import argparse -import subprocess - -try: - import json -except ImportError: - import simplejson as json - -def dm(*args): - return subprocess.check_output(["docker-machine"] + list(args)).strip() - -def dminspect(fmt, mcn): - return dm("inspect", "-f", fmt, mcn) - -def get_host_and_vars(m): - hosts = [dminspect("{{.Driver.IPAddress}}", m)] - ssh_vars = { - "ansible_ssh_user": dminspect("{{.Driver.SSHUser}}", m), - "ansible_ssh_port": dminspect("{{.Driver.SSHPort}}", m), - "ansible_ssh_private_key_file": dminspect("{{.Driver.SSHKeyPath}}", m) - } - data = {"hosts": hosts, "vars": ssh_vars} - return data - -class DockerMachineInventory(object): - def __init__(self): - self.inventory = {} # Ansible Inventory - - parser = argparse.ArgumentParser(description='Produce an Ansible Inventory file based on Docker Machine status') - parser.add_argument('--list', action='store_true', help='List all active Droplets as Ansible inventory (default: True)') - self.args = parser.parse_args() - - machines = dm("ls", "-q").splitlines() - json_data = {m: get_host_and_vars(m) for m in machines} - - print json.dumps(json_data) - -DockerMachineInventory() diff --git a/ansible/reset_environment.yml b/ansible/reset_environment.yml index 4b259e7..cbf3e48 100644 --- a/ansible/reset_environment.yml +++ b/ansible/reset_environment.yml @@ -35,7 +35,7 @@ SSH Key Name: {{ ssh_key_name }} Region: {{ aws_region }} Next steps: - 1) Visit https://apiserver-service-catalog.{{ openshift_hostname }} + 1) Visit https://apiserver-service-catalog.{{ openshift_routing_suffix }} 2) Accept the certificate 3) Visit https://{{ openshift_hostname }}:8443 for the console 4) Provision a RDS APB into awsdemo project diff --git a/ansible/reset_local_environment.yml b/ansible/reset_local_environment.yml index 1b57c20..9444a76 100644 --- a/ansible/reset_local_environment.yml +++ b/ansible/reset_local_environment.yml @@ -12,7 +12,7 @@ msg: | Hostname: {{ openshift_hostname }} Next steps: - 1) Visit https://apiserver-service-catalog.{{ openshift_hostname }} + 1) Visit https://apiserver-service-catalog.{{ openshift_routing_suffix }} 2) Accept the certificate 3) Visit https://{{ openshift_hostname }}:8443 for the console OR diff --git a/ansible/reset_mac_environment.yml b/ansible/reset_mac_environment.yml index 1b57c20..9444a76 100644 --- a/ansible/reset_mac_environment.yml +++ b/ansible/reset_mac_environment.yml @@ -12,7 +12,7 @@ msg: | Hostname: {{ openshift_hostname }} Next steps: - 1) Visit https://apiserver-service-catalog.{{ openshift_hostname }} + 1) Visit https://apiserver-service-catalog.{{ openshift_routing_suffix }} 2) Accept the certificate 3) Visit https://{{ openshift_hostname }}:8443 for the console OR diff --git a/ansible/roles/openshift_setup/tasks/main.yml b/ansible/roles/openshift_setup/tasks/main.yml index 3e55d07..b6023bd 100644 --- a/ansible/roles/openshift_setup/tasks/main.yml +++ b/ansible/roles/openshift_setup/tasks/main.yml @@ -154,9 +154,16 @@ oc_cluster_up_first_run: True when: "not 'cluster was started' in oc_cluster_status.stdout" + - name: Create command line for oc cluster up execution + set_fact: + oc_cluster_up_cmd: "{{ oc_cmd }} cluster up --routing-suffix={{ openshift_routing_suffix }} --public-hostname={{ openshift_hostname }} --host-pv-dir={{ persistedvol_mount_point }} --version=summit --image=docker.io/ansibleplaybookbundle/origin --host-config-dir={{ oc_host_config_dir }}" + + - debug: + msg: "Looking at oc cluster up command: '{{ oc_cluster_up_cmd }}'" + # Intent of this oc cluster up is generate the master-config.yaml so we can make edits to it - name: Run oc cluster up - shell: "{{ oc_cmd }} cluster up --routing-suffix={{ openshift_hostname }} --public-hostname={{ openshift_hostname }} --host-pv-dir={{ persistedvol_mount_point }} --version=summit --image=docker.io/ansibleplaybookbundle/origin --host-config-dir={{ oc_host_config_dir }}" + shell: "{{ oc_cluster_up_cmd }}" when: (oc_cluster_up_first_run and not master_config_stat.stat.exists) or ssl_changed is defined - debug: @@ -275,7 +282,7 @@ lineinfile: dest: "{{ oc_host_config_dir }}/master/master-config.yaml" insertafter: "names:" - line: " - \"apiserver-service-catalog.{{ openshift_hostname }}\"" + line: " - \"apiserver-service-catalog.{{ openshift_routing_suffix }}\"" when: use_ssl == True become: 'true' @@ -295,8 +302,15 @@ when: use_ssl == True become: 'true' + - name: Update oc cluster up command to use --use-existing-config + set_fact: + oc_cluster_up_cmd: "{{ oc_cluster_up_cmd }} --use-existing-config" + + - debug: + msg: "Looking at oc cluster up command: '{{ oc_cluster_up_cmd }}'" + - name: Run oc cluster up - shell: "{{ oc_cmd }} cluster up --routing-suffix={{ openshift_hostname }} --public-hostname={{ openshift_hostname }} --host-pv-dir={{ persistedvol_mount_point }} --version=summit --image=docker.io/ansibleplaybookbundle/origin --host-config-dir={{ oc_host_config_dir }} --use-existing-config" + shell: "{{ oc_cluster_up_cmd }}" when: oc_cluster_up_first_run register: oc_cluster_up # diff --git a/ansible/roles/openshift_setup/templates/extension.j2 b/ansible/roles/openshift_setup/templates/extension.j2 index c5522bc..cce9ac5 100644 --- a/ansible/roles/openshift_setup/templates/extension.j2 +++ b/ansible/roles/openshift_setup/templates/extension.j2 @@ -1,4 +1,4 @@ window.OPENSHIFT_CONFIG.additionalServers = [{ - hostPort: "apiserver-service-catalog.{{ openshift_hostname }}", + hostPort: "apiserver-service-catalog.{{ openshift_routing_suffix }}", prefix: "/apis" }]; diff --git a/ansible/setup_environment.yml b/ansible/setup_environment.yml index 23607f7..e1d8dc2 100644 --- a/ansible/setup_environment.yml +++ b/ansible/setup_environment.yml @@ -39,7 +39,7 @@ SSH Key Name: {{ ssh_key_name }} Region: {{ aws_region }} Next steps: - 1) Visit https://apiserver-service-catalog.{{ openshift_hostname }} + 1) Visit https://apiserver-service-catalog.{{ openshift_routing_suffix }} 2) Accept the certificate 3) Visit https://{{ openshift_hostname }}:8443 for the console 4) Provision a RDS APB into awsdemo project diff --git a/ansible/setup_local_environment.yml b/ansible/setup_local_environment.yml index 53f2011..5594c81 100644 --- a/ansible/setup_local_environment.yml +++ b/ansible/setup_local_environment.yml @@ -11,7 +11,7 @@ msg: | Hostname: {{ openshift_hostname }} Next steps: - 1) Visit https://apiserver-service-catalog.{{ openshift_hostname }} + 1) Visit https://apiserver-service-catalog.{{ openshift_routing_suffix }} 2) Accept the certificate 3) Visit https://{{ openshift_hostname }}:8443 for the console OR diff --git a/ansible/setup_mac_environment.yml b/ansible/setup_mac_environment.yml index 38ff038..5594c81 100644 --- a/ansible/setup_mac_environment.yml +++ b/ansible/setup_mac_environment.yml @@ -4,14 +4,14 @@ - openshift_setup - service_catalog_setup - ansible_service_broker_setup - #- local_demo_prep - #- env_hacks + - local_demo_prep + - env_hacks post_tasks: - set_fact: msg: | Hostname: {{ openshift_hostname }} Next steps: - 1) Visit https://apiserver-service-catalog.{{ openshift_hostname }} + 1) Visit https://apiserver-service-catalog.{{ openshift_routing_suffix }} 2) Accept the certificate 3) Visit https://{{ openshift_hostname }}:8443 for the console OR diff --git a/local/mac/README.md b/local/mac/README.md index 9543822..9195e3b 100644 --- a/local/mac/README.md +++ b/local/mac/README.md @@ -9,51 +9,55 @@ These playbooks will: * Install Ansible Service Broker on Origin ### Pre-Reqs - * Ansible needs to be installed so its source code is available to Python. - * Check to see if Ansible modules are available to Python - $ python -c "import ansible;print(ansible.__version__)" - 2.2.2.0 - * MacOS requires Ansible to be installed from `pip` and not `brew` - $ python -c "import ansible;print(ansible.__version__)" - Traceback (most recent call last): - File "", line 1, in - ImportError: No module named ansible + * Older version of Docker for Mac needs to be installed + * https://download.docker.com/mac/stable/1.12.6.14937/Docker.dmg + * Info on issues seen: + * Error syncing pod, skipping: failed to "StartContainer" for "POD" with RunContainerError: "runContainer: docker: failed to parse docker version \"17.03.1-ce\": illegal zero-prefixed version component \"03\" in \"17.03.1-ce\"" + * https://github.com/openshift/origin/pull/13201 + * https://github.com/docker/for-mac/issues/1491 + * Docker setup: + * de-select check for updates + * Insecure Registry setting needed 172.30.0.0/16 + * Shared Folders (create these folders on your mac owned by your user) + * /docker_shared/origin + * /persistedvolumes + * Networking Setup + * We need a static IP address we can use that will resolve on our host and from the containers + sudo ifconfig lo0 alias 192.168.37.1 + * Recommended way to install Ansible + * We recommend you install Ansible from pip instead of homebrew + * This will ensure Ansible is in the python path + * MacOS example Ansible to be installed from `pip` and not `brew` + * From homebrew we see: + $ python -c "import ansible;print(ansible.__version__)" + Traceback (most recent call last): + File "", line 1, in + ImportError: No module named ansible - brew uninstall ansible - pip install ansible + brew uninstall ansible + pip install ansible - $ python -c "import ansible;print(ansible.__version__)" - 2.2.2.0 + $ python -c "import ansible;print(ansible.__version__)" + 2.3.0.0 * Install python dependencies * `pip install six` ### Notes - * Accessing the VM on OSX running docker: + * Accessing the VM on OSX running docker: * screen ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/tty - * Need to downgrade docker - * Error syncing pod, skipping: failed to "StartContainer" for "POD" with RunContainerError: "runContainer: docker: failed to parse docker version \"17.03.1-ce\": illegal zero-prefixed version component \"03\" in \"17.03.1-ce\"" - * https://github.com/openshift/origin/pull/13201 - * https://github.com/docker/for-mac/issues/1491 - - * https://download.docker.com/mac/stable/1.12.6.14937/Docker.dmg - * Then de-select check for updates - - * Insecure Registry setting needed 172.30.0.0/16 - * Shared Folders - * /docker_shared/origin - * /persistedvolumes * Hardcoded workaround for asbcli up to see openshift url (pure docker run, outside of kube) * Performance Issues: - * https://github.com/docker/for-mac/issues/668 - - + * Shared Volume issues + * https://github.com/docker/for-mac/issues/668 + * After mac host has been resumed (closed lid or went to sleep) the performance seems worse with oc commands + * Doing a reset_environment.sh brings things back to be better. ### Execute - * `cd local` - * Edit the variables file `local/common_vars` + * `cd local/mac` + * Edit the variables file `local/mac/common_vars` * Update: - * CLUSTER_IP if your installation of Docker is not using the default bridge of `docker0` - * `./run_setup_local.sh` + * CLUSTER_IP if you want to use a different static IP. + * `./run_mac_local.sh` * Sets up OpenShift * In Web Browser * Visit: `https://apiserver-service-catalog.CLUSTERIP.nip.io` @@ -68,7 +72,7 @@ To terminate the local instance run the below * `oc cluster down` To reset the environment to a clean instance of origin with ASB and Service Catalog run the below - * `cd local` + * `cd local/mac` * `./reset_environment.sh` ### Tested with diff --git a/local/mac/common_vars b/local/mac/common_vars index e2d02cf..713966b 100644 --- a/local/mac/common_vars +++ b/local/mac/common_vars @@ -1,5 +1,8 @@ -export CLUSTER_IP="127.0.0.1" +export PUBLIC_IP="192.168.37.1" +echo "We will create a lo0 alias for ${PUBLIC_IP}" +sudo ifconfig lo0 alias ${PUBLIC_IP} -export OPENSHIFT_HOSTNAME="${CLUSTER_IP}.nip.io" +export OPENSHIFT_HOSTNAME="${PUBLIC_IP}" +export OPENSHIFT_ROUTING_SUFFIX="${PUBLIC_IP}.nip.io" -export EXTRA_VARS="{\"ec2_install\":False, \"use_ssl\":False, \"oc_host_config_dir\":\"/docker_shared/origin\", \"openshift_hostname\":\"${OPENSHIFT_HOSTNAME}\" }" +export EXTRA_VARS="{\"ec2_install\":False, \"use_ssl\":False, \"oc_host_config_dir\":\"/docker_shared/origin\", \"openshift_hostname\":\"${OPENSHIFT_HOSTNAME}\", \"openshift_routing_suffix\":\"${OPENSHIFT_ROUTING_SUFFIX}\" }" diff --git a/local/mac/reset_environment.sh b/local/mac/reset_environment.sh index 3c05b46..1f903fe 100755 --- a/local/mac/reset_environment.sh +++ b/local/mac/reset_environment.sh @@ -2,4 +2,4 @@ ANS_CODE="../../ansible" source ./common_vars -ansible-playbook ${ANS_CODE}/reset_mac_environment.yml --extra-vars "${EXTRA_VARS}" +ansible-playbook -vv ${ANS_CODE}/reset_mac_environment.yml --extra-vars "${EXTRA_VARS}" From fa2a4e4264dcdc1cbf5cb240c16b5ba052612049 Mon Sep 17 00:00:00 2001 From: John Matthews Date: Sun, 21 May 2017 08:46:09 -0400 Subject: [PATCH 07/21] Reverted asbcli up to use openshift_url variable --- ansible/group_vars/all.yml | 2 +- ansible/roles/ansible_service_broker_setup/defaults/main.yml | 1 - ansible/roles/ansible_service_broker_setup/tasks/main.yml | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/ansible/group_vars/all.yml b/ansible/group_vars/all.yml index 8f20024..4431cff 100644 --- a/ansible/group_vars/all.yml +++ b/ansible/group_vars/all.yml @@ -53,7 +53,7 @@ instance_type: c4.4xlarge # openshift_hostname: "{{target_subdomain}}.{{target_dns_zone}}" openshift_routing_suffix: "{{target_subdomain}}.{{target_dns_zone}}" -openshift_url: "{{ openshift_public_hostname }}:8443" +openshift_url: "{{ openshift_hostname }}:8443" use_ssl: True email_address: "foo@bar.com" diff --git a/ansible/roles/ansible_service_broker_setup/defaults/main.yml b/ansible/roles/ansible_service_broker_setup/defaults/main.yml index 0a66537..27e59d4 100644 --- a/ansible/roles/ansible_service_broker_setup/defaults/main.yml +++ b/ansible/roles/ansible_service_broker_setup/defaults/main.yml @@ -1,4 +1,3 @@ asb_src_dir: /tmp/ansible-service-broker dockerhub_user_name: changeme dockerhub_user_password: changeme -asbcli_openshift_url: https://172.17.0.1.nip.io:8443 diff --git a/ansible/roles/ansible_service_broker_setup/tasks/main.yml b/ansible/roles/ansible_service_broker_setup/tasks/main.yml index 1b7e407..7b1c328 100644 --- a/ansible/roles/ansible_service_broker_setup/tasks/main.yml +++ b/ansible/roles/ansible_service_broker_setup/tasks/main.yml @@ -23,7 +23,7 @@ - name: Use asbcli up to install Ansible Service Broker shell: > - ./asbcli up {{ asbcli_openshift_url }} + ./asbcli up {{ openshift_url }} --cluster-user={{ cluster_user }} --cluster-pass={{ cluster_user_password }} --dockerhub-user={{ dockerhub_user_name }} From b5fddfa46d17a957adaea69be0200834c787a55a Mon Sep 17 00:00:00 2001 From: John Matthews Date: Sun, 21 May 2017 10:48:44 -0400 Subject: [PATCH 08/21] Update README --- local/mac/README.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/local/mac/README.md b/local/mac/README.md index 9195e3b..515a1cd 100644 --- a/local/mac/README.md +++ b/local/mac/README.md @@ -9,6 +9,7 @@ These playbooks will: * Install Ansible Service Broker on Origin ### Pre-Reqs + * We can NOT work with latest Docker for Mac. * Older version of Docker for Mac needs to be installed * https://download.docker.com/mac/stable/1.12.6.14937/Docker.dmg * Info on issues seen: @@ -22,8 +23,10 @@ These playbooks will: * /docker_shared/origin * /persistedvolumes * Networking Setup - * We need a static IP address we can use that will resolve on our host and from the containers - sudo ifconfig lo0 alias 192.168.37.1 + * We will create a static IP aliased to lo0 automatically. We are using the static IP address to ensure that we can always resolve openshift from the host as well as inside of containers. + * The local/mac/common_vars script will create a local alias automatically by running the below. + sudo ifconfig lo0 alias 192.168.37.1 + * Recommended way to install Ansible * We recommend you install Ansible from pip instead of homebrew * This will ensure Ansible is in the python path From b4b3003aec635e3fe1dad62cd1863e2577624428 Mon Sep 17 00:00:00 2001 From: John Matthews Date: Sun, 21 May 2017 10:49:27 -0400 Subject: [PATCH 09/21] README markdown tweak --- local/mac/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/local/mac/README.md b/local/mac/README.md index 515a1cd..00a2495 100644 --- a/local/mac/README.md +++ b/local/mac/README.md @@ -25,7 +25,8 @@ These playbooks will: * Networking Setup * We will create a static IP aliased to lo0 automatically. We are using the static IP address to ensure that we can always resolve openshift from the host as well as inside of containers. * The local/mac/common_vars script will create a local alias automatically by running the below. - sudo ifconfig lo0 alias 192.168.37.1 + + sudo ifconfig lo0 alias 192.168.37.1 * Recommended way to install Ansible * We recommend you install Ansible from pip instead of homebrew From f8c0e44bbd847c28edf9f63053e6c3dadc164a1f Mon Sep 17 00:00:00 2001 From: John Matthews Date: Sun, 21 May 2017 10:50:26 -0400 Subject: [PATCH 10/21] Another README.md tweak --- local/mac/README.md | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/local/mac/README.md b/local/mac/README.md index 00a2495..5a4af3a 100644 --- a/local/mac/README.md +++ b/local/mac/README.md @@ -33,16 +33,17 @@ These playbooks will: * This will ensure Ansible is in the python path * MacOS example Ansible to be installed from `pip` and not `brew` * From homebrew we see: - $ python -c "import ansible;print(ansible.__version__)" - Traceback (most recent call last): - File "", line 1, in - ImportError: No module named ansible - brew uninstall ansible - pip install ansible + $ python -c "import ansible;print(ansible.__version__)" + Traceback (most recent call last): + File "", line 1, in + ImportError: No module named ansible - $ python -c "import ansible;print(ansible.__version__)" - 2.3.0.0 + brew uninstall ansible + pip install ansible + + $ python -c "import ansible;print(ansible.__version__)" + 2.3.0.0 * Install python dependencies * `pip install six` From 92e2f7e6299c3294c73c95b2a6b97116e365f1fc Mon Sep 17 00:00:00 2001 From: John Matthews Date: Sun, 21 May 2017 10:57:01 -0400 Subject: [PATCH 11/21] README tweak --- local/mac/README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/local/mac/README.md b/local/mac/README.md index 5a4af3a..e647888 100644 --- a/local/mac/README.md +++ b/local/mac/README.md @@ -71,6 +71,13 @@ These playbooks will: * Point of this step is just to accept the SSL cert for the apiserver-service-catalog endpoint * Visit: `https://CLUSTERIP.nip.io:8443` +### Bind Example + * Sample workflow showing how to create python webapp binding to a local postgres database + * Sample python web app to use: + * https://github.com/fusor/awsdemo.git + * Youtube Video showing workflow: + * https://www.youtube.com/watch?v=xmd52NhEjCk + ### Cleanup To terminate the local instance run the below From ce7d0c70b639d73455f520c74771b557779e86fb Mon Sep 17 00:00:00 2001 From: John Matthews Date: Sun, 21 May 2017 10:58:23 -0400 Subject: [PATCH 12/21] README tweak --- local/mac/README.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/local/mac/README.md b/local/mac/README.md index e647888..5a0d77e 100644 --- a/local/mac/README.md +++ b/local/mac/README.md @@ -44,13 +44,10 @@ These playbooks will: $ python -c "import ansible;print(ansible.__version__)" 2.3.0.0 - * Install python dependencies - * `pip install six` ### Notes * Accessing the VM on OSX running docker: * screen ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/tty - * Hardcoded workaround for asbcli up to see openshift url (pure docker run, outside of kube) * Performance Issues: * Shared Volume issues * https://github.com/docker/for-mac/issues/668 From 8b07ded4af84c041de5612eaf7046869b74dc377 Mon Sep 17 00:00:00 2001 From: John Matthews Date: Sun, 21 May 2017 11:24:07 -0400 Subject: [PATCH 13/21] Add note 'socat' needs to be installed on mac --- local/mac/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/local/mac/README.md b/local/mac/README.md index 5a0d77e..751b958 100644 --- a/local/mac/README.md +++ b/local/mac/README.md @@ -9,6 +9,8 @@ These playbooks will: * Install Ansible Service Broker on Origin ### Pre-Reqs + * ```socat``` needs to be installed + brew install socat * We can NOT work with latest Docker for Mac. * Older version of Docker for Mac needs to be installed * https://download.docker.com/mac/stable/1.12.6.14937/Docker.dmg From a22b54bdd4cb2818ffd6e809d58e37567331d7f3 Mon Sep 17 00:00:00 2001 From: John Matthews Date: Sun, 21 May 2017 11:41:03 -0400 Subject: [PATCH 14/21] Fix for install asb pip requirements Found when running on a clean mac install --- ansible/roles/ansible_service_broker_setup/tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ansible/roles/ansible_service_broker_setup/tasks/main.yml b/ansible/roles/ansible_service_broker_setup/tasks/main.yml index 7b1c328..6e6980c 100644 --- a/ansible/roles/ansible_service_broker_setup/tasks/main.yml +++ b/ansible/roles/ansible_service_broker_setup/tasks/main.yml @@ -11,7 +11,7 @@ pip: requirements: "{{ asb_src_dir }}/scripts/asbcli/requirements.txt" when: git_clone_asb.changed - become: 'true' + become: true - name: Docker pull ansibleplaybookbundle/ansible-service-broker-apb:summit docker_image: From 312152a69df8573cb30ad6cebc35f821b267d091 Mon Sep 17 00:00:00 2001 From: John Matthews Date: Sun, 21 May 2017 11:44:13 -0400 Subject: [PATCH 15/21] Fix for oc_host_config_dir for EC2 --- ansible/group_vars/all.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ansible/group_vars/all.yml b/ansible/group_vars/all.yml index 4431cff..9690448 100644 --- a/ansible/group_vars/all.yml +++ b/ansible/group_vars/all.yml @@ -85,8 +85,7 @@ oc_cmd: "{{ oc_client_install_path }}/oc" oadm_cmd: "{{ oc_client_install_path }}/oadm" kubectl_cmd: "{{ oc_client_install_path }}/kubectl" -oc_host_config_dir: /docker_shared/origin -#oc_host_config_dir: /var/lib/origin/openshift.local.config +oc_host_config_dir: /var/lib/origin/openshift.local.config deploy_rds_demo_instance: true From 4b44728901f70dbf80c1c21b9aebcdd2a922e103 Mon Sep 17 00:00:00 2001 From: John Matthews Date: Sun, 21 May 2017 11:45:47 -0400 Subject: [PATCH 16/21] Updates from testing on Linux --- local/linux/common_vars | 7 ++++--- local/linux/reset_environment.sh | 4 +--- local/linux/run_setup_local.sh | 4 +--- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/local/linux/common_vars b/local/linux/common_vars index a858fae..55b1f2c 100644 --- a/local/linux/common_vars +++ b/local/linux/common_vars @@ -1,5 +1,6 @@ -export CLUSTER_IP="$(ifconfig docker0 | grep inet | awk '{print $2}' | head -1)" +export PUBLIC_IP="$(ifconfig docker0 | grep inet | awk '{print $2}' | head -1)" -export OPENSHIFT_HOSTNAME="${CLUSTER_IP}.nip.io" +export OPENSHIFT_HOSTNAME="${PUBLIC_IP}" +export OPENSHIFT_ROUTING_SUFFIX="${PUBLIC_IP}.nip.io" -export EXTRA_VARS="{\"remove_docker_images\":${RESET_ENV}, \"ec2_install\":False, \"use_ssl\":False, \"openshift_hostname\":\"${OPENSHIFT_HOSTNAME}\", \"dockerhub_user_name\":\"${DOCKERHUB_USER_NAME}\", \"dockerhub_user_password\":\"${DOCKERHUB_USER_PASSWORD}\", \"dockerhub_org_name\":\"${DOCKERHUB_ORG_NAME}\"}" +export EXTRA_VARS="{\"remove_docker_images\":${RESET_ENV}, \"ec2_install\":False, \"use_ssl\":False, \"openshift_hostname\":\"${OPENSHIFT_HOSTNAME}\", \"openshift_routing_suffix\":\"${OPENSHIFT_ROUTING_SUFFIX}\" }" diff --git a/local/linux/reset_environment.sh b/local/linux/reset_environment.sh index 2345a5c..0c473d9 100755 --- a/local/linux/reset_environment.sh +++ b/local/linux/reset_environment.sh @@ -1,7 +1,5 @@ #!/bin/sh -export RESET_ENV="True" -ANS_CODE="../ansible" -source ./my_vars +ANS_CODE="../../ansible" source ./common_vars ansible-playbook ${ANS_CODE}/reset_local_environment.yml --extra-vars "${EXTRA_VARS}" diff --git a/local/linux/run_setup_local.sh b/local/linux/run_setup_local.sh index 95ccc36..fd90f75 100755 --- a/local/linux/run_setup_local.sh +++ b/local/linux/run_setup_local.sh @@ -1,7 +1,5 @@ #!/bin/sh -export RESET_ENV="False" -ANS_CODE="../ansible" -source ./my_vars +ANS_CODE="../../ansible" source ./common_vars ansible-playbook ${ANS_CODE}/setup_local_environment.yml --extra-vars "${EXTRA_VARS}" From 4f2459556faa18ebd11777cebafba561056bcdae Mon Sep 17 00:00:00 2001 From: John Matthews Date: Sun, 21 May 2017 12:07:31 -0400 Subject: [PATCH 17/21] Removed some commented out code --- .../tasks/main.yml | 1 - ansible/roles/openshift_setup/tasks/main.yml | 2 -- .../service_catalog_setup/tasks/main.yml | 27 +------------------ 3 files changed, 1 insertion(+), 29 deletions(-) diff --git a/ansible/roles/ansible_service_broker_setup/tasks/main.yml b/ansible/roles/ansible_service_broker_setup/tasks/main.yml index 6e6980c..2a5b818 100644 --- a/ansible/roles/ansible_service_broker_setup/tasks/main.yml +++ b/ansible/roles/ansible_service_broker_setup/tasks/main.yml @@ -75,7 +75,6 @@ src: ansible_service_broker.yaml.j2 dest: /tmp/ansible_service_broker.yaml owner: "{{ ansible_env.USER }}" - #group: "{{ ansible_env.USER }}" mode: 0644 register: ansible_service_broker_template diff --git a/ansible/roles/openshift_setup/tasks/main.yml b/ansible/roles/openshift_setup/tasks/main.yml index b6023bd..312a331 100644 --- a/ansible/roles/openshift_setup/tasks/main.yml +++ b/ansible/roles/openshift_setup/tasks/main.yml @@ -227,8 +227,6 @@ template: src: extension.j2 dest: "{{ oc_host_config_dir }}/extension.js" - #owner: root - #group: root mode: 0644 register: extension_script_result become: 'true' diff --git a/ansible/roles/service_catalog_setup/tasks/main.yml b/ansible/roles/service_catalog_setup/tasks/main.yml index 196c58e..ff3fda6 100644 --- a/ansible/roles/service_catalog_setup/tasks/main.yml +++ b/ansible/roles/service_catalog_setup/tasks/main.yml @@ -29,9 +29,6 @@ register: new_svc_cat_project when: project.stdout.find( "service-catalog" ) == -1 - #- name: Ensuring service-catalog project is selected for those cases of being re-run and skipping the new-project creation - # shell: "{{ oc_cmd }} project service-catalog" - - name: check if the apiserver deployment exists shell: "{{ oc_cmd }} get deployment -n service-catalog --no-headers=true | awk '{ print $1}' | grep -E '^apiserver( |$)' | cat" register: deployment @@ -86,13 +83,6 @@ retries: 60 delay: 10 - # We would like to use the route, but had problems with integration - # Keeping the route information here so we can revisit - # Issues: - # - We need to login, unsure what user/project to authenticate as - # - SSL certs complained they didn't match the route name - # - - name: Wait for route for apiserver to be available shell: "'{{ oc_cmd }}' get route -n service-catalog --no-headers=true | grep -E '^apiserver( |$)' | cat" register: result_get_route_apiserver @@ -106,31 +96,16 @@ - set_fact: service_catalog_endpoint: "{{ result_service_catalog_endpoint.stdout }}" - # Falling back to using the unauthenticated IP of the Pod/Port for now - - name: Get IP of APIServer - shell: "{{ oc_cmd }} -n service-catalog describe pod `{{ oc_cmd }} get pods -n service-catalog | grep apiserver | awk '{print $1}'` | grep IP | awk '{print $2}'" - register: result_apiserver_ip - retries: 6 - delay: 10 - - set_fact: - service_catalog_api_server_ip: "{{ result_apiserver_ip.stdout }}" svc_cat_kube_config: "{{ ansible_env.HOME }}/.kube/service-catalog.config" - #- name: Creating .kube/service-catalog.config from kubeconfig.templ.yaml.j2 - # template: - # src: kubeconfig.templ.yaml.j2 - # dest: "{{ ansible_env.HOME }}/.kube/service-catalog.config" - # owner: "{{ ansible_env.USER }}" - #group: "{{ ansible_env.USER }}" - # mode: 0644 - - name: Remove {{ svc_cat_kube_config }} if present file: path: "{{ svc_cat_kube_config }}" state: absent become: true + # Below setups a kube config using the authenticated route for the apiserver from service catalog - name: Create cluster entry in kube config for apiserver of service catalog shell: "{{ kubectl_cmd }} config set-cluster service-catalog-cluster --insecure-skip-tls-verify=true --server=https://{{ service_catalog_endpoint }} --kubeconfig={{ svc_cat_kube_config }}" From f53062d3d48138322351d72e6e48753058d0387e Mon Sep 17 00:00:00 2001 From: John Matthews Date: Sun, 21 May 2017 12:11:41 -0400 Subject: [PATCH 18/21] Cleanup tweaks --- local/mac/reset_environment.sh | 2 +- local/mac/run_mac_local.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/local/mac/reset_environment.sh b/local/mac/reset_environment.sh index 1f903fe..3c05b46 100755 --- a/local/mac/reset_environment.sh +++ b/local/mac/reset_environment.sh @@ -2,4 +2,4 @@ ANS_CODE="../../ansible" source ./common_vars -ansible-playbook -vv ${ANS_CODE}/reset_mac_environment.yml --extra-vars "${EXTRA_VARS}" +ansible-playbook ${ANS_CODE}/reset_mac_environment.yml --extra-vars "${EXTRA_VARS}" diff --git a/local/mac/run_mac_local.sh b/local/mac/run_mac_local.sh index fffdcfb..7cf3b86 100755 --- a/local/mac/run_mac_local.sh +++ b/local/mac/run_mac_local.sh @@ -2,4 +2,4 @@ ANS_CODE="../../ansible" source ./common_vars -ansible-playbook -i ${ANS_CODE}/library/inventory/docker-machine.py ${ANS_CODE}/setup_mac_environment.yml --extra-vars "${EXTRA_VARS}" +ansible-playbook ${ANS_CODE}/setup_mac_environment.yml --extra-vars "${EXTRA_VARS}" From 4bc74dc7f066146fa70f91558ed607c4edd2c610 Mon Sep 17 00:00:00 2001 From: John Matthews Date: Sun, 21 May 2017 12:14:03 -0400 Subject: [PATCH 19/21] Remove test_asb_up.sh --- local/mac/test_asb_up.sh | 6 ------ 1 file changed, 6 deletions(-) delete mode 100755 local/mac/test_asb_up.sh diff --git a/local/mac/test_asb_up.sh b/local/mac/test_asb_up.sh deleted file mode 100755 index 7d9bf75..0000000 --- a/local/mac/test_asb_up.sh +++ /dev/null @@ -1,6 +0,0 @@ -#URL="https://127.0.0.1.nip.io:8443" -#URL="https://172.31.0.19.nip.io:8443" -URL="https://172.17.0.1.nip.io:8443" - - -docker run -e OPENSHIFT_TARGET=${URL} -e OPENSHIFT_USER=admin -e OPENSHIFT_PASS=admin ansibleplaybookbundle/ansible-service-broker-apb:summit -e dockerhub_user=foo -e dockerhub_pass=foo -e openshift_target ${URL} -e openshift_user admin -e openshift_pass admin From 84876749cbceabb3071f6d4eef941fb0add5ce23 Mon Sep 17 00:00:00 2001 From: John Matthews Date: Mon, 22 May 2017 10:56:06 -0400 Subject: [PATCH 20/21] README formatting tweak --- local/mac/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/local/mac/README.md b/local/mac/README.md index 751b958..7bb2a20 100644 --- a/local/mac/README.md +++ b/local/mac/README.md @@ -10,7 +10,7 @@ These playbooks will: ### Pre-Reqs * ```socat``` needs to be installed - brew install socat + brew install socat * We can NOT work with latest Docker for Mac. * Older version of Docker for Mac needs to be installed * https://download.docker.com/mac/stable/1.12.6.14937/Docker.dmg From 4f17208c85dd063000dea31e93140492505bf380 Mon Sep 17 00:00:00 2001 From: John Matthews Date: Mon, 22 May 2017 10:57:29 -0400 Subject: [PATCH 21/21] Tweak --- local/mac/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/local/mac/README.md b/local/mac/README.md index 7bb2a20..912025b 100644 --- a/local/mac/README.md +++ b/local/mac/README.md @@ -10,7 +10,9 @@ These playbooks will: ### Pre-Reqs * ```socat``` needs to be installed + brew install socat + * We can NOT work with latest Docker for Mac. * Older version of Docker for Mac needs to be installed * https://download.docker.com/mac/stable/1.12.6.14937/Docker.dmg