浏览代码

Remove v1beta3 by default for kube_nfs_volumes

Jason DeTiberus 9 年之前
父节点
当前提交
15ca45191a

+ 3 - 0
roles/kube_nfs_volumes/README.md

@@ -44,6 +44,9 @@ kubernetes_url: https://10.245.1.2:6443
 
 # Token to use for authentication to the API server
 kubernetes_token: tJdce6Fn3cL1112YoIJ5m2exzAbzcPZX
+
+# API Version to use for kubernetes
+kube_api_version: v1
 ```
 
 ## Dependencies

+ 6 - 0
roles/kube_nfs_volumes/defaults/main.yml

@@ -1,4 +1,10 @@
 ---
+kubernetes_url: https://172.30.0.1:443
+
+kube_api_version: v1
+
+kube_req_template: "../templates/{{ kube_api_version }}/nfs.json.j2"
+
 # Options of NFS exports.
 nfs_export_options: "*(rw,no_root_squash,insecure,no_subtree_check)"
 

+ 7 - 6
roles/kube_nfs_volumes/tasks/main.yml

@@ -16,10 +16,11 @@
 - include: nfs.yml
 
 - name: export physical volumes
-  uri: url={{ kubernetes_url }}/api/v1beta3/persistentvolumes
-       method=POST
-       body='{{ lookup("template", "../templates/nfs.json.j2") }}'
-       body_format=json
-       status_code=201
-       HEADER_Authorization="Bearer {{ kubernetes_token }}"
+  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

+ 1 - 0
roles/kube_nfs_volumes/templates/v1/nfs.json.j2

@@ -0,0 +1 @@
+../v1beta3/nfs.json.j2

roles/kube_nfs_volumes/templates/nfs.json.j2 → roles/kube_nfs_volumes/templates/v1beta3/nfs.json.j2