AWX change project base path Kubernetes

Dear people,

I have successfully installed AWX with Kubernetes on Debian 12 with the following guide
https://computingforgeeks.com/how-to-install-ansible-awx-on-debian-buster/?expand_article=1

How can I change project base path ‘/var/lib/awx/projects’ from Kubernetes to the underlining Debian OS to ‘/opt/awx/projects’ or link between to directories?

I’ve searched my ass off but I can’t find a good tutorial or configuration.
I hope someone can help me.

Hey @ScorpionKing34, welcome! You can do this by changing the conf file found at /etc/awx/conf.d/custom.py per 15. Projects — Ansible AWX community documentation

Though I would heed its warning of “…as incorrect settings can disable your installation.”.

Hope this helps.

Is this in the shell of the Kubernetes? If so with one:
awx-operator-controller-manager 1/1 1 1 40m
awx-task 1/1 1 1 21m
awx-web 1/1 1 1 20m

On Debian OS I have no /etc/awx/conf.d directory.

opens issues on docs to get this changed to be more clear

In your spec for the operator, how did you set (or did you set) project_persistence?

Reason I am asking is as I am looking over the operator, it looks like we don’t even set local project storage if its not passed per https://github.com/ansible/awx-operator/blob/devel/roles/installer/templates/deployments/task.yaml.j2#L122

I followed the guide with this command:
$ tee awx-deploy.yml<<EOF


apiVersion: awx.ansible.com/v1beta1
kind: AWX
metadata:
name: awx

spec:
service_type: nodeport
projects_persistence: true
projects_storage_access_mode: ReadWriteOnce
web_extra_volume_mounts: |
- name: static-data
mountPath: /var/lib/projects
extra_volumes: |
- name: static-data
persistentVolumeClaim:
claimName: static-data-pvc

EOF

Tried also with the following option under extra_volumes no luck.

  • hostPath:
    path: /opt/awx/projects
    type: Directory
    name: os-mount

So, does anyone how to mount a local host OS directory ‘/opt/awx/projects’ into pod of AWX? So that I can use the Source Control Type ‘Manual’ to import project directories.

Also a side questions:

  1. If is suspend my vm and resume the vm, the pods does not run any more. Need to reboot to get AWX to work again. How can I fix this, search my ass of to find a solution.

  2. How can AWX in Kubernetes be configured with a ssl certificate and https?

  3. How can AWX in Kubernetes be configured with ldap?

I’ll hope someone could help me.

Does someone have a solution for this?

in your snippet

hostPath:
path: /opt/awx/projects
type: Directory
name: os-mount

the volume is defined as os-mount and in your other snippet the volumeMount is refering to static-data

also the project dir need to be mounted to both web and task container for this to work correctly

I follow this tutorial:

How can I apply your suggestion? Or do you know a good step-by-step instruction also for Ubuntu and enable /opt/awx/projects?

Is there anyone who can help me with my issue?

Here are quick steps:

# Change permission and owner for /opt/awx/projects
$ sudo chmod 775 /opt/awx/projects
$ sudo chown 1000:0 /opt/awx/projects

# Create pv.yml and pvc.yml
$ tee pv.yml << EOF
---
apiVersion: v1
kind: PersistentVolume
metadata:
  name: awx-projects-volume
spec:
  accessModes:
    - ReadWriteOnce
  persistentVolumeReclaimPolicy: Retain
  capacity:
    storage: 2Gi
  storageClassName: awx-projects-volume
  hostPath:
    path: /opt/awx/projects
EOF

$ tee pvc.yml << EOF
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: awx-projects-claim
spec:
  accessModes:
    - ReadWriteOnce
  volumeMode: Filesystem
  resources:
    requests:
      storage: 2Gi
  storageClassName: awx-projects-volume
EOF

# Apply pv.yml and pvc.yml
$ kubectl apply -f pv.yml
$ kubectl -n awx apply -f pvc.yml

# Update your awx-deploy.yml
$ tee awx-deploy.yml << EOF
---
apiVersion: awx.ansible.com/v1beta1
kind: AWX
metadata:
  name: awx
spec:
  service_type: nodeport
  projects_persistence: true
  projects_existing_claim: awx-projects-claim

  # Following lines are superfluous settings that serves no purpose and may be deleted
  # web_extra_volume_mounts: |
  #   - name: static-data
  #     mountPath: /var/lib/projects
  # extra_volumes: |
  #   - name: static-data
  #     persistentVolumeClaim:
  #       claimName: static-data-pvc
EOF

Then go back to your guide to deploy updated awx-deploy.yml.