Provide idempotent multus plugin configuration 86/90286/4
authorKonrad Bańka <k.banka@samsung.com>
Fri, 21 Jun 2019 09:26:15 +0000 (11:26 +0200)
committerKonrad Bańka <k.banka@samsung.com>
Tue, 16 Jul 2019 08:34:55 +0000 (10:34 +0200)
Blockinfile task overrides marker section in order to provide
valid json content in file. Because of this, generated block is
added each time this playbook is run. This makes CNI config file
contain malformed content when launched more than once.

Issue-ID: MULTICLOUD-676

Signed-off-by: Konrad Bańka <k.banka@samsung.com>
Change-Id: If1c98414be4fb3a5b6c1c63fada0bd934448f040

kud/deployment_infra/playbooks/configure-multus.yml

index 9cca54d..4710916 100644 (file)
           mode: 0755
       when: multus_source_type == "tarball"
     - name: create multus configuration file
-      blockinfile:
-        marker: ""
-        path: /etc/cni/net.d/00-multus.conf
-        create: yes
-        block: |
-          {
-            "type": "multus",
-            "name": "multus-cni",
-            "cniVersion": "0.3.1",
-            "kubeconfig": "/etc/kubernetes/admin.conf",
-            "delegates": [
-              {
-                "type": "flannel",
+      copy:
+        dest: /etc/cni/net.d/00-multus.conf
+        content: |
+            {
+                "type": "multus",
+                "name": "multus-cni",
                 "cniVersion": "0.3.1",
-                "masterplugin": true,
-                "delegate": {
-                  "isDefaultGateway": true
-                }
-              }
-            ]
-          }
+                "kubeconfig": "/etc/kubernetes/admin.conf",
+                "delegates": [
+                    {
+                        "type": "flannel",
+                        "cniVersion": "0.3.1",
+                        "masterplugin": true,
+                        "delegate": {
+                            "isDefaultGateway": true
+                        }
+                    }
+                ]
+            }
 
 - hosts: localhost
   pre_tasks: