Skip to content

Instantly share code, notes, and snippets.

@anryko
Last active March 23, 2020 16:09
Show Gist options
  • Save anryko/9de4dc48bf0d9ea297c888c816b59fec to your computer and use it in GitHub Desktop.
Save anryko/9de4dc48bf0d9ea297c888c816b59fec to your computer and use it in GitHub Desktop.
Instructions for running Ansible AWS module integration tests using vanila docker container.

Start container from ansible git root:

docker run \
    -it \
    -v $PWD:/srv \
    -v /var/run/docker.sock:/var/run/docker.sock \
    -w /srv \
    fedora bash

Install dependencies:

dnf install -y \
    python3-pip \
    ansible \
    findutils \
    vim \
    which \
    git \
    curl \
    man \
    dnf-plugins-core \
    && \
dnf config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo && \
dnf install -y docker-ce-cli && \
ln -s /usr/bin/python3 /usr/bin/python && \
pip install --no-cache-dir \
    botocore \
    boto3 \
    boto \
    awscli \
    setuptools \
    junit_xml \
    voluptuous \
    && \
source hacking/env-setup

Export credentials (alternatively mount -v $HOME/.aws:/root/.aws in to docker conainer on start):

export AWS_REGION=us-east-2
export AWS_ACCESS_KEY_ID=AAAAAAAAAAAAAAAAAAAA
export AWS_SECRET_ACCESS_KEY=ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ

Run integration tests:

ansible-test integration -v ec2_asg
OR
ansible-test integration --docker -v ec2_asg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment