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 6131f99 commit 6e744c0
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
10 changes: 9 additions & 1 deletion apps/ansible/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ USER root

WORKDIR "/ansible/project"

# Set ansible.cfg
COPY ./test/ansible.cfg /etc/ansible/

# Copy test files
COPY ./test/inventory ./test/
COPY ./test/playbook.yml ./test/

# Install tools
RUN yum check-update; \
yum install -y gcc libffi-devel; \
yum install -y wget; \
Expand All @@ -23,7 +31,7 @@ RUN yum check-update; \
yum install -y curl; \
yum clean all


# Install python packages
RUN ln -s $(command -v pip3) /usr/local/bin/pip; \
pip install --upgrade pip; \
pip install --upgrade virtualenv; \
Expand Down
2 changes: 2 additions & 0 deletions apps/ansible/test/ansible.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[defaults]
host_key_checking = False
2 changes: 2 additions & 0 deletions apps/ansible/test/inventory
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[nodes]
27.76.56.218 ansible_ssh_user=root ansible_ssh_pass=yourpassword
7 changes: 7 additions & 0 deletions apps/ansible/test/playbook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
- hosts: nodes
tasks:
- name: Write hello world to /tmp/ansible
copy:
content: "hello world\n"
dest: /tmp/ansible

0 comments on commit 6e744c0

Please sign in to comment.