Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provider Configuration Documentation (StrictHostKeyChecking=no) #121

Open
alexandrud opened this issue May 9, 2024 · 1 comment
Open
Labels
type/documentation Improvements or additions to documentation

Comments

@alexandrud
Copy link

alexandrud commented May 9, 2024

Hi,

Are there no configuration options for the Ansible provider? In my case, since I'm working on a proof of concept, I re-build a VM with the same IP several times. Since the key for the host changes, the playbook fails. I looked around for documentation on provider configuration options, but could not find anything. It would be nice to be able to set options for the provider from the configuration block. Maybe follow the ansible.cfg structure: https://docs.ansible.com/ansible/latest/reference_appendices/config.html

provider "ansible" {
  defaults {
     host_key_checking = false
  }
  galaxy {
     server = "some.server.com"
  }
  persistent_connection {
     command_timeout = 30
  }
}
@alexandrud
Copy link
Author

Apparently ansible does offer a way to do this at runtime. It has a couple of variables to manipulate this. I ended up with:

resource "ansible_playbook" "playbook" {
  for_each   = toset(var.ansible_playbooks)
  playbook   = each.key
  name       = vsphere_virtual_machine.vm.default_ip_address
  replayable = var.ansible_replayable
  tags       = var.ansible_tags
  verbosity  = var.ansible_verbosity
  extra_vars = {
    ansible_ssh_host_key_checking = var.ansible_ssh_host_key_checking
  }
}

@gravesm gravesm added the type/documentation Improvements or additions to documentation label Jun 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants