adding tests

- stat doesn't work on remote, need to figure out a workaround
This commit is contained in:
Matthew Stobbs
2025-02-14 22:52:53 -07:00
parent a4ec35e5b3
commit 069c4aa49e
9 changed files with 45 additions and 15 deletions

17
tests/Containerfile Normal file
View File

@@ -0,0 +1,17 @@
FROM fedora:41
LABEL PROJECT "ansible_role_package"
LABEL MAINTAINER "Matthew Stobbs <matthew@stobbs.ca>"
RUN useradd -d /home/ansible -m -G wheel ansible
RUN dnf install -y openssh-server python3-paramiko python3-libdnf5
EXPOSE 22
USER ansible
WORKDIR /home/ansible
RUN mkdir /home/ansible/.ssh
COPY ./pubkey /home/ansible/.ssh/authorized_keys
USER root
RUN echo "ansible ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/sudoers
RUN ssh-keygen -A
ENTRYPOINT /usr/sbin/sshd -D

View File

@@ -1,2 +0,0 @@
localhost

7
tests/inventory.yml Normal file
View File

@@ -0,0 +1,7 @@
test:
hosts:
localhost:
ansible_ssh_host: 127.0.0.1
ansible_ssh_port: 2222
ansible_ssh_user: ansible
ansible_ssh_extra_args: "-o StrictHostKeyChecking=no"

1
tests/pubkey Normal file
View File

@@ -0,0 +1 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAAxfDLK7wu1ITTMV8gIzImO+KkXsjByvN7gYebqb5e+ stobbsm@ed25591

View File

@@ -2,4 +2,9 @@
- hosts: localhost
remote_user: root
roles:
- ansible_role_package
- role: ansible_role_package
vars:
use_local: false
packages:
- air
- ansible-language-server