federate-clusters.yml 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. ---
  2. - name: Make sure all secured clusters are federated
  3. hosts: workstation.lab.example.com
  4. gather_subset: min
  5. become: no
  6. vars:
  7. clusters:
  8. ocp4:
  9. name: rhacs-cluster
  10. namespace: rhacs
  11. method: operator
  12. sno1:
  13. name: sno1
  14. namespace: stackrox
  15. method: roxctl
  16. k3s:
  17. name: k3s
  18. namespace: stackrox
  19. method: helm
  20. pull_user: '|uhc-pool-9f005376-36a2-42a1-a540-0473dc873633'
  21. pull_pass: 'eyJhbGciOiJSUzUxMiJ9.eyJzdWIiOiI5ODg5YWExYzBmOWI0ZjU3Yjk3NmI5ZWEyMzIwZjU0MCJ9.sZd9TMQo0WDG65G9BMNnknbPcFB36hrDXd18_u3KxqZs7e8maC_PxAQxjpuY4aS6TDHnLC5jFb4Q5qXTJVn2B8a8p1ncO-3n2HnPt876i-UACSyeukioy8hr4WwufHQxUX2lqXXXv3znQ7jmTECAsnkZCQHU5tSiFsTdxEdfdyN6gm17ujckadnMlPYq6_SR6mKKiJTtT7HYCYrAVNsgK_4adgc-EpelKGlcDEi34hXo1jlB3DDrQi1ILBWE0fGWoW3g-YS1F0YD_74nmWINfPMc3nT8DZAit8L4VQONvgPNubu_MUFPhj_oUR1wUDtkPQ6KIvo6Qf2FGp2wK3PzbtADQsEVSd9HO47kDJtahnOya1fFgjeY5lSq-moOdjRWBgu6_3H_nedLIGYPDtAfzypbuxvupGu3hXZusyctiDmGm7JDyEnJv1uDVfaWnSa3I_MpTRUW2ee5D_Bjrey7eSb4lJFrjux-gcbUhqlXbYsizk7WXzoFkkTYLuqCCQoKRt8WR7U3Nhwst6rEwxANibENSsQPw0h8_CCFnjLqRN_6qjSsKiydFOkGTYbOKZNKZIUabFEN4aaTUbiXMWOKa2jMq-Hpk0L4J0RkN3bdAUjZkDDq4dV5eQcusHy_KcogwUJJ6x03Nns8oLAv4IgtJyyqra5aBGJLQxscEuR740Y'
  22. tasks:
  23. - name: find api endpoint
  24. stat:
  25. path: "{{ ansible_facts['user_dir'] }}/api-endpoint"
  26. register: api_endpoint_is_there
  27. - assert:
  28. that: api_endpoint_is_there.stat.exists
  29. fail_msg: "ERROR: api-endpoint file not found. This usually means prerequisites (such as central deployment) are not met."
  30. success_msg: "OK: api-endpoint found."
  31. - name: load api endpoint
  32. set_fact:
  33. api_ep: "{{ lookup('file', ansible_facts['user_dir'] + '/api-endpoint') }}"
  34. - name: find api token
  35. stat:
  36. path: "{{ ansible_facts['user_dir'] }}/api-token"
  37. register: api_token_is_there
  38. - assert:
  39. that: api_token_is_there.stat.exists
  40. fail_msg: "ERROR: api-token file not found. This usually means prerequisites (such as central deployment) are not met."
  41. success_msg: "OK: api-token found."
  42. - name: load api token
  43. set_fact:
  44. api_token: "{{ lookup('file', ansible_facts['user_dir'] + '/api-token') }}"
  45. - include_role:
  46. name: federate-clusters
  47. tags: federate
  48. loop: "{{ clusters.keys() | list }}"
  49. loop_control:
  50. loop_var: cluster
  51. ...