forked from projectatomic/atomic-host-tests
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.yml
80 lines (66 loc) · 1.96 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
---
#
# This playbook creates a kubernetes cluster on a single system using the
# example in the Red Hat documentation. The cluster contains a database
# and a webserver pod with data from the database to present a webpage that
# says "Red Hat Rocks!"
#
# Execution Steps:
# 1. Subscribe to RedHat if running RHEL Atomic Host
# 2. Create an insecure private registry
# 3. Copy over the mariadb and apache webserver Dockerfile and supporting
# files, build the docker image, tag the image, then push to the private
# registry.
# 4. Setup and start the kubernetes pods
# 5. Setup and start the mariadb and webserver pods
# 6. Verify that the pods are running and that the mariadb and webserver
# can communicate through the kubernetes services
#
- name: k8-cluster
hosts: all
become: yes
roles:
# This playbook requires Ansible 2.2 and an Atomic Host
- role: ansible_version_check
avc_major: "2"
avc_minor: "2"
tags:
- ansible_version_check
- role: osname_set_fact
tags:
- osname_set_fact
- role: redhat_subscription
when: ansible_distribution == 'RedHat'
tags:
- redhat_subscription
- role: docker_private_registry
tags:
- docker_private_registry
- role: docker_build_tag_push
tags:
- docker_build_tag_push
- role: kubernetes_setup
tags:
- kubernetes_setup
- role: k8_cluster_services_rc_setup
tags:
- k8_cluster_services_rc_setup
post_tasks:
- name: check if everything works!
shell: curl http://localhost:80/cgi-bin/action | grep "RedHat rocks"
- name: Kubernetes Cluster - Cleanup
hosts: all
become: yes
tags:
- cleanup
roles:
- role: k8_remove_all
tags:
- k8_remove_all
- role: docker_remove_all
tags:
- docker_remove_all
- role: redhat_unsubscribe
when: ansible_distribution == 'RedHat'
tags:
- redhat_unsubscribe