Skip to content

Commit

Permalink
Initial import
Browse files Browse the repository at this point in the history
  • Loading branch information
noirbizarre committed Jan 7, 2019
1 parent 22c2179 commit ca12183
Show file tree
Hide file tree
Showing 5 changed files with 167 additions and 0 deletions.
63 changes: 63 additions & 0 deletions .pyup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# configure updates globally
# default: all
# allowed: all, insecure, False
# update: all

# configure dependency pinning globally
# default: True
# allowed: True, False
# pin: False

# set the default branch
# default: empty, the default branch on GitHub
# branch: dev

# update schedule
# default: empty
# allowed: "every day", "every week", ..
# schedule: "every day"

# search for requirement files
# default: True
# allowed: True, False
# search: True

# Specify requirement files by hand, default is empty
# default: empty
# allowed: list
# requirements:
# - requirements/staging.txt:
# # update all dependencies and pin them
# update: all
# pin: True
# - requirements/dev.txt:
# # don't update dependencies, use global 'pin' default
# update: False
# - requirements/prod.txt:
# # update insecure only, pin all
# update: insecure
# pin: True

# add a label to pull requests, default is not set
# requires private repo permissions, even on public repos
# default: empty
label_prs: update

# assign users to pull requests, default is not set
# requires private repo permissions, even on public repos
# default: empty
# assignees:
# - carl
# - carlsen

# configure the branch prefix the bot is using
# default: pyup-
branch_prefix: pyup/

# set a global prefix for PRs
# default: empty
pr_prefix: "[PyUP]"

# allow to close stale PRs
# default: True
close_prs: True
36 changes: 36 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
FROM alpine:3.8

ARG VCS_REF
ARG BUILD_DATE
ARG VERSION

LABEL org.label-schema.vcs-ref=$VCS_REF \
org.label-schema.vcs-url="https://github.com/apihackers/docker-ansible" \
org.label-schema.build-date=$BUILD_DATE \
org.label-schema.version=$VERSION \
org.label-schema.schema-version="1.0"

COPY requirements.pip /tmp/requirements.pip

RUN apk add --no-cache python3 ca-certificates openssl git openssh-client && \
apk add --no-cache --virtual .build-deps build-base python3-dev libffi-dev openssl-dev && \
python3 -m ensurepip && \
rm -r /usr/lib/python*/ensurepip && \
pip3 install --upgrade pip && \
pip3 install -r /tmp/requirements.pip && \
apk del .build-deps && \
rm -r /root/.cache


ENV WORKSPACE /workspace

RUN mkdir $WORKSPACE

VOLUME $WORKSPACE

WORKDIR $WORKSPACE

ENV SSH_PRIVATE_KEY ""
COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
# CMD [ "ansible-playbook" ]
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
# docker-ansible

[![Updates](https://pyup.io/repos/github/apihackers/docker-ansible/shield.svg)](https://pyup.io/repos/github/apihackers/docker-ansible/) [![Commit](https://images.microbadger.com/badges/commit/apihackers/ansible.svg)](https://microbadger.com/images/apihackers/ansible) [![Version](https://images.microbadger.com/badges/version/apihackers/ansible.svg)](https://microbadger.com/images/apihackers/ansible) [![Download size](https://images.microbadger.com/badges/image/apihackers/ansible.svg)](https://microbadger.com/images/apihackers/ansible)

A lightweight (alpine based) ansible docker image
63 changes: 63 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#!/bin/ash -e
# For SSH see:
# - https://docs.gitlab.com/ee/ci/ssh_keys/
# - https://gitlab.com/gitlab-examples/ssh-private-key/blob/master/.gitlab-ci.yml

if [[ ! -z "${SSH_PRIVATE_KEY}" ]]; then
##
## Run ssh-agent (inside the build environment)
##
eval $(ssh-agent -s) > /dev/null

##
## Add the SSH key stored in SSH_PRIVATE_KEY variable to the agent store
## We're using tr to fix line endings which makes ed25519 keys work
## without extra base64 encoding.
## https://gitlab.com/gitlab-examples/ssh-private-key/issues/1#note_48526556
##
echo "$SSH_PRIVATE_KEY" | ssh-add - > /dev/null 2>&1

##
## Create the SSH directory and give it the right permissions
##
mkdir -p ~/.ssh
chmod 700 ~/.ssh

##
## Use ssh-keyscan to scan the keys of your private server. Replace gitlab.com
## with your own domain name. You can copy and repeat that command if you have
## more than one server to connect to.
##
# ssh-keyscan gitlab.com >> ~/.ssh/known_hosts
# chmod 644 ~/.ssh/known_hosts

##
## Alternatively, assuming you created the SSH_SERVER_HOSTKEYS variable
## previously, uncomment the following two lines instead.
##
#- echo "$SSH_SERVER_HOSTKEYS" > ~/.ssh/known_hosts'
#- chmod 644 ~/.ssh/known_hosts

##
## You can optionally disable host key checking. Be aware that by adding that
## you are suspectible to man-in-the-middle attacks.
## WARNING: Use this only with the Docker executor, if you use it with shell
## you will overwrite your user's SSH config.
##
# [[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config

fi

case $1 in
playbook)
shift
ansible-playbook "$@"
;;
shell)
/bin/ash
;;
*)
ansible "$@"
;;
esac
2 changes: 2 additions & 0 deletions requirements.pip
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ansible==2.7.5
jmespath==0.9.3

0 comments on commit ca12183

Please sign in to comment.