Questions/howto: AWX version updates

Hello!

I like to try to Update my Test AWX, but i have a few questions before i start:
1:
in this guide they use docker run, but not kubectl to set the awx_operator to the new version(?)
2.1:
I used this guide to get my AWX with kustomize running.
Does this code always install the most recent version?

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
  # Find the latest tag here: https://github.com/ansible/awx-operator/releases
  - github.com/ansible/awx-operator/config/default?ref=2.12.2
  - awx-manifest.yaml

  # Set the image tags to match the git version from above
images:
  - name: quay.io/ansible/awx-operator
    newTag: 2.12.2

  # Specify a custom namespace in which to install AWX
namespace: awx

2.2:
And whats does this “newTag: 2.12.2” mean?

3:
Is there a method to copy the data from the live awx version to the new updated testserver?
So i could build a Playbook which installs the current version and tranfer the data from the “old server” so i could switch them if everything went as intendet?

4:
I had a sw in docker you could set the file directory and Database to a local one - so if you created a new container with the new version and tell where the files/db is, you dont have to use backups all the time just to get the newest version to run.
Is it posssible/recommendet to do something like this?

Thank you!

I don’t have answers for all your questions, but for #3 in your list, you can use the awx.awx.export module in a playbook to export the settings of your current AWX installation.

Save the export results to a file. The file will contain all of your settings, but sensitive settings will have placeholders instead of your actual values.

For example, your credentials will look like this in the export file.

- credential_type: {kind: cloud, name: A10, type: credential_type}
  description: Development A10 Credentials
  inputs: {a10_password: $encrypted$, a10_username: MyA10User}
  name: A10 Dev
  natural_key:
    credential_type: {kind: cloud, name: A10, type: credential_type}
    name: A10 Dev
    organization: {name: MyOrg, type: organization}
    type: credential
  organization: {name: MyOrg, type: organization}

Notice the $encrypted$ value. You will have to go through the export file and replace those placeholders with the real values.

Then, you can use the awx.awx.import module to send those settings to the new installation. I have never done this to send an entire configuration from one instance to another, but I have used it to send parts of the configuration from one instance to another.

Sample playbook to export all settings into their own yaml files:

- name:  ========== Export AWX Settings ==========
  connection: local
  hosts: lab
  gather_facts: no
  environment:
    CONTROLLER_USERNAME: "{{ vault_controller_username }}"
    CONTROLLER_PASSWORD: "{{ vault_controller_password }}"
    CONTROLLER_HOST: "{{ awx_url }}"

  tasks:
    - name: Export All Settings
      awx.awx.export:
        all: True
      register: assets

    - name: SAVE EXPORT TO YML FILE
      delegate_to: localhost
      copy:
        dest: "exports/backup.yml"
        content: "{{ assets.assets | to_yaml }}"

    - name: SAVE JOB_TEMPLATES TO YML FILE
      delegate_to: localhost
      copy:
        dest: "exports/backup_{{ item.key }}.yml"
        content: "{{ { item.key : item.value } | to_yaml }}"
      with_items: "{{ assets.assets | dict2items }}"

Sample playbook to import all settings from backup files in the exports directory:

- name:  ========== Import All AWX Settings ==========
  connection: local
  hosts: lab
  gather_facts: no
  environment:
    CONTROLLER_USERNAME: "{{ vault_controller_username }}"
    CONTROLLER_PASSWORD: "{{ vault_controller_password }}"
    CONTROLLER_HOST: "{{ awx_url }}"

  tasks:
    - name: IMPORT SETTINGS FROM EXPORTS
      awx.awx.import:
        assets: "{{ lookup('file', item) | from_yaml }}"
      when: "'backup_job_templates' in item"
      with_fileglob:
        - exports/backup_*.yml
      loop_control:
        label: "{{ item | split('/') | last }}"
1 Like

Thank you!
This is extremely helpful - the location is then in the compose container with web as part of its name?

I have problems to adapt the Playbook:
Do i have to add the Server with the container as lab inventory?
It skips because nothing exists as lab and when i set hosts to localhosts the playbook fails because it doesnt know where to get the vault… variables.
when i delete the Enviroment part it fails too.

1 Like

I got the backups via the awx kit.
my last problem is to understand how i have to set the content of my kustomization file so it uses the newest version opf the wax operator.

I got it now - the git has been updated and i have now the newest version.
Somehow the recources changing from
github.com/ansible/awx-operator/config/default?ref=2.10.0
to
github.com/ansible/awx-operator/config/default?ref=2.12.2
and the tags
But i dont get the realtion with the value of the tags - theyre not the same like the awx web gui version and not of the awx-operator version.
:thinking:
I use this git:

I got the solution:
I looked the wrong row and the number in the config actually is the version of the awx-operator. and i leaned that i just have to edit the version at the two places in the file and just enter:

kubectl apply -k .

and wait 5 minutes to finally get my patched awx application.

Change the version number in your kustomize file, and run the “kubectl apply -k .” command to have kubernetes push the newer awx-operator image.

1 Like

I tested it and was amazed how easy it is :laughing:

I tried it yesterday wand was sĂĽeechless how easy it was in the end :laughing:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.