interop-workloads/workloads/ansible/shade/k8s/site.yml

131 lines
2.8 KiB
YAML
Executable File

---
- name: Get start timestamp
hosts: cloud
connection: local
tasks:
- set_fact:
starttime: "{{ ansible_date_time }}"
tags: "info"
- name: Prepare to run the workload
hosts: cloud
connection: local
vars_files:
- "vars/{{ env }}.yml"
tasks:
- include: "roles/prepare/tasks/{{ action }}.yml"
roles:
- prepare
tags: "{{ action }}"
- name: provision servers
hosts: prohosts
connection: local
strategy: free
vars_files:
- "vars/{{ env }}.yml"
tasks:
- include: "roles/provision/tasks/{{ action }}.yml"
roles:
- provision
tags: "{{ action }}"
- name: Post provision process
hosts: cloud
connection: local
vars_files:
- "vars/{{ env }}.yml"
tasks:
- include: "roles/postprovision/tasks/{{ action }}.yml"
roles:
- postprovision
tags: "{{ action }}"
- name: Boot strap all the target nodes
hosts: cmasters, cworkers
gather_facts: False
user: "{{ app_env.ssh_user }}"
become: true
become_user: root
strategy: free
vars_files:
- "vars/{{ env }}.yml"
roles:
- vmware.coreos-bootstrap
tags: "apply"
- name: Install required packages for all nodes
hosts: cworkers, cmasters, uworkers, umasters
gather_facts: False
user: "{{ app_env.ssh_user }}"
become: true
become_user: root
strategy: free
vars_files:
- "vars/{{ env }}.yml"
roles:
- common
environment: "{{ proxy_env }}"
tags: "common"
- name: Setup master
hosts: cmasters, umasters
gather_facts: true
user: "{{ app_env.ssh_user }}"
become: true
become_user: root
vars_files:
- "vars/{{ env }}.yml"
roles:
- master
environment: "{{ proxy_env }}"
tags: "master"
- name: Setup workers
hosts: cworkers, cmasters, uworkers, umasters
gather_facts: true
user: "{{ app_env.ssh_user }}"
become: true
become_user: root
strategy: free
vars_files:
- "vars/{{ env }}.yml"
roles:
- worker
environment: "{{ proxy_env }}"
tags: "worker"
- name: Post configurations
hosts: cmasters, umasters
gather_facts: true
user: "{{ app_env.ssh_user }}"
become: true
become_user: root
vars_files:
- "vars/{{ env }}.yml"
tasks:
- include: "roles/post/tasks/{{ action }}.yml"
roles:
- post
environment: "{{ proxy_env }}"
tags: "post"
- name: Inform the installer
hosts: cloud
connection: local
tasks:
- debug:
msg: >-
Access kubernetes dashboard at
http://{{ groups['umasters'][0] }}:30000
when: groups['umasters'] is defined
- debug:
msg: >-
Access kubernetes dashboard at
http://{{ groups['cmasters'][0] }}:30000
when: groups['cmasters'] is defined
- debug:
msg: >-
The work load started at {{ hostvars.cloud.starttime.time }},
ended at {{ ansible_date_time.time }}
tags: "info"