Uploaded image for project: 'Ansible Automation Platform RFEs'
  1. Ansible Automation Platform RFEs
  2. AAPRFE-1158

Request to not have invalid variable names imported into AAP

XMLWordPrintable

    • Icon: Feature Request Feature Request
    • Resolution: Unresolved
    • Icon: Normal Normal
    • None
    • 2.2, 2.3, 2.4
    • content
    • False
    • Hide

      None

      Show
      None
    • False

      Description:
      When a ServiceNow inventory is imported with columns that have a reference field, e.g. asset.install_status, support_group.name and location.name, AAP creates host variable names with a dot (".")which is not a valid Ansible variable name. The customer has many customized reference fields that show up with the invalid host variable name.

      If you use compose to create a new variable name, the old one with a dot in the name still exists, and there doesn’t seem to be a way to avoid importing them.

       

      Ask:

      The request is to not have invalid variable names imported into AAP.

       

      *Example ServiceNow Inventory file:*

       

      ---
      plugin: servicenow.itsm.now
      table: cmdb_ci_server
      strict: false
      # ERIC
      instance:
        timeout: 1200
        host: 'https://dev205587.service-now.com'
        username: echong
        password: #######
      columns:
        - sys_id
        - name
        - fqdn
        - serial_number
        - ip_address
        - os
        - os_version
        - asset.install_status
        - support_group.name
        - location.name
      compose:
        location_name: lookup('ansible.builtin.vars', 'location.name')
      ... 
      

       

      This seems to work:

      compose:
        location_name: lookup('ansible.builtin.vars', 'location.name', allow_unsafe=True)[0]

      Which returns the result:        

      "lnux101": {
                      "asset.install_status": "In use",
                      "fqdn": "",
                      "ip_address": "",
                      "location.name": "322 West 52nd Street, New York,NY",
                      "location_name": "322 West 52nd Street, New York,NY",
                      "name": "lnux101",
                      "os": "Linux Red Hat",
                      "os_version": "2.6.9-22.0.1.ELsmp",
                      "serial_number": "",
                      "support_group.name": "",
                      "sys_id": "539747cac0a801640163e60735fbbf6e"
                  },

       

              mferrari@redhat.com Massimo Ferrari
              rhn-support-jbyrd Jimmy Byrd
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated: