ansible / terraform-provider-ansible

community terraform provider for ansible
https://registry.terraform.io/providers/ansible/ansible/latest
GNU General Public License v3.0
183 stars 42 forks source link

Ansible Playbook fails since Version 1.3.0 #124

Open willifehler opened 1 month ago

willifehler commented 1 month ago

Hey there,

I've upgraded to Provider Version 1.3.0 and since then my deployment fails.

EXEC sshpass -d48 ssh -vvv -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o 'User="ansible"' -o ConnectTimeout=10 -o server1.example.net '/bin/sh -c '"'"'sudo -H -S -n  -u root /bin/sh -c '"'"'"'"'"'"'"'"'echo BECOME-SUCCESS-nawzfybhkefvucapqlwiwuvjiqouolnn ; /usr/bin/python'"'"'"'"'"'"'"'"' && sleep 0
10080 '"'"''
10081 │ fatal: [server1.example.net]: UNREACHABLE! => {
10082 │     "changed": false,
10083 │     "msg": "Data could not be sent to remote host \"server1.example.net\". Make sure this host can be reached over ssh: command-line line 0: no argument after keyword \"server1.example.net\"\r\n",
10084 │     "unreachable": true
10085 │ }

There is an unrequired -o before the hostname. If I downgrade to Version 1.2.0 everything is fine.

Regards - Willi

willifehler commented 1 month ago

My resource and variable:

resource "ansible_playbook" "playbook" {

  for_each = local.ansible_playbook

  playbook   = each.value.ansible_playbook
  name       = each.key
  groups     = each.value.ansible_group_member
  replayable = true
  verbosity  = 3

  extra_vars = {
    ansible_user            = var.ansible_ssh_user
    ansible_ssh_common_args = try(each.value.ansible_ssh_common_args, var.ansible_ssh_common_args)
  }

  #var_files = ["vars.yml"]
  vault_files         = ["vault.yml"]
  vault_password_file = "vault_password"

  timeouts {
    create = "15m"
  }

}
ansible_ssh_common_args      = "'-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no'"