Skip to content

vagrant - Could not resolve hostname instance #299

Open
@magick93

Description

Hello

I'm trying to get molecule working with vagrant.

I've tried various examples, such as the following:

---
driver:
  name: vagrant
  provider:
    # Can be any supported provider (virtualbox, parallels, libvirt, etc)
    # Defaults to virtualbox
    name: libvirt
  # Run vagrant up with --provision.
  # Defaults to --no-provision)
  provision: no
  # vagrant-cachier configuration
  # Defaults to 'machine'
  # Any value different from 'machine' or 'box' will disable it
  cachier: machine
  # If set to false, set VAGRANT_NO_PARALLEL to '1'
  # Defaults to true
  parallel: true
  # vagrant box to use by default
  # Defaults to 'generic/alpine316'
  default_box: 'bento/ubuntu-22.04'
platforms:
  - name: instance
    # If specified, set host name to hostname, unless it's set to False and
    # the host name won't be set. In all other cases (including default) use
    # 'name' as host name.
    hostname: foo.bar.com
    # List of dictionaries mapped to `config.vm.network`
    interfaces:
      - auto_config: true
        network_name: private_network
        type: static
        ip: 192.168.10.42
    # List of raw Vagrant `config` options
    instance_raw_config_args:
      # use single quotes to avoid YAML parsing as dict due to ':'
      - 'vm.synced_folder ".", "/vagrant", type: "rsync"'
      # Run 'uname' a provisionning step **needs 'provision: true' to work**
      - 'vm.provision :shell, inline: "uname"'
    # Dictionary of `config` options. Note that string values need to be
    # explicitly enclosed in quotes.
    config_options:
      ssh.keep_alive: yes
      ssh.remote_user: 'vagrant'
      synced_folder: true
    box: bento/ubuntu-22.04
    # box_version: 32.20200422.0
    box_url:
    memory: 512
    cpus: 1
    # Dictionary of options passed to the provider
    provider_options:
      video_type: 'vga'
    # List of raw provider options
    provider_raw_config_args:
      - cpuset = '1-4,^3,6'

But I always get the following error:

TASK [Gather system info] ******************************************************
fatal: [instance]: UNREACHABLE! => 
{
   "changed": false, 
   "msg": "Failed to connect to the host via ssh: ssh: Could not resolve hostname instance: Name or service not known", 
   "unreachable": true
}

Versions

molecule 25.2.0 using python 3.11
ansible:2.18.2
podman:23.7.0 from molecule_plugins requiring collections: containers.podman>=1.7.0 ansible.posix>=1.3.0
openstack:23.7.0 from molecule_plugins requiring collections: openstack.cloud>=2.1.0
ec2:23.7.0 from molecule_plugins
docker:23.7.0 from molecule_plugins requiring collections: community.docker>=3.10.2 ansible.posix>=1.4.0
containers:23.7.0 from molecule_plugins requiring collections: ansible.posix>=1.3.0 community.docker>=1.9.1 containers.podman>=1.8.1
gce:23.7.0 from molecule_plugins requiring collections: google.cloud>=1.0.2 community.crypto>=1.8.0
vagrant:23.7.0 from molecule_plugins
azure:23.7.0 from molecule_plugins
default:25.2.0 from molecule

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions