"Fossies" - the Fresh Open Source Software Archive

Member "magnum-8.1.0/magnum/drivers/k8s_coreos_v1/templates/fragments/write-network-config.yaml" (1 Oct 2019, 1170 Bytes) of package /linux/misc/openstack/magnum-8.1.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Ansible YAML source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 #cloud-config
    2 write_files:
    3   - path: /etc/systemd/system/write-network-config.service
    4     owner: "root:root"
    5     permissions: "0644"
    6     content: |
    7       [Unit]
    8       Description=Write Network Config
    9 
   10       [Service]
   11       Type=oneshot
   12       EnvironmentFile=/etc/sysconfig/heat-params
   13       ExecStart=/etc/sysconfig/write-network-config.sh
   14 
   15       [Install]
   16       WantedBy=multi-user.target
   17 
   18   - path: /etc/sysconfig/write-network-config.sh
   19     owner: "root:root"
   20     permissions: "0755"
   21     content: |
   22       #!/bin/sh
   23 
   24       if [ "$NETWORK_DRIVER" != "flannel" ]; then
   25           exit 0
   26       fi
   27 
   28       FLANNEL_JSON=/etc/sysconfig/flannel-network.json
   29       cat > $FLANNEL_JSON <<EOF
   30       {
   31           "Network": "$FLANNEL_NETWORK_CIDR",
   32           "Subnetlen": $FLANNEL_NETWORK_SUBNETLEN,
   33           "Backend": {
   34               "Type": "$FLANNEL_BACKEND"
   35           }
   36       }
   37       EOF
   38 
   39       FLANNEL_ETCD="http://127.0.0.1:2379"
   40       FLANNEL_ETCD_KEY="/coreos.com/network"
   41       while ! curl -sf -L ${FLANNEL_ETCD}/v2/keys${FLANNEL_ETCD_KEY}/config \
   42         -X PUT --data-urlencode value@${FLANNEL_JSON}; do
   43           echo "waiting for etcd"
   44           sleep 1
   45       done