main.yml 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. ---
  2. - name: Create temp directory for volume definitions
  3. command: mktemp -d /tmp/openshift-ansible-XXXXXXX
  4. register: mktemp
  5. changed_when: False
  6. - name: Copy the admin client config(s)
  7. command: >
  8. cp {{ openshift_master_config_dir }}/admin.kubeconfig {{ mktemp.stdout }}/admin.kubeconfig
  9. changed_when: False
  10. - set_fact:
  11. glusterfs_pv:
  12. - name: "{{ openshift_hosted_registry_storage_volume_name }}-glusterfs-volume"
  13. capacity: "{{ openshift_hosted_registry_storage_volume_size }}"
  14. access_modes: "{{ openshift_hosted_registry_storage_access_modes }}"
  15. storage:
  16. glusterfs:
  17. endpoints: "{{ openshift_hosted_registry_storage_glusterfs_endpoints }}"
  18. path: "{{ openshift_hosted_registry_storage_glusterfs_path }}"
  19. readOnly: "{{ openshift_hosted_registry_storage_glusterfs_readOnly }}"
  20. glusterfs_pvc:
  21. - name: "{{ openshift_hosted_registry_storage_volume_name }}-glusterfs-claim"
  22. capacity: "{{ openshift_hosted_registry_storage_volume_size }}"
  23. access_modes: "{{ openshift_hosted_registry_storage_access_modes }}"
  24. when: openshift_hosted_registry_storage_glusterfs_swap | default(False)
  25. - name: create standard pv and pvc lists
  26. # generate_pv_pvcs_list is a custom action module defined in
  27. # roles/lib_utils/action_plugins/generate_pv_pvcs_list.py
  28. generate_pv_pvcs_list: {}
  29. register: l_pv_pvcs_list
  30. - include_tasks: pv.yml
  31. vars:
  32. l_extra_persistent_volumes: "{{ openshift_persistent_volume_extras | union(glusterfs_pv) }}"
  33. persistent_volumes: "{{ l_pv_pvcs_list.persistent_volumes | union(l_extra_persistent_volumes) }}"
  34. - include_tasks: pvc.yml
  35. vars:
  36. l_extra_persistent_volume_claims: "{{ openshift_persistent_volume_claims_extras | union(glusterfs_pvc) }}"
  37. persistent_volume_claims: "{{ l_pv_pvcs_list.persistent_volume_claims | union(l_extra_persistent_volume_claims) }}"
  38. - name: Delete temp directory
  39. file:
  40. name: "{{ mktemp.stdout }}"
  41. state: absent
  42. changed_when: False