"Fossies" - the Fresh Open Source Software Archive

Member "magnum-8.1.0/magnum/drivers/k8s_coreos_v1/templates/fragments/add-proxy.yaml" (1 Oct 2019, 1763 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/add-proxy.service
    4     owner: "root:root"
    5     permissions: "0644"
    6     content: |
    7       [Unit]
    8       Description=Configure proxy
    9 
   10       [Service]
   11       Type=oneshot
   12       EnvironmentFile=/etc/sysconfig/heat-params
   13       ExecStart=/etc/sysconfig/add-proxy.sh
   14 
   15       [Install]
   16       WantedBy=multi-user.target
   17 
   18   - path: /etc/sysconfig/add-proxy.sh
   19     owner: "root:root"
   20     permissions: "0755"
   21     content: |
   22       #!/bin/sh
   23 
   24       DOCKER_HTTP_PROXY_CONF=/etc/systemd/system/docker.service.d/http_proxy.conf
   25 
   26       DOCKER_HTTPS_PROXY_CONF=/etc/systemd/system/docker.service.d/https_proxy.conf
   27 
   28       DOCKER_NO_PROXY_CONF=/etc/systemd/system/docker.service.d/no_proxy.conf
   29 
   30       DOCKER_RESTART=0
   31 
   32       ENVIRONMENT=/etc/environment
   33 
   34       mkdir -p /etc/systemd/system/docker.service.d
   35 
   36       if [ -n "$HTTP_PROXY" ]; then
   37           cat <<EOF | sed "s/^ *//" > $DOCKER_HTTP_PROXY_CONF
   38           [Service]
   39           Environment=HTTP_PROXY=$HTTP_PROXY
   40       EOF
   41 
   42         DOCKER_RESTART=1
   43 
   44         echo "http_proxy=$HTTP_PROXY" >> $ENVIRONMENT
   45       fi
   46 
   47       if [ -n "$HTTPS_PROXY" ]; then
   48           cat <<EOF | sed "s/^ *//" > $DOCKER_HTTPS_PROXY_CONF
   49           [Service]
   50           Environment=HTTPS_PROXY=$HTTPS_PROXY
   51       EOF
   52 
   53         DOCKER_RESTART=1
   54 
   55         echo "https_proxy=$HTTPS_PROXY" >> $ENVIRONMENT
   56       fi
   57 
   58       if [ -n "$NO_PROXY" ]; then
   59           cat <<EOF | sed "s/^ *//" > $DOCKER_NO_PROXY_CONF
   60           [Service]
   61           Environment=NO_PROXY=$NO_PROXY
   62       EOF
   63 
   64         DOCKER_RESTART=1
   65 
   66         echo "no_proxy=$NO_PROXY" >> $ENVIRONMENT
   67       fi
   68 
   69       if [ "$DOCKER_RESTART" -eq 1 ]; then
   70         systemctl daemon-reload
   71         systemctl --no-block restart docker.service
   72       fi