Score:0

How to import all projects defined in a metadata.yml file?

cn flag

This is my first foray into anything AWX/Ansible, so please be gentle :)

I've set up a new AWX instance in Kubernetes (using the AWX Operator), and am trying to import our existing job-templates from an old instance (that I did not set up, nor have control over). There is a metadata.yml file in our playbooks repo that defines them. The format is:

project_name: playbooks
project_version: 2.5.7
project_type:
   - ansible
awx:
##################################
# Project List
##################################
  - name: patching playbooks
    awx.awx.project:
      name: 'patching.playbooks'
      description: "General purpose server patching playbooks."
      organization: "our-team"
      state: present
      update_project: yes
      scm_type: git
      scm_clean: yes
      scm_url: "https://git.company.com/our-team/repo.git"
      scm_branch: master
      allow_override: yes

  - name: "ubuntu-patching"
    awx.awx.job_template:
      name: "Ubuntu-Patching"
      description: "Patch Ubuntu servers."
      organization: "our-team"
      state: present
      execution_environment: "AWX EE"
      project: patching.playbooks
      credentials: ['awx-ssh-key', ]
      inventory: 'non-prod'
      playbook: patch_ubuntu.yml
      job_type: check
      limit: 'invalid.company.com'
      allow_simultaneous: true
      ask_inventory_on_launch: true
      ask_credential_on_launch: true
      ask_job_type_on_launch: true
      ask_limit_on_launch: true
      ask_scm_branch_on_launch: true
      ask_variables_on_launch: true
      ask_verbosity_on_launch: true
      extra_vars:
        resize_disks: true
      notification_templates_error:
        - 'notify-us'
  ...

There are multiple of these "awx.awx.job_template" objects. I would really like to not import every one of them manually. Is there something in Tower that I can use to import them automatically? Am I missing something obvious?

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.