Skip to content

Commit

Permalink
add README.md and update image tags
Browse files Browse the repository at this point in the history
  • Loading branch information
anonymousmaharaj committed Sep 13, 2024
1 parent a5f84d0 commit d4cc24a
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- 'main'

env:
TAG: 0.0.1
TAG: 10.4.0

jobs:
docker:
Expand Down
53 changes: 53 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Ansible Docker Image for GitLab CI

This repository contains a Dockerfile for creating a Docker image with Ansible, used in GitLab CI.

## Description

This Docker image is based on Alpine Linux 3.16.2 and includes:

- Ansible 10.4.0 (current version)
- Python 3
- Additional tools: git, openssh, sshpass
- Python libraries: boto3, requests, python-gitlab, python-dotenv

The image is optimized for use in CI/CD pipelines, particularly in GitLab CI.

## Dockerfile

Main stages of image building:

1. Installing base dependencies
2. Installing Ansible and required Python packages
3. Clearing cache and removing temporary files to reduce image size

## Usage

To build the image:

```bash
docker build -t ansible-image .
```

To run the container:

```
docker run -it --rm \
-v $(pwd):/ansible \
-w /ansible \
ansible-image ansible-playbook --syntax-check playbooks/*
```

## Important Notes
1. The image has an empty entrypoint. In GitLab CI, you need to specify direct commands, such as:

```bash
ansible-playbook --syntax-check playbooks/* -i inventory
```

2. For use in GitLab CI, it is recommended to set the path to the Ansible configuration file in the ANSIBLE_CONFIG variable:

```yaml
variables:
ANSIBLE_CONFIG: "/path/to/your/ansible.cfg"
```

0 comments on commit d4cc24a

Please # to comment.