Skip to content

Commit

Permalink
test ansible
Browse files Browse the repository at this point in the history
  • Loading branch information
chendelin1982 authored Dec 13, 2023
1 parent 6e744c0 commit 8709582
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 4 deletions.
7 changes: 4 additions & 3 deletions apps/ansible/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# image: https://github.com/orgs/ansible-community/packages/container/package/community-ee-base
# image and version from: https://github.com/orgs/ansible-community/packages/container/package/community-ee-base
# docs1: https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html#installing-ansible-to-containers
# docs2: https://learn.microsoft.com/en-us/azure/developer/ansible/configure-in-docker-container

FROM ghcr.io/ansible-community/community-ee-base:latest

LABEL maintainer="[email protected]"
LABEL version="latest"

# You should change the below if official image latest version changed
LABEL version="2.16.1"
LABEL description="Ansible"

USER root
Expand All @@ -21,7 +23,6 @@ COPY ./test/playbook.yml ./test/

# Install tools
RUN yum check-update; \
yum install -y gcc libffi-devel; \
yum install -y wget; \
yum install -y openssl; \
yum install -y vim; \
Expand Down
1 change: 1 addition & 0 deletions apps/ansible/Notes.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# Ansible

This image based on Ansible official image, Test case at test directory
22 changes: 22 additions & 0 deletions apps/ansible/test/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Test Ansible

1. 运行 Ansible 容器
```
docker run -it -d --name ansible websoft9dev/ansible
```
2. 进入容器
```
docker exec -it ansible bash
```
3. 使用 vim 编辑 test 目录下的 inventory 文件,修改成您的目标主机
```
vim test/inventory
```
4. 运行 Ansible playbook
```
cd test
ansible-playbook -i inventory playbook.yml
```
2 changes: 1 addition & 1 deletion apps/ansible/variables.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{
"dist": "community",
"version": [
"latest"
"2.16.1"
]
}
],
Expand Down

0 comments on commit 8709582

Please sign in to comment.