Add post-deployment playbook and role

The post-deployment playbook and associated role installs kubectl
using package manager and copies kubernetes config fine in ~/.kube
in order to be able to interact with kubernetes cluster.

The post-deployment playbook and the role can be used for other and
perhaps scenario specific tasks as well with a corresponding post-deployment
playbook in scenario directory if it exists.

Change-Id: Ifcf9925d126141e34114a80b5e168c8a8b986234
diff --git a/playbooks/post-deployment.yml b/playbooks/post-deployment.yml
new file mode 100644
index 0000000..4892a60
--- /dev/null
+++ b/playbooks/post-deployment.yml
@@ -0,0 +1,30 @@
+---
+# ============LICENSE_START=======================================================
+#  Copyright (C) 2019 The Nordix Foundation. All rights reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+
+- hosts: localhost
+  connection: local
+  gather_facts: true
+  become: yes
+  vars_files:
+    - "{{ engine_path }}/engine/var/global.yml"
+
+  roles:
+    - role: post-deployment
+
+# vim: set ts=2 sw=2 expandtab:
diff --git a/playbooks/roles/post-deployment/tasks/install-packages-ubuntu16.yml b/playbooks/roles/post-deployment/tasks/install-packages-ubuntu16.yml
new file mode 100644
index 0000000..f087be7
--- /dev/null
+++ b/playbooks/roles/post-deployment/tasks/install-packages-ubuntu16.yml
@@ -0,0 +1,37 @@
+---
+# ============LICENSE_START=======================================================
+#  Copyright (C) 2019 The Nordix Foundation. All rights reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+
+- name: Add Google official gpg key
+  apt_key:
+    url: "https://packages.cloud.google.com/apt/doc/apt-key.gpg"
+    state: present
+
+- name: Add kubernetes apt repository
+  apt_repository:
+    repo: "deb https://apt.kubernetes.io/ kubernetes-xenial main"
+    state: present
+
+- name: Install kubectl
+  apt:
+    name: kubectl
+    state: present
+    update_cache: yes
+    allow_unauthenticated: yes
+
+# vim: set ts=2 sw=2 expandtab:
diff --git a/playbooks/roles/post-deployment/tasks/main.yml b/playbooks/roles/post-deployment/tasks/main.yml
new file mode 100644
index 0000000..25ee224
--- /dev/null
+++ b/playbooks/roles/post-deployment/tasks/main.yml
@@ -0,0 +1,44 @@
+---
+# ============LICENSE_START=======================================================
+#  Copyright (C) 2019 The Nordix Foundation. All rights reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+
+- name: Set distribution
+  set_fact:
+    distribution: "{{ ansible_distribution | lower }}{{ ansible_distribution_major_version }}"
+
+- name: Install packages on {{ distribution }}
+  include_tasks: "install-packages-{{ distribution }}.yml"
+
+- name: Ensure /home/{{ ansible_env.SUDO_USER }}/.kube folder exists and empty
+  file:
+    path: "/home/{{ ansible_env.SUDO_USER }}/.kube"
+    state: "{{ item }}"
+    owner: "{{ ansible_env.SUDO_USER }}"
+    mode: 0755
+  with_items:
+    - absent
+    - directory
+
+- name: Copy kubernetes admin.conf to /home/{{ ansible_env.SUDO_USER }}/.kube
+  copy:
+    src: "{{ engine_cache }}/repos/kubespray/inventory/engine/artifacts/admin.conf"
+    dest: "/home/{{ ansible_env.SUDO_USER }}/.kube/config"
+    owner: "{{ ansible_env.SUDO_USER }}"
+    mode: 0644
+
+# vim: set ts=2 sw=2 expandtab: