Start/Enable DNS service in an Infoblox member using Ansible

70 Views Asked by At

I recently started automating Infoblox using Ansible, so forgive me if this post doesnt make much sense but basically I'm trying to start the DNS service in a grid member. This is my current playbook:

 - name: Get object reference of the DNS service
    ansible.builtin.uri:
      url: "https://{hotsname_ip}/wapi/v2.12.2/request"
      body_format: json 
      user: "admin"
      password: "infoblox"
      validate_certs: no 
      return_content: yes
      method: GET 
      force_basic_auth: yes
      status_code: 200
    register: content

  - name: Use object refence to start DNS service
    ansible.builtin.uri:
      url: "https://{hotsname_ip}/wapi/v2.12.2/{{ content.json[0][\"_ref\"] }}"
      user: "admin"
      password: "infoblox"
      validate_certs: no 
      return_content: yes
      method: PUT
      force_basic_auth: yes
      status_code: 201, 301, 200
      headers:
        Content-Type: "application/json"
      body: 
        enable_dns: true
      body_format: json

What am I doing wrong? Am I thinking right? BTW this is the error that is prompted when I run this playbook:

 FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'dict object' has no attribute 'json'. 'dict object' has no attribute 'json'\n\nThe error appears to be in '/root/ansible_test/playbooks/manage_member.yml': line 48, column 5, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n  - name: Use object refence to start DNS service\n    ^ here\n"}

If I comment the second task, the playbook runs successfully but it doesnt initiate the service so I'm guessing the error is in the second task " Use object refence to start DNS service"

0

There are 0 best solutions below