From 8709582913f475e82359ff152e6f48ebe28d8793 Mon Sep 17 00:00:00 2001 From: Darren <27513732@qq.com> Date: Wed, 13 Dec 2023 11:21:47 +0800 Subject: [PATCH] test ansible --- apps/ansible/Dockerfile | 7 ++++--- apps/ansible/Notes.md | 1 + apps/ansible/test/README.md | 22 ++++++++++++++++++++++ apps/ansible/variables.json | 2 +- 4 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 apps/ansible/test/README.md diff --git a/apps/ansible/Dockerfile b/apps/ansible/Dockerfile index 8ef07aab3..d13c30801 100644 --- a/apps/ansible/Dockerfile +++ b/apps/ansible/Dockerfile @@ -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="help@websoft9.com" -LABEL version="latest" + +# You should change the below if official image latest version changed +LABEL version="2.16.1" LABEL description="Ansible" USER root @@ -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; \ diff --git a/apps/ansible/Notes.md b/apps/ansible/Notes.md index 114000dc0..afc13d60f 100644 --- a/apps/ansible/Notes.md +++ b/apps/ansible/Notes.md @@ -1,2 +1,3 @@ # Ansible +This image based on Ansible official image, Test case at test directory \ No newline at end of file diff --git a/apps/ansible/test/README.md b/apps/ansible/test/README.md new file mode 100644 index 000000000..0e299fc9c --- /dev/null +++ b/apps/ansible/test/README.md @@ -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 + ``` \ No newline at end of file diff --git a/apps/ansible/variables.json b/apps/ansible/variables.json index 08d204740..bf3230def 100644 --- a/apps/ansible/variables.json +++ b/apps/ansible/variables.json @@ -7,7 +7,7 @@ { "dist": "community", "version": [ - "latest" + "2.16.1" ] } ],