diff --git a/devfile.yaml b/devfile.yaml index 91150ae..1dbf065 100644 --- a/devfile.yaml +++ b/devfile.yaml @@ -10,40 +10,3 @@ components: cpuRequest: 250m cpuLimit: 2000m name: ansible -# commands: -# - exec: -# commandLine: molecule lint -# component: ansible -# label: 'Molecule: Lint' -# workingDir: /projects/ansible-role-tower-config -# id: molecule-lint -# - exec: -# commandLine: yamllint . -# component: ansible -# label: 'Yamllint: workshops' -# workingDir: /projects/workshops -# id: yamllint-workshops -# - exec: -# commandLine: ansible-playbook provision_lab.yml -e @sample_workshops/sample-vars-rhel.yml -# component: ansible -# label: 'Workshop: RHEL' -# workingDir: /projects/workshops/provisioner -# id: workshop-rhel -# - exec: -# commandLine: ansible-playbook provision_lab.yml -e @sample_workshops/sample-vars-networking.yml -# component: ansible -# label: 'Workshop: Networking' -# workingDir: /projects/workshops/provisioner -# id: workshop-networking -# - exec: -# commandLine: ansible-playbook provision_lab.yml -e @sample_workshops/sample-vars-security.yml -# component: ansible -# label: 'Workshop: Security' -# workingDir: /projects/workshops/provisioner -# id: workshop-security -# - exec: -# commandLine: ansible-playbook provision_lab.yml -e @sample_workshops/sample-vars-f5.yml -# component: ansible -# label: 'Workshop: F5' -# workingDir: /projects/workshops/provisioner -# id: workshop-f diff --git a/devspaces/.bashrc b/devspaces/.bashrc new file mode 100644 index 0000000..bf21305 --- /dev/null +++ b/devspaces/.bashrc @@ -0,0 +1,11 @@ +#!/bin/bash +PROMPT_COMMAND=__prompt_command + +__prompt_command() { + local RC="$?" + RC_MSG="" + if [ "$RC" != 0 ]; then + RC_MSG="\[$(tput sgr0)\]\[\033[38;5;9m\]$RC\[$(tput sgr0)\]" + fi + PS1="\[\033[38;5;56m\]\u\[$(tput sgr0)\]\[\033[38;5;8m\]@\[$(tput sgr0)\]\[\033[38;5;130m\]${CONTAINER_NAME}\[$(tput sgr0)\]: \[$(tput sgr0)\]\[\033[38;5;25m\]\w\[$(tput sgr0)\] \[$(tput sgr0)\]\[\033[38;5;28m\]\$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/')\[$(tput sgr0)\]$RC_MSG\n\\$ \[$(tput sgr0)\]" +} \ No newline at end of file diff --git a/devspaces/Containerfile b/devspaces/Containerfile new file mode 100644 index 0000000..2683f60 --- /dev/null +++ b/devspaces/Containerfile @@ -0,0 +1,30 @@ +# replace with your EE +ARG EE_BASE_IMAGE=towerpah.shadowman.dev/shadowmanee:latest +FROM $EE_BASE_IMAGE + +LABEL ansible-execution-environment=true + +USER root +WORKDIR /tmp + +COPY shells /etc/shells +COPY .bashrc /home/runner/.bashrc + +RUN printf "export CONTAINER_NAME=$ansibleee\n" >> /home/runner/.bashrc + +RUN for dir in \ + /home/runner \ + /home/runner/.ansible \ + /home/runner/.ansible/tmp \ + /runner \ + /home/runner \ + /runner/env \ + /runner/inventory \ + /runner/project \ + /runner/artifacts ; \ + do mkdir -m 0775 -p $dir ; chmod -R g+rwx $dir ; chgrp -R root $dir ; done && \ + for file in \ + /home/runner/.ansible/galaxy_token \ + /etc/passwd \ + /etc/group ; \ + do touch $file ; chmod g+rw $file ; chgrp root $file ; done \ No newline at end of file diff --git a/devspaces/README.md b/devspaces/README.md new file mode 100644 index 0000000..4f9df87 --- /dev/null +++ b/devspaces/README.md @@ -0,0 +1,6 @@ +# Modifying permissions for Ansible-Lint and bash to work in CodeReady workspaces +Run + +podman build --tag YOURIMAGENAMEANDTAG -f Containerfile + +to modify your existing EE to work in CodeReady workspaces. Then push the image to your container registry. Utilize the devfile.yaml and adjust for your registry and image \ No newline at end of file diff --git a/devspaces/shells b/devspaces/shells new file mode 100644 index 0000000..ccf8e66 --- /dev/null +++ b/devspaces/shells @@ -0,0 +1,4 @@ +/bin/bash +/usr/bin/bash +/bin/sh +/usr/bin/sh \ No newline at end of file diff --git a/support/ansible-udi/Dockerfile b/support/ansible-udi/Dockerfile deleted file mode 100644 index 1f6fc22..0000000 --- a/support/ansible-udi/Dockerfile +++ /dev/null @@ -1,10 +0,0 @@ -FROM registry.redhat.io/devspaces/udi-rhel8:3.3-37.1673517018 - -RUN /usr/sbin/alternatives --set python /usr/bin/python3.9 -RUN /usr/sbin/alternatives --set python3 /usr/bin/python3.9 - -RUN python3 -m pip install --upgrade pip -RUN python3 -m pip install ansible-navigator - -RUN echo "" >> /home/user/.bashrc -RUN echo "export TERM='xterm-256color'" >> /home/user/.bashrc diff --git a/support/ansible-udi/README.txt b/support/ansible-udi/README.txt deleted file mode 100644 index 3687412..0000000 --- a/support/ansible-udi/README.txt +++ /dev/null @@ -1,20 +0,0 @@ -The universal developer image provided by Red Hat does not currently include the Ansible CLI and tooling in its build. We are extending the image with the appropriate tooling via this image. - -To build and test the image on a Mac ARM64 / new M1 processor, use Docker with this command: - docker buildx build --platform linux/amd64 -t test . - -To test this image locally after build: - docker run --privileged -it test -c /bin/bash - - -KNOWN ISSUES: - -For some reason with v2 of the Dockerfile, pyyaml isn't persisting and ansible complains on startup about missing module. - -NEED TO RUN inside container: -pip3 install pyyaml - -NOTE - this is only needed when running the container outside of OCP -su user - -Then any ansible-navigator commands will work diff --git a/support/ansible-udi/build.sh b/support/ansible-udi/build.sh deleted file mode 100755 index 27d8c23..0000000 --- a/support/ansible-udi/build.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -REGISTRY=quay.io -REPO=rhn_ssp_adworjan/ansibleubi -VERSION=1.0 - -docker buildx build --platform linux/amd64 -t $REGISTRY/$REPO:$VERSION . - -if [ $? -eq 0 ] -then - echo "Successfully built image. Pushing to registry" - docker push $REGISTRY/$REPO:$VERSION -else - echo "Unable to build image. Skipping push." -fi