summaryrefslogtreecommitdiffstats
path: root/roles/kube_nfs_volumes/tasks/main.yml
blob: 3fcb9fd18f7cda55799454625993c8293455eae0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
---
- name: Install pyparted (RedHat/Fedora)
  yum: name=pyparted,python-httplib2 state=present
  when: ansible_pkg_mgr == "yum"

- name: Install pyparted (RedHat/Fedora)
  dnf: name=pyparted,python-httplib2 state=present
  when: ansible_pkg_mgr == "dnf"

- name: partition the drives
  partitionpool: disks={{ disks }} force={{ force }} sizes={{ sizes }}

- name: create filesystem
  filesystem: fstype=ext4 dev=/dev/{{ item.name }}
  with_items: partition_pool

- name: mount
  mount: name={{mount_dir}}/{{ item.name }} src=/dev/{{ item.name }} state=mounted fstype=ext4 passno=2
  with_items: partition_pool

- include: nfs.yml

- name: export physical volumes
  uri:
    url: "{{ kubernetes_url }}/api/{{ kube_api_version }}/persistentvolumes"
    method: POST
    body: "{{ lookup('template', kube_req_template) }}"
    body_format: json
    status_code: 201
    HEADER_Authorization: "Bearer {{ kubernetes_token }}"
  with_items: partition_pool