main.yml 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. ---
  2. - name: Copy openshift examples
  3. copy:
  4. src: examples
  5. dest: /usr/share/openshift
  6. # RHEL and Centos image streams are mutually exclusive
  7. - name: Import RHEL streams
  8. command: >
  9. {{ openshift.common.client_binary }} {{ openshift_examples_import_command }} -n openshift -f {{ rhel_image_streams }}
  10. when: openshift_examples_load_rhel
  11. register: oex_import_rhel_streams
  12. failed_when: "'already exists' not in oex_import_rhel_streams.stderr and oex_import_rhel_streams.rc != 0"
  13. changed_when: false
  14. - name: Import Centos Image streams
  15. command: >
  16. {{ openshift.common.client_binary }} {{ openshift_examples_import_command }} -n openshift -f {{ centos_image_streams }}
  17. when: openshift_examples_load_centos | bool
  18. register: oex_import_centos_streams
  19. failed_when: "'already exists' not in oex_import_centos_streams.stderr and oex_import_centos_streams.rc != 0"
  20. changed_when: false
  21. - name: Import db templates
  22. command: >
  23. {{ openshift.common.client_binary }} {{ openshift_examples_import_command }} -n openshift -f {{ db_templates_base }}
  24. when: openshift_examples_load_db_templates | bool
  25. register: oex_import_db_templates
  26. failed_when: "'already exists' not in oex_import_db_templates.stderr and oex_import_db_templates.rc != 0"
  27. changed_when: false
  28. - name: Import quickstart-templates
  29. command: >
  30. {{ openshift.common.client_binary }} {{ openshift_examples_import_command }} -n openshift -f {{ quickstarts_base }}
  31. when: openshift_examples_load_quickstarts | bool
  32. register: oex_import_quickstarts
  33. failed_when: "'already exists' not in oex_import_quickstarts.stderr and oex_import_quickstarts.rc != 0"
  34. changed_when: false
  35. - name: Import origin infrastructure-templates
  36. command: >
  37. {{ openshift.common.client_binary }} {{ openshift_examples_import_command }} -n openshift -f {{ infrastructure_origin_base }}
  38. when: openshift_examples_load_centos | bool
  39. register: oex_import_infrastructure
  40. failed_when: "'already exists' not in oex_import_infrastructure.stderr and oex_import_infrastructure.rc != 0"
  41. changed_when: false
  42. - name: Import enterprise infrastructure-templates
  43. command: >
  44. {{ openshift.common.client_binary }} {{ openshift_examples_import_command }} -n openshift -f {{ infrastructure_enterprise_base }}
  45. when: openshift_examples_load_rhel | bool
  46. register: oex_import_infrastructure
  47. failed_when: "'already exists' not in oex_import_infrastructure.stderr and oex_import_infrastructure.rc != 0"
  48. changed_when: false
  49. # The 1.1 release of the xpaas content for OpenShift renamed all the templates
  50. - name: Remove old xpaas templates from filesystem
  51. file:
  52. path: "{{ xpaas_templates_base }}/{{ item }}"
  53. state: absent
  54. with_items:
  55. - amq6-persistent.json
  56. - amq6.json
  57. - eap6-amq-persistent-sti.json
  58. - eap6-amq-sti.json
  59. - eap6-basic-sti.json
  60. - eap6-https-sti.json
  61. - eap6-mongodb-persistent-sti.json
  62. - eap6-mongodb-sti.json
  63. - eap6-mysql-persistent-sti.json
  64. - eap6-mysql-sti.json
  65. - eap6-postgresql-persistent-sti.json
  66. - eap6-postgresql-sti.json
  67. - jws-tomcat7-basic-sti.json
  68. - jws-tomcat7-https-sti.json
  69. - jws-tomcat7-mongodb-sti.json
  70. - jws-tomcat7-mongodb-persistent-sti.json
  71. - jws-tomcat7-mysql-persistent-sti.json
  72. - jws-tomcat7-mysql-sti.json
  73. - jws-tomcat7-postgresql-persistent-sti.json
  74. - jws-tomcat8-postgresql-persistent-sti.json
  75. - jws-tomcat8-basic-sti.json
  76. - jws-tomcat8-https-sti.json
  77. - jws-tomcat8-mongodb-sti.json
  78. - jws-tomcat8-mongodb-persistent-sti.json
  79. - jws-tomcat8-mysql-sti.json
  80. - jws-tomcat8-mysql-persistent-sti.json
  81. - jws-tomcat8-postgresql-sti.json
  82. - jws-tomcat7-postgresql-sti.json
  83. - name: Remove old xpaas templates from openshift namespace
  84. command: >
  85. {{ openshift.common.client_binary }} -n openshift delete
  86. templates/amq6 templates/amq6-persistent templates/eap6-amq-persistent-sti templates/eap6-amq-sti \
  87. templates/eap6-basic-sti templates/eap6-basic-sti templates/eap6-mongodb-persistent-sti templates/eap6-mongodb-sti \
  88. templates/eap6-mysql-persistent-sti templates/eap6-mysql-sti templates/eap6-postgresql-persistent-sti \
  89. templates/eap6-postgresql-sti templates/jws-tomcat7-basic-sti templates/jws-tomcat7-basic-sti \
  90. templates/jws-tomcat7-mongodb-persistent-sti templates/jws-tomcat7-mongodb-sti \
  91. templates/jws-tomcat7-mysql-persistent-sti templates/jws-tomcat7-mysql-sti \
  92. templates/jws-tomcat7-postgresql-persistent-sti templates/jws-tomcat7-postgresql-sti \
  93. templates/jws-tomcat8-basic-sti templates/jws-tomcat8-basic-sti templates/jws-tomcat8-mongodb-persistent-sti
  94. when: openshift_examples_load_xpaas | bool
  95. register: oex_delete_old_xpaas_templates
  96. failed_when: "'not found' not in oex_delete_old_xpaas_templates.stderr and oex_delete_old_xpaas_templates.rc != 0"
  97. changed_when: false
  98. - name: Import xPaas image streams
  99. command: >
  100. {{ openshift.common.client_binary }} {{ openshift_examples_import_command }} -n openshift -f {{ xpaas_image_streams }}
  101. when: openshift_examples_load_xpaas | bool
  102. register: oex_import_xpaas_streams
  103. failed_when: "'already exists' not in oex_import_xpaas_streams.stderr and oex_import_xpaas_streams.rc != 0"
  104. changed_when: false
  105. - name: Import xPaas templates
  106. command: >
  107. {{ openshift.common.client_binary }} {{ openshift_examples_import_command }} -n openshift -f {{ xpaas_templates_base }}
  108. when: openshift_examples_load_xpaas | bool
  109. register: oex_import_xpaas_templates
  110. failed_when: "'already exists' not in oex_import_xpaas_templates.stderr and oex_import_xpaas_templates.rc != 0"
  111. changed_when: false