main.yaml 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. ---
  2. - fail:
  3. msg: "The openshift_manageiq role requires OpenShift Enterprise 3.1 or Origin 1.1."
  4. when: not openshift.common.version_gte_3_1_or_1_1 | bool
  5. - name: Copy Configuration to temporary conf
  6. command: >
  7. cp {{ openshift.common.config_base }}/master/admin.kubeconfig {{manage_iq_tmp_conf}}
  8. changed_when: false
  9. - name: Add Managment Infrastructure project
  10. command: >
  11. {{ openshift.common.admin_binary }} new-project
  12. management-infra
  13. --description="Management Infrastructure"
  14. --config={{manage_iq_tmp_conf}}
  15. register: osmiq_create_mi_project
  16. failed_when: "'already exists' not in osmiq_create_mi_project.stderr and osmiq_create_mi_project.rc != 0"
  17. changed_when: osmiq_create_mi_project.rc == 0
  18. - name: Create Admin Service Account
  19. shell: >
  20. echo {{ manageiq_service_account | to_json | quote }} |
  21. {{ openshift.common.client_binary }} create
  22. -n management-infra
  23. --config={{manage_iq_tmp_conf}}
  24. -f -
  25. register: osmiq_create_service_account
  26. failed_when: "'already exists' not in osmiq_create_service_account.stderr and osmiq_create_service_account.rc != 0"
  27. changed_when: osmiq_create_service_account.rc == 0
  28. - name: Create Image Inspector Service Account
  29. shell: >
  30. echo {{ manageiq_image_inspector_service_account | to_json | quote }} |
  31. {{ openshift.common.client_binary }} create
  32. -n management-infra
  33. --config={{manage_iq_tmp_conf}}
  34. -f -
  35. register: osmiq_create_service_account
  36. failed_when: "'already exists' not in osmiq_create_service_account.stderr and osmiq_create_service_account.rc != 0"
  37. changed_when: osmiq_create_service_account.rc == 0
  38. - name: Create Cluster Role
  39. shell: >
  40. echo {{ manageiq_cluster_role | to_json | quote }} |
  41. {{ openshift.common.client_binary }} create
  42. --config={{manage_iq_tmp_conf}}
  43. -f -
  44. register: osmiq_create_cluster_role
  45. failed_when: "'already exists' not in osmiq_create_cluster_role.stderr and osmiq_create_cluster_role.rc != 0"
  46. changed_when: osmiq_create_cluster_role.rc == 0
  47. - name: Configure role/user permissions
  48. command: >
  49. {{ openshift.common.admin_binary }} {{item}}
  50. --config={{manage_iq_tmp_conf}}
  51. with_items: "{{manage_iq_tasks}}"
  52. register: osmiq_perm_task
  53. failed_when: "'already exists' not in osmiq_perm_task.stderr and osmiq_perm_task.rc != 0"
  54. changed_when: osmiq_perm_task.rc == 0
  55. - name: Configure 3_2 role/user permissions
  56. command: >
  57. {{ openshift.common.admin_binary }} {{item}}
  58. --config={{manage_iq_tmp_conf}}
  59. with_items: "{{manage_iq_openshift_3_2_tasks}}"
  60. register: osmiq_perm_3_2_task
  61. failed_when: osmiq_perm_3_2_task.rc != 0
  62. changed_when: osmiq_perm_3_2_task.rc == 0
  63. when: openshift.common.version_gte_3_2_or_1_2 | bool
  64. - name: Clean temporary configuration file
  65. file: path={{manage_iq_tmp_conf}} state=absent