diff options
-rwxr-xr-x | ansible/group_vars/infrastructure.yml | 7 | ||||
-rw-r--r-- | ansible/rancher_kubernetes.yml | 32 | ||||
-rw-r--r-- | ansible/roles/kubectl/defaults/main.yml | 5 | ||||
-rw-r--r-- | ansible/roles/kubectl/tasks/main.yml | 10 | ||||
-rw-r--r-- | ansible/roles/kubectl/templates/kube_config.j2 (renamed from ansible/roles/rancher/templates/kube_config.j2) | 2 | ||||
-rw-r--r-- | ansible/roles/rancher/defaults/main.yml | 4 | ||||
-rw-r--r-- | ansible/roles/rancher/tasks/main.yml | 2 | ||||
-rw-r--r-- | ansible/roles/rancher/tasks/rancher_agent.yml | 4 | ||||
-rw-r--r-- | ansible/roles/rancher/tasks/rancher_health.yml | 8 | ||||
-rw-r--r-- | ansible/roles/rancher/tasks/rancher_server.yml | 14 | ||||
-rw-r--r-- | docs/InstallGuide.rst | 18 |
11 files changed, 64 insertions, 42 deletions
diff --git a/ansible/group_vars/infrastructure.yml b/ansible/group_vars/infrastructure.yml index 450d96f7..a248a514 100755 --- a/ansible/group_vars/infrastructure.yml +++ b/ansible/group_vars/infrastructure.yml @@ -24,11 +24,6 @@ simulated_hosts: - registry.npmjs.org all_simulated_hosts: "{{ simulated_hosts.git + simulated_hosts.http + simulated_hosts.nexus }}" -rancher_server_url: "http://{{ hostvars[groups.infrastructure.0].ansible_host }}:8080" rancher_server_version: v1.6.22 -rancher_remove_other_env: yes -rancher_redeploy_k8s_env: yes -populate_nexus: no -kube_directory: /root/.kube -kubectl_bin_dir: /usr/local/bin +populate_nexus: false helm_bin_dir: /usr/local/bin diff --git a/ansible/rancher_kubernetes.yml b/ansible/rancher_kubernetes.yml index 196f1fc2..e44f18d3 100644 --- a/ansible/rancher_kubernetes.yml +++ b/ansible/rancher_kubernetes.yml @@ -1,31 +1,23 @@ --- -- name: Install binaries for controlling deployment +- name: Deploy rancher server and create k8s env hosts: infrastructure roles: + - role: rancher + vars: + mode: server - kubectl - helm -- name: Deploy rancher server and create k8s env - hosts: infrastructure - roles: - - rancher - vars: - rancher_role: server - -- name: Deploy rancher agents +- name: Deploy rancher agents for kube nodes hosts: kubernetes roles: - - rancher - vars: - rancher_role: agent + - role: rancher + vars: + mode: agent - name: Wait for Kubernetes environment to be healthy hosts: infrastructure - tasks: - - name: Check cluster health - uri: - url: "{{ rancher_server_url }}/v2-beta/projects/{{ k8s_env_id }}" - register: env_info - retries: 30 - delay: 15 - until: "env_info.json.healthState == 'healthy'" + roles: + - role: rancher + vars: + mode: health
\ No newline at end of file diff --git a/ansible/roles/kubectl/defaults/main.yml b/ansible/roles/kubectl/defaults/main.yml new file mode 100644 index 00000000..78c15c75 --- /dev/null +++ b/ansible/roles/kubectl/defaults/main.yml @@ -0,0 +1,5 @@ +--- +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 7c77c3c5..9ecb5c44 100644 --- a/ansible/roles/kubectl/tasks/main.yml +++ b/ansible/roles/kubectl/tasks/main.yml @@ -5,3 +5,13 @@ 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/templates/kube_config.j2 b/ansible/roles/kubectl/templates/kube_config.j2 index 87f332e6..586c59d4 100644 --- a/ansible/roles/rancher/templates/kube_config.j2 +++ b/ansible/roles/kubectl/templates/kube_config.j2 @@ -4,7 +4,7 @@ clusters: - cluster: api-version: v1 insecure-skip-tls-verify: true - server: "https://{{ ansible_host }}:8080/r/projects/{{ k8s_env_id }}/kubernetes:6443" + server: "{{ kube_server }}" name: "{{ app_name }}" contexts: - context: diff --git a/ansible/roles/rancher/defaults/main.yml b/ansible/roles/rancher/defaults/main.yml new file mode 100644 index 00000000..8edc5180 --- /dev/null +++ b/ansible/roles/rancher/defaults/main.yml @@ -0,0 +1,4 @@ +--- +rancher_server_url: "http://{{ hostvars[groups.infrastructure.0].ansible_host }}:8080" +rancher_remove_other_env: true +rancher_redeploy_k8s_env: true diff --git a/ansible/roles/rancher/tasks/main.yml b/ansible/roles/rancher/tasks/main.yml index 1370a39f..045363d0 100644 --- a/ansible/roles/rancher/tasks/main.yml +++ b/ansible/roles/rancher/tasks/main.yml @@ -1,2 +1,2 @@ --- -- include_tasks: "rancher_{{ rancher_role }}.yml" +- include_tasks: "rancher_{{ mode }}.yml" diff --git a/ansible/roles/rancher/tasks/rancher_agent.yml b/ansible/roles/rancher/tasks/rancher_agent.yml index 4c9cb8dd..091503c7 100644 --- a/ansible/roles/rancher/tasks/rancher_agent.yml +++ b/ansible/roles/rancher/tasks/rancher_agent.yml @@ -7,7 +7,7 @@ volumes: - "/var/run/docker.sock:/var/run/docker.sock" - "/var/lib/rancher:/var/lib/rancher" - auto_remove: yes - privileged: yes + auto_remove: true + privileged: true vars: server_hostvars: "{{ hostvars[groups.infrastructure.0] }}" diff --git a/ansible/roles/rancher/tasks/rancher_health.yml b/ansible/roles/rancher/tasks/rancher_health.yml new file mode 100644 index 00000000..b0323739 --- /dev/null +++ b/ansible/roles/rancher/tasks/rancher_health.yml @@ -0,0 +1,8 @@ +--- +- name: Check cluster health + uri: + url: "{{ rancher_server_url }}/v2-beta/projects/{{ k8s_env_id }}" + register: env_info + retries: 30 + delay: 15 + until: "env_info.json.healthState == 'healthy'" diff --git a/ansible/roles/rancher/tasks/rancher_server.yml b/ansible/roles/rancher/tasks/rancher_server.yml index 64b35e4c..ebee6cc7 100644 --- a/ansible/roles/rancher/tasks/rancher_server.yml +++ b/ansible/roles/rancher/tasks/rancher_server.yml @@ -2,7 +2,7 @@ # DO NOT ADD SPACE AROUND ';' - name: Start rancher/server:{{ rancher_server_version }} docker_container: - name: rancher_server + name: rancher-server image: rancher/server:{{ rancher_server_version }} command: ["sh", "-c", "/usr/sbin/update-ca-certificates;/usr/bin/entry /usr/bin/s6-svscan /service"] ports: 8080:8080 @@ -19,7 +19,7 @@ delay: 30 until: not response.failed -- name: Create kubernetes environment +- name: Create rancher kubernetes environment rancher_k8s_environment: name: "{{ app_name }}" descr: "Kubernetes environment for {{ app_name }}" @@ -39,13 +39,3 @@ key_private: "{{ env.data.apikey.private }}" rancher_agent_image: "{{ env.data.registration_tokens.image }}" rancher_agent_reg_url: "{{ env.data.registration_tokens.reg_url }}" - -- 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/docs/InstallGuide.rst b/docs/InstallGuide.rst index fb292fb3..6ed9c328 100644 --- a/docs/InstallGuide.rst +++ b/docs/InstallGuide.rst @@ -298,6 +298,24 @@ Final configuration can resemble the following:: slewclock: true timezone: UTC +.. _oooi_installguide_config_appconfig_overrides: + +Helm chart value overrides +^^^^^^^^^^^^^^^^^^^^^^^^^^ + +If there is a need to change onap settings such as managed openstack credentials, service ports, or even docker image versions used, you can do this by putting settings under the ``overrides`` key in ``application_configuration.yml``. +These settings will override helm values originally stored in ``values.yaml`` files in helm chart directories. + +For example, the following lines could be appended to ``application_configuration.yml`` to set up managed openstack credentials for onap's so component:: + + overrides: + so: + config: + openStackUserName: "os_user" + openStackRegion: "region_name" + openStackKeyStoneUrl: "keystone_url" + openStackEncryptedPasswordHere: "encrypted_password" + .. _oooi_installguide_config_ssh: SSH authentication |