Skip to content

Instantly share code, notes, and snippets.

@chornberger-c2c
Last active July 4, 2023 16:34
Show Gist options
  • Save chornberger-c2c/c0a9393106e70df7434a1c1d4d5e1d7f to your computer and use it in GitHub Desktop.
Save chornberger-c2c/c0a9393106e70df7434a1c1d4d5e1d7f to your computer and use it in GitHub Desktop.
Migrate from one Ansible Controller (eg. AWX) to another (eg. Red Hat AAP2)
---
- name: Export assets from one Ansible Controller (eg. AWX) and import to another one (eg. AAP2)
hosts: localhost
vars:
source_controller_host: "https://source-awx.example.com"
source_controller_user: "admin"
source_controller_password: "password"
target_controller_host: "https://target-aap2.example.com"
target_controller_user: "admin"
target_controller_password: "password"
tasks:
- name: "Export assets from {{ source_controller_host }}"
awx.awx.export:
all: True
#
# for specific exports, uncomment from the list of options below
# see https://docs.ansible.com/ansible/latest/collections/awx/awx/export_module.html
#
# credential_types: all
# credentials: all
# execution_environments: all
# inventory: all
# inventory_sources: all
# job_templates: all
# notification_templates: all
# organizations: all
# projects: all
# teams: all
# users: all
# workflow_job_templates: all
#
controller_host: "{{ source_controller_host }}"
controller_username: "{{ source_controller_user }}"
controller_password: "{{ source_controller_password }}"
validate_certs: false
register: export_output
- name: "Pause until {{ target_controller_host }} is available"
ansible.builtin.pause:
prompt: "Please press enter once {{ target_controller_host }} is up and running"
- name: "Import assets to {{ target_controller_host }}"
awx.awx.import:
assets: "{{ export_output.assets }}"
controller_host: "{{ target_controller_host }}"
controller_username: "{{ target_controller_user }}"
controller_password: "{{ target_controller_password }}"
validate_certs: false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment