From f790eca0c2237f072f0216261ef70d85edce966b Mon Sep 17 00:00:00 2001 From: Jack Ivanov Date: Sat, 31 Oct 2020 19:13:25 +0000 Subject: [PATCH] Multiple Azure fixes --- Dockerfile | 9 +++------ config.cfg | 5 +++-- roles/cloud-azure/tasks/venv.yml | 3 +++ roles/common/handlers/main.yml | 5 +++++ roles/common/tasks/ubuntu.yml | 9 +++++++++ 5 files changed, 23 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 07671de..90f2381 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,7 @@ FROM python:3-alpine ARG VERSION="git" -ARG PACKAGES="bash libffi openssh-client openssl rsync tini" -ARG BUILD_PACKAGES="gcc libffi-dev linux-headers make musl-dev openssl-dev" +ARG PACKAGES="bash libffi openssh-client openssl rsync tini gcc libffi-dev linux-headers make musl-dev openssl-dev" LABEL name="algo" \ version="${VERSION}" \ @@ -15,13 +14,11 @@ RUN mkdir -p /algo && mkdir -p /algo/configs WORKDIR /algo COPY requirements.txt . -RUN apk --no-cache add ${BUILD_PACKAGES} && \ - python3 -m pip --no-cache-dir install -U pip && \ +RUN python3 -m pip --no-cache-dir install -U pip && \ python3 -m pip --no-cache-dir install virtualenv && \ python3 -m virtualenv .env && \ source .env/bin/activate && \ - python3 -m pip --no-cache-dir install -r requirements.txt && \ - apk del ${BUILD_PACKAGES} + python3 -m pip --no-cache-dir install -r requirements.txt COPY . . RUN chmod 0755 /algo/algo-docker.sh diff --git a/config.cfg b/config.cfg index f4390ec..63b7225 100644 --- a/config.cfg +++ b/config.cfg @@ -92,6 +92,7 @@ dnscrypt_servers: - cloudflare-ipv6 # DNS servers which will be used if 'dns_encryption' is 'false'. +# Fallback resolvers for systemd-resolved # The default is to use Cloudflare. dns_servers: ipv4: @@ -158,8 +159,8 @@ cloud_providers: size: Standard_B1S image: publisher: Canonical - offer: 0001-com-ubuntu-server-focal-daily - sku: 20_04-daily-lts + offer: 0001-com-ubuntu-server-focal + sku: 20_04-lts-gen2 version: latest digitalocean: size: s-1vcpu-1gb diff --git a/roles/cloud-azure/tasks/venv.yml b/roles/cloud-azure/tasks/venv.yml index 4d32678..52f0940 100644 --- a/roles/cloud-azure/tasks/venv.yml +++ b/roles/cloud-azure/tasks/venv.yml @@ -4,6 +4,7 @@ name: - packaging - requests[security] + - xmltodict - azure-cli-core==2.0.35 - azure-cli-nspkg==3.0.2 - azure-common==1.1.11 @@ -38,5 +39,7 @@ - azure-mgmt-hdinsight==0.1.0 - azure-mgmt-devtestlabs==3.0.0 - azure-mgmt-loganalytics==0.2.0 + - azure-mgmt-automation==0.1.1 + - azure-mgmt-iothub==0.7.0 state: latest virtualenv_python: python3 diff --git a/roles/common/handlers/main.yml b/roles/common/handlers/main.yml index 6bcae5c..86a2bdb 100644 --- a/roles/common/handlers/main.yml +++ b/roles/common/handlers/main.yml @@ -13,6 +13,11 @@ state: restarted daemon_reload: true +- name: restart systemd-resolved + systemd: + name: systemd-resolved + state: restarted + - name: restart loopback bsd shell: > ifconfig lo100 destroy || true && diff --git a/roles/common/tasks/ubuntu.yml b/roles/common/tasks/ubuntu.yml index 04e9cd8..b16d81c 100644 --- a/roles/common/tasks/ubuntu.yml +++ b/roles/common/tasks/ubuntu.yml @@ -45,6 +45,15 @@ - { regexp: '^session.*optional.*pam_motd.so.*', line: '# MOTD DISABLED', file: '/etc/pam.d/login' } - { regexp: '^session.*optional.*pam_motd.so.*', line: '# MOTD DISABLED', file: '/etc/pam.d/sshd' } +- name: Ensure fallback resolvers are set + ini_file: + path: /etc/systemd/resolved.conf + section: Resolve + option: FallbackDNS + value: "{{ dns_servers.ipv4 | join(' ') }}" + notify: + - restart systemd-resolved + - name: Loopback for services configured template: src: 10-algo-lo100.network.j2