New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modernized Hello-World APB #3
Changes from all commits
2e1eca9
6f7c47c
dd4396c
cfec4aa
a65cba5
7e161c7
fa36263
e96daf2
cca6daa
f11efa6
0cfbbec
3b47b40
06837b9
781ddc4
1ff42d2
6a9a597
cd31f6f
06134c4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| --- | ||
| services: docker | ||
| sudo: required | ||
| language: python | ||
| python: | ||
| - '2.7' | ||
|
|
||
| env: | ||
| - OPENSHIFT_VERSION=latest | ||
| - OPENSHIFT_VERSION=v3.9 | ||
| - KUBERNETES_VERSION=latest | ||
| - KUBERNETES_VERSION=v1.9.0 | ||
|
|
||
| script: | ||
| # Configure test values | ||
| - export apb_name='hello-world-apb' | ||
|
|
||
| # Download test shim. | ||
| - wget -O ${PWD}/apb-test.sh https://raw.githubusercontent.com/ansibleplaybookbundle/apb-test-shim/master/apb-test.sh | ||
| - chmod +x ${PWD}/apb-test.sh | ||
|
|
||
| # Run tests. | ||
| - ${PWD}/apb-test.sh | ||
|
|
||
| # notifications: | ||
| # webhooks: https://galaxy.ansible.com/api/v1/notifications/ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,20 +1,24 @@ | ||
| FROM ansibleplaybookbundle/apb-base | ||
| FROM ansibleplaybookbundle/apb-base:canary | ||
|
|
||
| LABEL "com.redhat.apb.spec"=\ | ||
| "dmVyc2lvbjogMS4wCm5hbWU6IGhlbGxvLXdvcmxkLWFwYgpkZXNjcmlwdGlvbjogZGVwbG95cyBo\ | ||
| ZWxsby13b3JsZCB3ZWIgYXBwbGljYXRpb24KYmluZGFibGU6IEZhbHNlCmFzeW5jOiBvcHRpb25h\ | ||
| bAptZX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ybGQgd2ViIGFwcGxpY2F0aW9uCiAgZGVwZW5kZW5jaWVzOiBbJ2RvY2tlci5p\ | ||
| by9hbnNpYmxlcGxheWJvb2tidW5kbGUvaGVsbG8td29ybGQ6bGF0ZXN0J10KICBwcm92aWRlckRp\ | ||
| c3BsYXlOYW1lOiAiUmVkIEhhdCwgSW5jLiIKcGxhbnM6CiAgLSBuYW1lOiBkZWZhdWx0CiAgICBk\ | ||
| ZXNjcmlwdGlvbjogQSBzYW1wbGUgQVBCIHdoaWNoIGRlcGxveXMgSGVsbG8gV29ybGQKICAgIGZy\ | ||
| ZWU6ICJUcnVlIgogICAgbWV0YWRhdGE6CiAgICAgIGRpc3BsYXlOYW1lOiBEZWZhdWx0CiAgICAg\ | ||
| IGxvbmdEZXNjcmlwdGlvbjoKICAgICAgICBUaGlzIHBsYW4gZGVwbG95cyBhIFB5dGhvbiB3ZWIg\ | ||
| YXBwbGljYXRpb24gZGlzcGxheWluZyBIZWxsbyBXb3JsZAogICAgICBjb3N0OiAkMC4wMAogICAg\ | ||
| cGFyYW1ldGVyczogW10K" | ||
|
|
||
| ADD playbooks /opt/apb/actions | ||
| ADD roles /opt/ansible/roles | ||
|
|
||
| # Add our role into the ansible roles dir | ||
| ADD . /opt/ansible/roles/hello-world-apb | ||
|
|
||
| RUN chmod -R g=u /opt/{ansible,apb} | ||
|
|
||
| USER apb |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,20 +1,30 @@ | ||
| hello-world-apb | ||
| ====================== | ||
|
|
||
| An apb for deploying a simple [hello world](https://hub.docker.com/r/ansibleplaybookbundle/hello-world/) app that can bind to Postgres for testing purposes. | ||
| [](https://travis-ci.org/ansibleplaybookbundle/hello-world-apb) | ||
|
|
||
| ## What it does | ||
| * Deploys a bindable web app. | ||
| An apb for deploying a simple [hello world](https://hub.docker.com/r/ansibleplaybookbundle/hello-world/) app that can be bound to PostgreSQL for testing purposes. | ||
|
|
||
| ## Requirements | ||
| ## What it does | ||
| * Deploys a web app that can be bound to a database. | ||
|
|
||
| ## Parameters | ||
| * NAMESPACE: Optional, default 'hello-world', Namespace to deploy the cluster in. | ||
| * OPENSHIFT_TARGET: Required, target openshift deployment | ||
| * OPENSHIFT_TOKEN: Required, openshift token to authenticate as | ||
|
|
||
| ## Running the application | ||
| `docker run -e "OPENSHIFT_TARGET=<openshift_target>" -e "OPENSHIFT_TOKEN=<token>" ansibleplaybookbundle/hello-world-apb provision` | ||
| ``` | ||
| docker run --rm --net=host \ | ||
| -v $HOME/.kube:/opt/apb/.kube:z \ | ||
| -u $UID \ | ||
| docker.io/ansibleplaybookbundle/hello-world-apb \ | ||
| provision --extra-vars 'namespace=hello-world' | ||
| ``` | ||
|
|
||
| ## Tearing down the application | ||
| `docker run -e "OPENSHIFT_TARGET=<openshift_target>" -e "OPENSHIFT_TOKEN=<token>" ansibleplaybookbundle/hello-world-apb deprovision` | ||
| ``` | ||
| docker run --rm --net=host \ | ||
| -v $HOME/.kube:/opt/apb/.kube:z \ | ||
| -u $UID \ | ||
| docker.io/ansibleplaybookbundle/hello-world-apb \ | ||
| deprovision --extra-vars 'namespace=hello-world' | ||
| ``` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,19 +1,22 @@ | ||
| --- | ||
| version: 1.0 | ||
| name: hello-world-apb | ||
| description: deploys hello-world web application | ||
| bindable: False | ||
| bindable: "False" | ||
| async: optional | ||
| metadata: | ||
| displayName: Hello World (APB) | ||
| longDescription: A sample APB which deploys a containerized Hello World web application | ||
| longDescription: | ||
| A sample APB which deploys a containerized Hello World web application | ||
| dependencies: ['docker.io/ansibleplaybookbundle/hello-world:latest'] | ||
| providerDisplayName: "Red Hat, Inc." | ||
| plans: | ||
| - name: default | ||
| description: A sample APB which deploys Hello World | ||
| free: True | ||
| free: "True" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ^^ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as above |
||
| metadata: | ||
| displayName: Default | ||
| longDescription: This plan deploys a Python web application displaying Hello World | ||
| longDescription: | ||
| This plan deploys a Python web application displaying Hello World | ||
| cost: $0.00 | ||
| parameters: [] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| --- | ||
| apb_name: hello-world | ||
|
|
||
| # Defaults for values we could expect from a broker | ||
| _apb_plan_id: default | ||
| _apb_service_class_id: 0 | ||
| _apb_service_instance_id: 0 | ||
|
|
||
| state_map: | ||
| provision: present | ||
| deprovision: absent | ||
| state: "{{ state_map[apb_action] }}" | ||
|
|
||
| cluster: kubernetes | ||
|
|
||
| name: "{{ apb_name }}-{{ _apb_service_instance_id }}" | ||
| namespace: "{{ lookup('env','NAMESPACE') | default('hello-world', true) }}" | ||
| image: docker.io/ansibleplaybookbundle/hello-world:latest |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| galaxy_info: | ||
| author: Automation Broker Team | ||
| description: Deploys hello-world web application in OpenShift/Kubernetes | ||
| company: Red Hat | ||
|
|
||
| # If the issue tracker for your role is not on github, uncomment the | ||
| # next line and provide a value | ||
| # issue_tracker_url: http://example.com/issue/tracker | ||
|
|
||
| # Some suggested licenses: | ||
| # - BSD (default) | ||
| # - MIT | ||
| # - GPLv2 | ||
| # - GPLv3 | ||
| # - Apache | ||
| # - CC-BY | ||
| license: license (GPLv2, CC-BY, etc) | ||
|
|
||
| min_ansible_version: 1.5 | ||
|
|
||
| # If this a Container Enabled role, provide the minimum Ansible Container version. | ||
| # min_ansible_container_version: | ||
|
|
||
| # Optionally specify the branch Galaxy will use when accessing the GitHub | ||
| # repo for this role. During role install, if no tags are available, | ||
| # Galaxy will use this branch. During import Galaxy will access files on | ||
| # this branch. If Travis integration is configured, only notifications for this | ||
| # branch will be accepted. Otherwise, in all cases, the repo's default branch | ||
| # (usually master) will be used. | ||
| #github_branch: | ||
|
|
||
| # | ||
| # platforms is a list of platforms, and each platform has a name and a list of versions. | ||
| # | ||
| # platforms: | ||
| # - name: Fedora | ||
| # versions: | ||
| # - all | ||
| # - 25 | ||
| # - name: SomePlatform | ||
| # versions: | ||
| # - all | ||
| # - 1.0 | ||
| # - 7 | ||
| # - 99.99 | ||
|
|
||
| galaxy_tags: [] | ||
| # List tags for your role here, one per line. A tag is a keyword that describes | ||
| # and categorizes the role. Users find roles by searching for tags. Be sure to | ||
| # remove the '[]' above, if you add tags to this list. | ||
| # | ||
| # NOTE: A tag is limited to a single word comprised of alphanumeric characters. | ||
| # Maximum 20 tags per role. | ||
|
|
||
| dependencies: [] | ||
| # List your role dependencies here, one per line. Be sure to remove the '[]' above, | ||
| # if you add dependencies to this list. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,7 +3,7 @@ | |
| gather_facts: false | ||
| connection: local | ||
| roles: | ||
| - role: ansible.kubernetes-modules | ||
| install_python_requirements: no | ||
| - role: deprovision-hello-world-apb | ||
| playbook_debug: false | ||
| - role: ansibleplaybookbundle.asb-modules | ||
| - role: hello-world-apb | ||
| vars: | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The spacing here and in provision.yml looks weird to me, does this work? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It does work. Not sure what I would do to improve it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, seeing it in the email cleared it up. Thought the var was attached to the role include and not the play. |
||
| apb_action: deprovision | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| - name: hello-world-apb provision | ||
| hosts: localhost | ||
| gather_facts: false | ||
| connection: local | ||
| roles: | ||
| - role: ansibleplaybookbundle.asb-modules | ||
| tasks: | ||
| - name: Provision test | ||
| include_role: | ||
| name: hello-world-apb | ||
| vars: | ||
| apb_action: provision | ||
|
|
||
| - name: Deprovision test | ||
| include_role: | ||
| name: hello-world-apb | ||
| vars: | ||
| apb_action: deprovision |
This file was deleted.
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any reason these need to be strings and not bools?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://travis-ci.org/djzager/Hello-World-APB/jobs/339544060