main.yaml 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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 Management Infrastructure project
  10. command: >
  11. {{ openshift.common.client_binary }} adm 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 and Image Inspector Service Account
  19. oc_serviceaccount:
  20. kubeconfig: "{{ openshift_master_config_dir }}/admin.kubeconfig"
  21. name: "{{ item }}"
  22. namespace: management-infra
  23. state: present
  24. with_items:
  25. - management-admin
  26. - inspector-admin
  27. - name: Create Cluster Role
  28. shell: >
  29. echo {{ manageiq_cluster_role | to_json | quote }} |
  30. {{ openshift.common.client_binary }} create
  31. --config={{manage_iq_tmp_conf}}
  32. -f -
  33. register: osmiq_create_cluster_role
  34. failed_when: "'already exists' not in osmiq_create_cluster_role.stderr and osmiq_create_cluster_role.rc != 0"
  35. changed_when: osmiq_create_cluster_role.rc == 0
  36. - name: Create Hawkular Metrics Admin Cluster Role
  37. shell: >
  38. echo {{ manageiq_metrics_admin_clusterrole | to_json | quote }} |
  39. {{ openshift.common.client_binary }}
  40. --config={{manage_iq_tmp_conf}}
  41. create -f -
  42. register: oshawkular_create_cluster_role
  43. failed_when: "'already exists' not in oshawkular_create_cluster_role.stderr and oshawkular_create_cluster_role.rc != 0"
  44. changed_when: oshawkular_create_cluster_role.rc == 0
  45. - name: Configure role/user permissions
  46. command: >
  47. {{ openshift.common.client_binary }} adm {{item}}
  48. --config={{manage_iq_tmp_conf}}
  49. with_items: "{{manage_iq_tasks}}"
  50. register: osmiq_perm_task
  51. failed_when: "'already exists' not in osmiq_perm_task.stderr and osmiq_perm_task.rc != 0"
  52. changed_when: osmiq_perm_task.rc == 0
  53. - name: Configure 3_2 role/user permissions
  54. command: >
  55. {{ openshift.common.client_binary }} adm {{item}}
  56. --config={{manage_iq_tmp_conf}}
  57. with_items: "{{manage_iq_openshift_3_2_tasks}}"
  58. register: osmiq_perm_3_2_task
  59. failed_when: osmiq_perm_3_2_task.rc != 0
  60. changed_when: osmiq_perm_3_2_task.rc == 0
  61. when: openshift.common.version_gte_3_2_or_1_2 | bool
  62. - name: Clean temporary configuration file
  63. file: path={{manage_iq_tmp_conf}} state=absent