Skip to content

Instantly share code, notes, and snippets.

View alexandrem's full-sized avatar

Alexandre Mclean alexandrem

  • Ubisoft
  • Quebec
View GitHub Profile
@alexandrem
alexandrem / 1_README.md
Created November 13, 2018 16:08 — forked from superseb/1_README.md
Generate Rancher 2 cluster/node agent definitions

Generate Rancher 2 cluster/node agents definitions

This is not official documentation/tooling, use with caution

This generate the Kubernetes definitions of the cattle-cluster-agent Deployment and cattle-node-agent DaemonSet, in case it's accidentally removed/server-url was changed/certficates were changed. It is supposed to run on every cluster Rancher manages. If you have custom clusters created in Rancher, see Kubeconfig for Custom clusters created in Rancher how to obtain the kubeconfig to directly talk to the Kubernetes API (as usually it doesn't work via Rancher anymore). For other clusters, use the tools provided by the provider to get the kubeconfig.

IMPORTANT: You get the cluster/node agents definitions from Rancher, and you apply them to the cluster that is created/managed so you need to switch kubeconfig to point to that cluster before applying them.

Running it

#Why? Current version of Ansible (1.7.1) does not merge hashes in the include_vars task even if told so via hash_behaviour = merge in your ansible.cfg. ansible/ansible#9116

This action plugin will merge hashes no matter how you have configured your hash_behaviour.

#Compatibility Tested on Ansible 1.9.0.1

#Updates

  • Now works both for explicit inventory hosts and aliases (e.g ansible_ssh_host)