Can't get main_ip with Ansible Vulrt

51 Views Asked by At

I create an instance and try to display the IP using the playbook, but it tells me that there is no such value. although if you look at the output of information for this instance, it is there. what to do?

  - name: Create an instance using OS
    vultr.cloud.instance:
      state: present
      api_key: "{{api}}"
      hostname: "{{ddns_password}}"
      label: test
      plan: vhp-1c-2gb-amd
      backups: true
      enable_ipv6: false
      region: ams
      os: Ubuntu 22.04 LTS x64
      ssh_keys:
        - u01
        - u02
        - u03
      tags: 
        - "{{tag}}"
    register: my_droplet

  - name: Preparation and transfer of information
    vultr.cloud.instance_info:
      api_key: "{{api}}"
      label: test
    register: ipv4addr

  - name: Show IP
    ansible.builtin.debug:
      var: ipv4addr.main_ip

enter image description here

Please, look at my code and say where my mistake.

0

There are 0 best solutions below