blob: 9abf986b17c4d0747639a70f002f55f826b132a7 [file] [log] [blame]
Michal Ptacek89134622018-12-19 12:10:34 +00001---
2# DO NOT ADD SPACE AROUND ';'
3- name: Start rancher/server:v1.6.14
4 docker_container:
5 name: rancher_server
6 image: rancher/server:v1.6.14
7 command: ["sh", "-c", "/usr/sbin/update-ca-certificates;/usr/bin/entry /usr/bin/s6-svscan /service"]
8 ports: 8080:8080
9 state: started
10 restart_policy: unless-stopped
11 volumes:
12 - "{{ app_data_path }}/certs:/usr/local/share/ca-certificates/extra:ro"
13
14- name: Wait for rancher server to be ready
15 uri:
16 url: "{{ rancher_server_url }}/v2-beta"
17 register: response
18 retries: 10
19 delay: 30
20 until: not response.failed
21
22- name: Create kubernetes environment
23 rancher_k8s_environment:
24 name: "{{ app_name }}"
25 descr: "Kubernetes environment for {{ app_name }}"
26 server: "{{ rancher_server_url }}"
27 delete_other_k8s: "{{ rancher_remove_other_env }}"
28 force: "{{ rancher_redeploy_k8s_env }}"
29 host_os: "{{ ansible_os_family }}"
30 register: env
31 retries: 10
32 delay: 5
33 until: env.data is defined
34
35- name: Set apikey values
36 set_fact:
37 k8s_env_id: "{{ env.data.environment.id }}"
38 key_public: "{{ env.data.apikey.public }}"
39 key_private: "{{ env.data.apikey.private }}"
40 rancher_agent_image: "{{ env.data.registration_tokens.image }}"
41 rancher_agent_reg_url: "{{ env.data.registration_tokens.reg_url }}"
42
43- name: Ensure .kube directory exists
44 file:
45 path: "{{ kube_directory }}"
46 state: directory
47
48- name: Create kube config
49 template:
50 src: kube_config.j2
51 dest: "{{ kube_directory }}/config"