main.yml 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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 ../action_plugins
  27. generate_pv_pvcs_list: {}
  28. register: l_pv_pvcs_list
  29. - include_tasks: pv.yml
  30. vars:
  31. l_extra_persistent_volumes: "{{ openshift_persistent_volume_extras | union(glusterfs_pv) }}"
  32. persistent_volumes: "{{ l_pv_pvcs_list.persistent_volumes | union(l_extra_persistent_volumes) }}"
  33. - include_tasks: pvc.yml
  34. vars:
  35. l_extra_persistent_volume_claims: "{{ openshift_persistent_volume_claims_extras | union(glusterfs_pvc) }}"
  36. persistent_volume_claims: "{{ l_pv_pvcs_list.persistent_volume_claims | union(l_extra_persistent_volume_claims) }}"
  37. - name: Delete temp directory
  38. file:
  39. name: "{{ mktemp.stdout }}"
  40. state: absent
  41. changed_when: False