diff options
Diffstat (limited to 'ansible/roles')
-rw-r--r-- | ansible/roles/kubectl/defaults/main.yml | 3 | ||||
-rw-r--r-- | ansible/roles/kubectl/tasks/main.yml | 10 | ||||
-rw-r--r-- | ansible/roles/rancher/defaults/main.yml | 2 | ||||
-rw-r--r-- | ansible/roles/rancher/tasks/rancher_server.yml | 10 | ||||
-rw-r--r-- | ansible/roles/rancher/templates/kube_config.j2 (renamed from ansible/roles/kubectl/templates/kube_config.j2) | 0 | ||||
-rw-r--r-- | ansible/roles/rke/defaults/main.yml | 2 | ||||
-rw-r--r-- | ansible/roles/rke/tasks/rke_deploy.yml | 12 |
7 files changed, 26 insertions, 13 deletions
diff --git a/ansible/roles/kubectl/defaults/main.yml b/ansible/roles/kubectl/defaults/main.yml index 78c15c75..b922fb58 100644 --- a/ansible/roles/kubectl/defaults/main.yml +++ b/ansible/roles/kubectl/defaults/main.yml @@ -1,5 +1,2 @@ --- kubectl_bin_dir: /usr/local/bin -kube_directory: ~/.kube -# Defaulting to rancher setup -kube_server: "https://{{ ansible_host }}:8080/r/projects/{{ k8s_env_id | mandatory }}/kubernetes:6443"
\ No newline at end of file diff --git a/ansible/roles/kubectl/tasks/main.yml b/ansible/roles/kubectl/tasks/main.yml index 9ecb5c44..7c77c3c5 100644 --- a/ansible/roles/kubectl/tasks/main.yml +++ b/ansible/roles/kubectl/tasks/main.yml @@ -5,13 +5,3 @@ dest: "{{ kubectl_bin_dir }}/kubectl" remote_src: true mode: 0755 - -- name: Ensure .kube directory exists - file: - path: "{{ kube_directory }}" - state: directory - -- name: Create kube config - template: - src: kube_config.j2 - dest: "{{ kube_directory }}/config" diff --git a/ansible/roles/rancher/defaults/main.yml b/ansible/roles/rancher/defaults/main.yml index 6d354e6e..e4e12d23 100644 --- a/ansible/roles/rancher/defaults/main.yml +++ b/ansible/roles/rancher/defaults/main.yml @@ -4,6 +4,8 @@ rancher_remove_other_env: true rancher_redeploy_k8s_env: true rancher_cluster_health_state: healthy rancher_cluster_health_check_retries: 30 +kube_directory: ~/.kube +kube_server: "https://{{ ansible_host }}:8080/r/projects/{{ k8s_env_id | mandatory }}/kubernetes:6443" rancher: # The following variables can be set via the UI under advanced/settings. # All of these affect tables in the cattle db and are uninteresting diff --git a/ansible/roles/rancher/tasks/rancher_server.yml b/ansible/roles/rancher/tasks/rancher_server.yml index a0893b0b..f467ff3f 100644 --- a/ansible/roles/rancher/tasks/rancher_server.yml +++ b/ansible/roles/rancher/tasks/rancher_server.yml @@ -93,3 +93,13 @@ data: option: audit_log.purge.after.seconds value: "{{ rancher.audit_log_purge_after_seconds }}" + +- name: Ensure .kube directory exists + file: + path: "{{ kube_directory }}" + state: directory + +- name: Create kube config + template: + src: kube_config.j2 + dest: "{{ kube_directory }}/config" diff --git a/ansible/roles/kubectl/templates/kube_config.j2 b/ansible/roles/rancher/templates/kube_config.j2 index 586c59d4..586c59d4 100644 --- a/ansible/roles/kubectl/templates/kube_config.j2 +++ b/ansible/roles/rancher/templates/kube_config.j2 diff --git a/ansible/roles/rke/defaults/main.yml b/ansible/roles/rke/defaults/main.yml index 3e1c26a6..cbf03b74 100644 --- a/ansible/roles/rke/defaults/main.yml +++ b/ansible/roles/rke/defaults/main.yml @@ -2,8 +2,10 @@ rke_binary: rke rke_username: rke rke_bin_dir: /usr/local/bin +kube_config_dir: "{{ ansible_env.HOME }}/.kube" cluster_config_dir: "{{ app_data_path }}/cluster" rke: + # rke (rancher) images etcd: rancher/coreos-etcd:v3.2.24-rancher1 alpine: rancher/rke-tools:v0.1.27 nginx_proxy: rancher/rke-tools:v0.1.27 diff --git a/ansible/roles/rke/tasks/rke_deploy.yml b/ansible/roles/rke/tasks/rke_deploy.yml index 7b3e2510..9983d08a 100644 --- a/ansible/roles/rke/tasks/rke_deploy.yml +++ b/ansible/roles/rke/tasks/rke_deploy.yml @@ -3,3 +3,15 @@ command: "{{ rke_bin_dir }}/rke up --config cluster.yml" args: chdir: "{{ cluster_config_dir }}" + +- name: Ensure .kube directory is present + file: + path: "{{ kube_config_dir }}" + state: directory + +- name: Setup kubeconfig + copy: + src: "{{ cluster_config_dir }}/kube_config_cluster.yml" + dest: "{{ kube_config_dir }}/config" + remote_src: true + mode: 0755 |