-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
163 additions
and
158 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
--- | ||
|
||
name: ci | ||
on: | ||
push: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: 'Print docker version information' | ||
run: | | ||
docker --version | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: 'Login to Docker Hub' | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- name: 'Build and push' | ||
uses: docker/build-push-action@v5 | ||
with: | ||
push: true | ||
tags: thehedhly/ansible:latest | ||
context: . | ||
file: Dockerfile |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
|
||
name: Lint Code Base | ||
on: | ||
push: | ||
branches-ignore: [main] | ||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: 'Yamllint' | ||
uses: karancode/yamllint-github-action@master | ||
with: | ||
yamllint_file_or_dir: . | ||
yamllint_strict: true | ||
yamllint_comment: false |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
|
||
ignored: | ||
- DL3008 | ||
- DL3006 #see https://github.com/hadolint/hadolint/issues/339 | ||
Check warning on line 5 in .hadolint.yaml GitHub Actions / lint
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
|
||
extends: default | ||
|
||
rules: | ||
line-length: disable | ||
truthy: | ||
allowed-values: ['true', 'false'] | ||
check-keys: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,69 @@ | ||
FROM ubuntu:20.04 | ||
LABEL author="Hamza Hedhly" | ||
LABEL version="Ubuntu 20.04 (Focal Fossa)" | ||
LABEL documentation="https://github.com/senjoux" | ||
# Supported Ansible releases: | ||
# - 4.0 (default) | ||
# - 3.0 | ||
# - 2.10 | ||
# see releases https://docs.ansible.com/ansible/devel/roadmap/ansible_roadmap_index.html | ||
ENV ANSIBLE_VERSION=4.0.0 | ||
# if none provided an "ansible" user will be created | ||
ENV ANSIBLE_USER=ansible | ||
# Python3-pip version | ||
ENV PYTHON3_PIP_VERSION=20.0.2-5ubuntu1.5 | ||
|
||
RUN apt-get update --no-install-recommends -y \ | ||
# prepare user | ||
&& adduser $ANSIBLE_USER \ | ||
&& echo "$ANSIBLE_USER ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers \ | ||
# install Ansible | ||
&& apt-get install --no-install-recommends python3-pip=$PYTHON3_PIP_VERSION -y \ | ||
&& rm -rf /var/lib/apt/lists/*\ | ||
&& python3.8 -m pip install --no-cache-dir ansible==$ANSIBLE_VERSION \ | ||
# other | ||
&& echo "export PS1='[\u@\h:\w] $ '" >> /home/$ANSIBLE_USER/.bashrc \ | ||
# self | ||
&& ansible --version \ | ||
&& python3.8 -m pip list | ||
|
||
ENTRYPOINT ["/bin/bash","-c"] | ||
CMD ["su $ANSIBLE_USER"] | ||
# Before overriding BASE_IMAGE and PYCMD, please consult: | ||
# - https://docs.ansible.com/ansible/latest/reference_appendices/release_and_maintenance.html#ansible-core-support-matrix | ||
# and also maybe (in case want to install ansible community): | ||
# - https://docs.ansible.com/ansible/latest/reference_appendices/release_and_maintenance.html#ansible-community-changelogs | ||
# | ||
ARG BASE_IMAGE="python:3.11.7-slim" | ||
ARG PYCMD="/usr/local/bin/python3.11" | ||
ARG SYS_ZONEINFO="Europe/Berlin" | ||
ARG ANSIBLE_HOME="/usr/share/ansible" | ||
ARG ANSIBLE_GALAXY_CLI_COLLECTION_OPTS="-v" | ||
ARG ANSIBLE_GALAXY_CLI_ROLE_OPTS="" | ||
ARG ANSIBLE_INSTALL_REFS="ansible-core==2.16.0" | ||
# ARG ANSIBLE_INSTALL_REFS="ansible-core" | ||
# ARG ANSIBLE_INSTALL_REFS="ansible==9" | ||
# ARG ANSIBLE_INSTALL_REFS="ansible" | ||
ARG ANSIBLE_USER="thehedhly" | ||
|
||
# Base build stage | ||
FROM $BASE_IMAGE as base | ||
USER root | ||
ARG BASE_IMAGE | ||
ARG PYCMD | ||
ARG ANSIBLE_INSTALL_REFS | ||
|
||
RUN "unlink /etc/localtime \ | ||
&& ln -s /usr/share/zoneinfo/$SYS_ZONEINFO /etc/localtime \ | ||
&& $PYCMD -m ensurepip \ | ||
&& $PYCMD -m pip install --no-cache-dir $ANSIBLE_INSTALL_REFS" | ||
USER guest | ||
|
||
# Galaxy build stage | ||
FROM base as galaxy | ||
ARG ANSIBLE_HOME | ||
ARG ANSIBLE_GALAXY_CLI_COLLECTION_OPTS | ||
ARG ANSIBLE_GALAXY_CLI_ROLE_OPTS | ||
WORKDIR / | ||
COPY requirements.yml . | ||
RUN ansible-galaxy role install $ANSIBLE_GALAXY_CLI_ROLE_OPTS -r requirements.yml --roles-path "$ANSIBLE_HOME/roles"\ | ||
&& ANSIBLE_GALAXY_DISABLE_GPG_VERIFY=1 ansible-galaxy collection install $ANSIBLE_GALAXY_CLI_COLLECTION_OPTS -r requirements.yml --collections-path "$ANSIBLE_HOME/collections" | ||
|
||
# Final build stage | ||
FROM base as final | ||
LABEL org.opencontainers.image.created="date and time on which the image was built (string, date-time as defined by RFC 3339)" | ||
LABEL org.opencontainers.image.authors="https://github.com/thehedhly" | ||
LABEL org.opencontainers.image.url="dockerhub url" | ||
LABEL org.opencontainers.image.source="github repository" | ||
LABEL org.opencontainers.image.version="version of the packaged software" | ||
ARG ANSIBLE_HOME | ||
ARG ANSIBLE_USER | ||
ENV ANSIBLE_CONFIG "/home/$ANSIBLE_USER/.ansible.cfg" | ||
# ENV ANSIBLE_HOME = $XANSIBLE_HOME | ||
|
||
COPY --from=galaxy $ANSIBLE_HOME $ANSIBLE_HOME | ||
|
||
RUN useradd -m $ANSIBLE_USER\ | ||
&& echo "$ANSIBLE_USER ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers\ | ||
&& apt-get update\ | ||
&& apt-get install --no-install-recommends -y openssh-client\ | ||
&& apt-get install --no-install-recommends -y iputils-ping\ | ||
&& apt-get -qq clean\ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
USER $ANSIBLE_USER | ||
COPY --chown=$ANSIBLE_USER:$ANSIBLE_USER ansible.cfg $ANSIBLE_CONFIG | ||
|
||
WORKDIR "/home/$ANSIBLE_USER" | ||
|
||
# ENTRYPOINT ["/bin/bash","-c"] | ||
# CMD ["su $ANSIBLE_USER"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[defaults] | ||
# playbook_dir = ./playbooks | ||
roles_path = ~/.ansible/roles:./roles:/usr/share/ansible/roles | ||
collections_path = ~/.ansible/collections:./collections:/usr/share/ansible/collections | ||
bin_ansible_callbacks = True | ||
callbacks_enabled = ansible.posix.profile_tasks | ||
force_color = True | ||
# Use the YAML callback plugin | ||
stdout_callback = yaml | ||
|
||
nocows = 1 | ||
# cow_selection = random | ||
# cow_selection = small | ||
|
||
[galaxy] | ||
collections_path_warning = False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
|
||
roles: [] | ||
# roles: | ||
# - name: geerlingguy.go | ||
# version: "1.1.0" | ||
|
||
# collections: [] | ||
collections: | ||
- name: ansible.posix | ||
version: ">=1.5.0" | ||
- name: community.general | ||
version: ">=8.1.0" | ||
- name: community.docker | ||
version: ">=3.5.0" |