main.yml 5.8 KB

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