Install kubectl on bridge

With a snap package.  Because apparently that's how that's done.

Change-Id: I0462cc062c2706509215158bca99e7a2ad58675a
This commit is contained in:
James E. Blair 2019-02-07 10:13:21 -08:00
parent 2766ec2595
commit 94d404a535
7 changed files with 29 additions and 4 deletions

View File

@ -19,6 +19,7 @@
- hosts: bridge.openstack.org:!disabled
name: "Base: configure cloud credentials on bridge"
roles:
- install-kubectl
- configure-kubectl
tasks:
- include_role:

View File

@ -3,7 +3,6 @@
name:
- whoopsie
- popularity-contest
- snapd
- lxd
- lxd-client
state: absent

View File

@ -15,7 +15,6 @@
name:
- whoopsie
- popularity-contest
- snapd
- lxd
- lxd-client
state: absent

View File

@ -0,0 +1,5 @@
Install kubectl
**Role Variables**
* None

View File

@ -0,0 +1,16 @@
- name: Install snapd
package:
name: snapd
state: present
- name: Install kubectl
command: snap install kubectl --classic
# /snap/bin is often in the path, but not in a non-login shell, which
# makes it difficult to use via ansible. Add an extra symlink so we
# can always find it.
- name: Symlink snapd into /usr/local/bin
file:
src: /snap/bin/kubectl
dest: /usr/local/bin/kubectl
state: link

View File

@ -58,4 +58,4 @@ clouds:
openstackzuul_arm64ci_username: user
openstackzuul_arm64ci_password: password
openstackzuul_arm64ci_project_name: project
gitea_kube_key: gitea_k8s_key
gitea_kube_key: Z2l0ZWFfazhzX2tleQ==

View File

@ -71,4 +71,9 @@ def test_kube_config(host):
kubeconfig = host.file('/root/.kube/config')
assert kubeconfig.exists
assert b'gitea_k8s_key' in kubeconfig.content
assert b'Z2l0ZWFfazhzX2tleQ==' in kubeconfig.content
def test_kubectl(host):
kube = host.run('kubectl help')
assert kube.rc == 0