FROM ubuntu:22.04

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update && \
    apt-get install -y --no-install-recommends \
        python3 python3-pip openssh-client vim git \
        ansible && \
    rm -rf /var/lib/apt/lists/*

RUN mkdir -p /ansible

RUN useradd -ms /bin/bash uansible
USER uansible
WORKDIR /home/uansible

RUN mkdir -p /home/uansible/.ssh && \
    chmod 700 /home/uansible/.ssh && \
    echo export ANSIBLE_CONFIG=/ansible/ansible.cfg>>~/.bashrc && \
    echo cd /ansible>>~/.bashrc

ENTRYPOINT ["/bin/bash", "-lc"]
CMD ["bash"]
