Skip to content
This repository was archived by the owner on Feb 7, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions tests/openshift-ansible-test/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
This playbook performs a sanity test of a stable version of the OpenShift Ansible installer
against an Atomic Host.

The test accepts normal inventory data as like every other test in the repo, then uses that
data to generate a separate inventory that is used when running the OpenShift Ansible
installer playbook.

This playbook only does a sanity check that the installer completes successfully and
the expected pods are running afterwards. This does **NOT** perform any conformance
testing or deployment of additional apps/projects afterwards.

### Prerequisites
- Ansible version 2.2 (other versions are not supported)

- Configure subscription data (if used)

If running against a RHEL Atomic Host, you should provide subscription
data that can be used by `subscription-manager`. See
[roles/redhat_subscription/tasks/main.yml](roles/redhat_subscription/tasks/main.yml)
for additional details.


### Running the Playbook

To run the test, simply invoke as any other Ansible playbook:

```
$ ansible-playbook -i inventory tests/system-containers/main.yml
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is that the right playbook yml file?

```

*NOTE*: You are responsible for providing a host to run the test against and the
inventory file for that host.
1 change: 1 addition & 0 deletions tests/openshift-ansible-test/callback_plugins
16 changes: 10 additions & 6 deletions tests/openshift-ansible-test/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@
set_fact:
oo_ansible_user: "{{ cli_ansible_user | default(ansible_user) }}"
oo_ansible_tag: "{{ cli_oo_ansible_tag | default('master') }}"
oo_host: "{{ cli_oo_host | default(ansible_host) }}"
oo_public_host: "{{ cli_oo_public_host | default(ansible_host) }}"
oo_host: "{{ cli_oo_host | default(ansible_default_ipv4.address) }}"
oo_release: "{{ cli_oo_release | default('1.5.1') }}"
oo_py_interpreter: "{{ '-e ansible_python_interpreter=/usr/bin/python3' if ansible_distribution == 'Fedora' else '' }}"
oo_skip_memory_check: "{{ '-e openshift_disable_check=memory_availability' if ansible_memtotal_mb|int < 8192 else '' }}"

- name: Make temp directory of holding
command: mktemp -d
Expand All @@ -31,11 +34,10 @@
delegate_to: localhost

- name: Run the openshift-ansible playbook
command: ansible-playbook -i cluster-inventory playbooks/byo/config.yml -e 'ansible_python_interpreter=/usr/bin/python3'
command: "ansible-playbook -i cluster-inventory playbooks/byo/config.yml {{ oo_py_interpreter }} {{ oo_skip_memory_check }}"
args:
chdir: "{{ mktemp.stdout }}"
delegate_to: localhost
register: playbook

- name: Wait for 8443 to open up
wait_for:
Expand All @@ -47,10 +49,12 @@
command: /usr/local/bin/oadm policy add-cluster-role-to-user cluster-admin admin

- name: Login to the cluster
command: "/usr/local/bin/oc login -u admin -p OriginAdmin https://{{ oo_host }}:8443"
command: "/usr/local/bin/oc login -u admin -p OriginAdmin https://{{ oo_public_host }}:8443"

# this is kind of a hack
# this is kind of a hack; sometimes need to wait (5m) for the pods
- name: Verify pods are running
command: /usr/local/bin/oc get pods -o jsonpath='{.items[*].status.phase}'
register: pods
failed_when: pods.stdout != "Running Running Running"
until: pods.stdout == "Running Running Running"
retries: 10
delay: 30
1 change: 1 addition & 0 deletions tests/openshift-ansible-test/roles
8 changes: 4 additions & 4 deletions tests/openshift-ansible-test/templates/cluster-inventory.j2
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ ansible_become=true
deployment_type=origin
containerized=true
openshift_release={{ oo_release }}
openshift_master_default_subdomain={{ oo_host}}.xip.io
openshift_master_default_subdomain={{ oo_public_host }}.xip.io
openshift_router_selector='router=true'
openshift_registry_selector='registry=true'

Expand All @@ -18,10 +18,10 @@ openshift_master_identity_providers=[{'name': 'htpasswd_auth', 'login': 'true',
openshift_master_htpasswd_users={'admin': '$apr1$zgSjCrLt$1KSuj66CggeWSv.D.BXOA1'}

[masters]
{{ oo_host }}
{{ oo_public_host }} openshift_public_hostname={{ oo_public_host }} openshift_hostname={{ oo_host }}

[etcd]
{{ oo_host }}
{{ oo_public_host }}

[nodes]
{{ oo_host }} openshift_schedulable=true openshift_node_labels="{'router':'true','registry':'true'}"
{{ oo_public_host }} openshift_schedulable=true openshift_node_labels="{'router':'true','registry':'true'}"