Skip to content

Commit

Permalink
YQ / Ansible / Packer stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
eifelmicha committed Jan 15, 2025
1 parent 0b0407b commit d85e2d8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
1 change: 1 addition & 0 deletions azure/.env
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ PACKER_ANSIBLE_VERSION=1.1.1
PACKER_AMAZON_VERSION=1.3.2
TERRAFORM_VERSION=1.10.3
TFLINT_VERSION=0.36.0
YQ_VERSION=4.44.3
15 changes: 9 additions & 6 deletions azure/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ ARG ANSIBLE_VERSION \
PACKER_ANSIBLE_VERSION \
PACKER_AMAZON_VERSION \
TERRAFORM_VERSION \
TFLINT_VERSION
TFLINT_VERSION \
YQ_VERSION

RUN groupadd -g 1000 admin && useradd -u 1000 -g 1000 -s /bin/bash -d /home/admin admin
COPY ./ansible_collections.yml /home/admin/ansible_collections.yml
Expand Down Expand Up @@ -64,15 +65,15 @@ RUN python3.12 -m venv /opt/ansible_virtualenv \

# Install Packer + Plugins
RUN curl -sLSfo packer.zip https://releases.hashicorp.com/packer/${PACKER_VERSION}/packer_${PACKER_VERSION}_linux_$(dpkg --print-architecture).zip && unzip -o packer.zip && mv packer /usr/bin -f && rm packer.zip
RUN packer plugins install "github.com/hashicorp/amazon" ${PACKER_ANSIBLE_VERSION} && \
packer plugins install "github.com/hashicorp/ansible" ${PACKER_ANSIBLE_VERSION}

# Install Terraform
RUN curl -sLSfo terraform.zip https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_$(dpkg --print-architecture).zip && unzip -o terraform.zip && mv terraform /usr/bin -f && rm terraform.zip

# Install TFlint
RUN curl -sLSfo tflint.zip https://github.com/terraform-linters/tflint/releases/download/v${TFLINT_VERSION}/tflint_linux_$(dpkg --print-architecture).zip && unzip -o tflint.zip && mv tflint /usr/bin -f && rm tflint.zip

# Install YQ
RUN curl -sLSfo /usr/bin/yq https://github.com/mikefarah/yq/releases/download/v${YQ_VERSION}/yq_linux_$(dpkg --print-architecture) && chmod +x /usr/bin/yq

# cleanup apt mess
RUN apt-get purge -y man-db && apt-get clean \
Expand All @@ -87,10 +88,12 @@ RUN apt-get purge -y man-db && apt-get clean \
# fatal: detected dubious ownership in repository at '/git'
RUN git config --global --add safe.directory /git

RUN chown -R 1000:1000 /home/admin
USER admin
RUN chown -R 1000:1000 /home/admin
USER admin
WORKDIR /home/admin

RUN ansible-galaxy collection install -r ~/ansible_collections.yml
RUN ansible-galaxy collection install -r ~/ansible_collections.yml
RUN packer plugins install "github.com/hashicorp/amazon" ${PACKER_ANSIBLE_VERSION} && \
packer plugins install "github.com/hashicorp/ansible" ${PACKER_ANSIBLE_VERSION}

CMD ["/bin/bash"]

0 comments on commit d85e2d8

Please sign in to comment.