Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikhail Sarnov committed Dec 17, 2024
0 parents commit dadda19
Show file tree
Hide file tree
Showing 23 changed files with 790 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .ansible-lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
exclude_paths:
- site.yml
- tasks/linux/software.yml
59 changes: 59 additions & 0 deletions .github/workflows/ghcr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
---
name: Build and publish Docker container image to GitHub's container registry

on:

Check warning on line 4 in .github/workflows/ghcr.yml

View workflow job for this annotation

GitHub Actions / Lint Ansible Role

4:1 [truthy] truthy value should be one of [false, true]
workflow_dispatch:
push:
branches:
- 'main'
tags:
- 'v*'
pull_request:
branches:
- 'main'

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-and-push-image:
name: Build image
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
attestations: write
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Log in to GitHub Container Registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
id: push
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: Generate artifact attestation
uses: actions/attest-build-provenance@v1
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true
52 changes: 52 additions & 0 deletions .github/workflows/molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
name: Molecule Tests and Linting

on:

Check warning on line 4 in .github/workflows/molecule.yml

View workflow job for this annotation

GitHub Actions / Lint Ansible Role

4:1 [truthy] truthy value should be one of [false, true]
push:
branches:
- main

jobs:
molecule:
name: Run Molecule Tests
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.x'
cache: pip
- name: Cache pip dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- run: |
python3 -m pip install --upgrade pip
python3 -m pip install -r requirements.txt
- run: ansible-playbook molecule/default/prepare.yml --syntax-check
- run: molecule test

lint:
name: Lint Ansible Role
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.x'
cache: pip
- name: Cache pip dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- run: |
python3 -m pip install --upgrade pip
python3 -m pip install -r requirements.txt
- run: yamllint .
- run: ansible-lint .
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
*.retry
.idea/
.kitchen/
*.vault_pass
*.ssh_private_key
*.key
ansible-env/
20 changes: 20 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
ARG ANSIBLE_VERSION="<11>"

FROM python:3.12 AS base

RUN apt-get update -y \
&& apt-get full-upgrade -y \
&& apt-get install -y \
sshpass \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

RUN pip install --no-cache-dir \
"ansible${ANSIBLE_VERSION}" \
passlib

ENV PATH="/root/.local/bin:${PATH}"

COPY ./ /ansible_role_client_base/

WORKDIR /ansible_role_client_base
Loading

0 comments on commit dadda19

Please sign in to comment.