-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexport.yml
56 lines (51 loc) · 1.67 KB
/
export.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
---
- name: Export config as code info from AWX, AAP, or Ascender
hosts: save-files
gather_facts: false
vars:
# These are the objects you wish to export. Be sure to comment out any you don't want.
export_objects:
- applications
- credentials
- credential_types
- execution_environments
- inventory
- inventory_sources
- job_templates
- notification_templates
- organizations
- projects
- schedules
- teams
- users
- workflow_job_templates
# This is setting up environment variables for use with the awx.awx collection.
# I'm passing these variables in, but you can hard code them if you choose.
environment:
CONTROLLER_HOST: "https://{{ export_host }}"
CONTROLLER_USERNAME: "{{ gen1_user }}"
CONTROLLER_PASSWORD: "{{ gen1_pword }}"
CONTROLLER_VERIFY_SSL: false
tasks:
- name: Create temp file directory in the EE
ansible.builtin.file:
path: /tmp/export_files
state: directory
mode: '0755'
delegate_to: localhost
- name: Create temp file directory on the remote host
ansible.builtin.file:
path: /tmp/export_files
state: directory
mode: '0755'
- name: Create all of the export files from template file
ansible.builtin.template:
src: export_template.yml.j2
dest: "{{ playbook_dir }}/export_{{ item }}.yml"
mode: '0755'
loop: "{{ export_objects }}"
delegate_to: localhost
- name: Export objects loop. Loop through list and export those categories.
ansible.builtin.include_tasks:
file: "export_{{ item }}.yml"
loop: "{{ export_objects }}"