-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added conditional for adding sample apps * Add Wordpress with SQL app * updated yaml files with --- between sections
- Loading branch information
Showing
7 changed files
with
194 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,4 @@ | |
become: yes | ||
become_method: sudo | ||
roles: | ||
- sample_apps | ||
- { role: sample_apps, when: deploy_sample_apps } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,3 +33,5 @@ run_bgp_tasks: false | |
bgp_router_ip: 172.16.1.1 | ||
bgp_router_as: 65000 | ||
bgp_myas: 65001 | ||
|
||
deploy_sample_apps: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- | ||
- name: Remove app if exists | ||
shell: if [ -e /tmp/wordpresssql.yaml ]; then kubectl --kubeconfig /etc/kubernetes/admin.conf delete -f /tmp/wordpresssql.yaml; else echo "Existing file not found"; fi | ||
|
||
- name: Copy WordPressSQL YAML to host | ||
template: | ||
src: wordpresssql.yaml | ||
dest: /tmp/wordpresssql.yaml | ||
|
||
- name: Create SQL Secret | ||
command: "kubectl --kubeconfig /etc/kubernetes/admin.conf {{ item }}" | ||
with_items: | ||
- "delete secret mysql-pass" | ||
- "create secret generic mysql-pass --from-literal=password=YOUR_PASSWORD" | ||
|
||
- name: Deploying Wordpress SQL | ||
command: "kubectl --kubeconfig /etc/kubernetes/admin.conf apply -f /tmp/wordpresssql.yaml" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
- import_tasks: PHPGuestbook.yml | ||
- import_tasks: PHPGuestbook.yml | ||
- import_tasks: WordPressSQL.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,163 @@ | ||
kind: PersistentVolume | ||
apiVersion: v1 | ||
metadata: | ||
name: wp-pv-volume1 | ||
labels: | ||
app: wordpress | ||
type: local | ||
spec: | ||
capacity: | ||
storage: 2Gi | ||
accessModes: | ||
- ReadWriteOnce | ||
hostPath: | ||
path: "/tmp/wordpress-data1" | ||
--- | ||
kind: PersistentVolume | ||
apiVersion: v1 | ||
metadata: | ||
name: wp-pv-volume2 | ||
labels: | ||
app: wordpress | ||
type: local | ||
spec: | ||
capacity: | ||
storage: 2Gi | ||
accessModes: | ||
- ReadWriteOnce | ||
hostPath: | ||
path: "/tmp/wordpress-data2" | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: wordpress-mysql | ||
labels: | ||
app: wordpress | ||
spec: | ||
ports: | ||
- port: 3306 | ||
selector: | ||
app: wordpress | ||
tier: mysql | ||
clusterIP: None | ||
--- | ||
apiVersion: v1 | ||
kind: PersistentVolumeClaim | ||
metadata: | ||
name: mysql-pv-claim | ||
labels: | ||
app: wordpress | ||
spec: | ||
accessModes: | ||
- ReadWriteOnce | ||
resources: | ||
requests: | ||
storage: 2Gi | ||
--- | ||
apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2 | ||
kind: Deployment | ||
metadata: | ||
name: wordpress-mysql | ||
labels: | ||
app: wordpress | ||
spec: | ||
selector: | ||
matchLabels: | ||
app: wordpress | ||
tier: mysql | ||
strategy: | ||
type: Recreate | ||
template: | ||
metadata: | ||
labels: | ||
app: wordpress | ||
tier: mysql | ||
spec: | ||
containers: | ||
- image: mysql:5.6 | ||
name: mysql | ||
env: | ||
- name: MYSQL_ROOT_PASSWORD | ||
valueFrom: | ||
secretKeyRef: | ||
name: mysql-pass | ||
key: password | ||
ports: | ||
- containerPort: 3306 | ||
name: mysql | ||
volumeMounts: | ||
- name: mysql-persistent-storage | ||
mountPath: /var/lib/mysql | ||
volumes: | ||
- name: mysql-persistent-storage | ||
persistentVolumeClaim: | ||
claimName: mysql-pv-claim | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: wordpress | ||
labels: | ||
app: wordpress | ||
spec: | ||
ports: | ||
- port: 80 | ||
selector: | ||
app: wordpress | ||
tier: frontend | ||
type: LoadBalancer | ||
--- | ||
apiVersion: v1 | ||
kind: PersistentVolumeClaim | ||
metadata: | ||
name: wp-pv-claim | ||
labels: | ||
app: wordpress | ||
spec: | ||
accessModes: | ||
- ReadWriteOnce | ||
resources: | ||
requests: | ||
storage: 2Gi | ||
--- | ||
apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2 | ||
kind: Deployment | ||
metadata: | ||
name: wordpress | ||
labels: | ||
app: wordpress | ||
spec: | ||
selector: | ||
matchLabels: | ||
app: wordpress | ||
tier: frontend | ||
strategy: | ||
type: Recreate | ||
template: | ||
metadata: | ||
labels: | ||
app: wordpress | ||
tier: frontend | ||
spec: | ||
containers: | ||
- image: wordpress:4.8-apache | ||
name: wordpress | ||
env: | ||
- name: WORDPRESS_DB_HOST | ||
value: wordpress-mysql | ||
- name: WORDPRESS_DB_PASSWORD | ||
valueFrom: | ||
secretKeyRef: | ||
name: mysql-pass | ||
key: password | ||
ports: | ||
- containerPort: 80 | ||
name: wordpress | ||
volumeMounts: | ||
- name: wordpress-persistent-storage | ||
mountPath: /var/www/html | ||
volumes: | ||
- name: wordpress-persistent-storage | ||
persistentVolumeClaim: | ||
claimName: wp-pv-claim |