set_loopback_context.yml 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. ---
  2. - name: Test local loopback context
  3. command: >
  4. {{ openshift_client_binary }} config view
  5. --config={{ openshift_master_loopback_config }}
  6. changed_when: false
  7. register: l_loopback_config
  8. - command: >
  9. {{ openshift_client_binary }} config set-cluster
  10. --certificate-authority={{ openshift_master_config_dir }}/ca.crt
  11. --embed-certs=true --server={{ openshift.master.loopback_api_url }}
  12. {{ openshift.master.loopback_cluster_name }}
  13. --config={{ openshift_master_loopback_config }}
  14. when:
  15. - loopback_context_string not in l_loopback_config.stdout
  16. register: set_loopback_cluster
  17. - command: >
  18. {{ openshift_client_binary }} config set-context
  19. --cluster={{ openshift.master.loopback_cluster_name }}
  20. --namespace=default --user={{ openshift.master.loopback_user }}
  21. {{ openshift.master.loopback_context_name }}
  22. --config={{ openshift_master_loopback_config }}
  23. when:
  24. - set_loopback_cluster is changed
  25. register: l_set_loopback_context
  26. - command: >
  27. {{ openshift_client_binary }} config use-context {{ openshift.master.loopback_context_name }}
  28. --config={{ openshift_master_loopback_config }}
  29. when:
  30. - l_set_loopback_context is changed
  31. register: set_current_context