From 1ae6d61c8ccd15e62b2748d641e65528e52d095f Mon Sep 17 00:00:00 2001 From: cmendible Date: Fri, 17 May 2019 20:17:45 +0200 Subject: [PATCH 1/2] Added azure-ansible dev container --- .../azure-ansible/.devcontainer/Dockerfile | 55 +++++++++++++++++++ .../.devcontainer/devcontainer.json | 17 ++++++ containers/azure-ansible/.npmignore | 4 ++ containers/azure-ansible/README.md | 39 +++++++++++++ 4 files changed, 115 insertions(+) create mode 100644 containers/azure-ansible/.devcontainer/Dockerfile create mode 100644 containers/azure-ansible/.devcontainer/devcontainer.json create mode 100644 containers/azure-ansible/.npmignore create mode 100644 containers/azure-ansible/README.md diff --git a/containers/azure-ansible/.devcontainer/Dockerfile b/containers/azure-ansible/.devcontainer/Dockerfile new file mode 100644 index 0000000000..46a47b6d19 --- /dev/null +++ b/containers/azure-ansible/.devcontainer/Dockerfile @@ -0,0 +1,55 @@ +#------------------------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information. +#------------------------------------------------------------------------------------------------------------- + +# Pick any base image, but if you select node, skip installing node. 😊 +FROM debian:9 + +# Configure apt +ENV DEBIAN_FRONTEND=noninteractive +RUN apt-get update \ + && apt-get -y install --no-install-recommends apt-utils 2>&1 + +# Install git, required tools +RUN apt-get install -y \ + git \ + curl \ + procps \ + unzip \ + apt-transport-https \ + ca-certificates \ + gnupg-agent \ + software-properties-common \ + lsb-release 2>&1 + +# [Optional] Install Node.js for Azure Cloud Shell support +# Change the "lts/*" in the two lines below to pick a different version +RUN curl -so- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash 2>&1 \ + && /bin/bash -c "source $HOME/.nvm/nvm.sh \ + && nvm install lts/* \ + && nvm alias default lts/*" 2>&1 + +# [Optional] For local testing instead of cloud shell +# Install Docker CE CLI. +RUN curl -fsSL https://download.docker.com/linux/$(lsb_release -is | tr '[:upper:]' '[:lower:]')/gpg | apt-key add - 2>/dev/null \ + && add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/$(lsb_release -is | tr '[:upper:]' '[:lower:]') $(lsb_release -cs) stable" \ + && apt-get update \ + && apt-get install -y docker-ce-cli + +# [Optional] For local testing instead of cloud shell +# Install the Azure CLI +RUN echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $(lsb_release -cs) main" > /etc/apt/sources.list.d/azure-cli.list \ + && curl -sL https://packages.microsoft.com/keys/microsoft.asc | apt-key add - 2>/dev/null \ + && apt-get update \ + && apt-get install -y azure-cli + +# Install Ansible +RUN apt-get install -y libssl-dev libffi-dev python-dev python-pip \ + && pip install ansible[azure] + +# Clean up +RUN apt-get autoremove -y \ + && apt-get clean -y \ + && rm -rf /var/lib/apt/lists/* +ENV DEBIAN_FRONTEND=dialog \ No newline at end of file diff --git a/containers/azure-ansible/.devcontainer/devcontainer.json b/containers/azure-ansible/.devcontainer/devcontainer.json new file mode 100644 index 0000000000..eadd40f21c --- /dev/null +++ b/containers/azure-ansible/.devcontainer/devcontainer.json @@ -0,0 +1,17 @@ +{ + "name": "Azure Terraform", + "dockerFile": "Dockerfile", + "extensions": [ + "vscoss.vscode-ansible", + "redhat.vscode-yaml", + "ms-vscode.azurecli" + ], + "runArgs": [ + "-v", + "/var/run/docker.sock:/var/run/docker.sock" + ], + // Uncomment the next line if you want to publish any ports. + // "appPort": [], + // Uncomment the next line to run commands after the container is created. + // "postCreateCommand": "ansible --version" +} \ No newline at end of file diff --git a/containers/azure-ansible/.npmignore b/containers/azure-ansible/.npmignore new file mode 100644 index 0000000000..1d72d293eb --- /dev/null +++ b/containers/azure-ansible/.npmignore @@ -0,0 +1,4 @@ +README.md +test-project +.vscode +.npmignore diff --git a/containers/azure-ansible/README.md b/containers/azure-ansible/README.md new file mode 100644 index 0000000000..d4ce77e3bc --- /dev/null +++ b/containers/azure-ansible/README.md @@ -0,0 +1,39 @@ +# Azure Ansible + +## Summary + +*Get going quickly with Ansible in Azure. Includes Ansible, the Azure CLI, the Docker CLI (for testing locally), Node.js for Cloud Shell, and related extensions and dependencies.* + +| Metadata | Value | +|----------|-------| +| *Contributors* | The VS Code Team | +| *Definition type* | Dockerfile | +| *Languages, platforms* | Ansible | + +## Using this definition with an existing folder + +While technically optional, this definition includes the Ansible extension. You may need an Azure account for your operations. You can create a [free trial account here](https://azure.microsoft.com/en-us/free/) and find out more about using [Ansible with Azure here](https://docs.microsoft.com/en-us/azure/ansible/ansible-overview). If you plan to use the Azure Cloud Shell for all of your Ansible operations, you can comment out the installation of the Docker CLI in `.devcontainer/Dockerfile`. Conversely, if you do not plan to use Cloud Shell, you can comment out the installation of Node.js. The definition has been setup so you can do either as it makes sense. + +Next, follow these steps: + +1. If this is your first time using a development container, please follow the [getting started steps](https://aka.ms/vscode-remote/containers/getting-started) to set up your machine. + +2. To use VS Code's copy of this definition: + 1. Start VS Code and open your project folder. + 2. Press F1 select and **Remote-Containers: Create Container Configuration File...** from the command palette. + 3. Select the Azure Ansible definition. + +3. To use latest-and-greatest copy of this definition from the repository: + 1. Clone this repository. + 2. Copy the contents of `containers/azure-ansible/.devcontainer` to the root of your project folder. + 3. Start VS Code and open your project folder. + +4. After following step 2 or 3, the contents of the `.devcontainer` folder in your project can be adapted to meet your needs. + +5. Finally, press F1 and run **Remote-Containers: Reopen Folder in Container** to start using the definition. + +## License + +Copyright (c) Microsoft Corporation. All rights reserved. + +Licensed under the MIT License. See [LICENSE](https://github.com/Microsoft/vscode-dev-containers/blob/master/LICENSE). From 8a517b91a361bccd4178764ba7ba2b9f62db8488 Mon Sep 17 00:00:00 2001 From: Carlos Mendible Date: Fri, 17 May 2019 22:34:21 +0200 Subject: [PATCH 2/2] Fixing name --- containers/azure-ansible/.devcontainer/devcontainer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/containers/azure-ansible/.devcontainer/devcontainer.json b/containers/azure-ansible/.devcontainer/devcontainer.json index eadd40f21c..3e13fae45a 100644 --- a/containers/azure-ansible/.devcontainer/devcontainer.json +++ b/containers/azure-ansible/.devcontainer/devcontainer.json @@ -1,5 +1,5 @@ { - "name": "Azure Terraform", + "name": "Azure Ansible", "dockerFile": "Dockerfile", "extensions": [ "vscoss.vscode-ansible", @@ -14,4 +14,4 @@ // "appPort": [], // Uncomment the next line to run commands after the container is created. // "postCreateCommand": "ansible --version" -} \ No newline at end of file +}