nbering / terraform-provider-ansible

"Logical" provider for integrating with an Ansible Dynamic Inventory script.
https://nbering.github.io/terraform-provider-ansible/
Mozilla Public License 2.0
329 stars 64 forks source link

provider.ansible: Unrecognized remote plugin message: 2|unix|/tmp/tf-plugin164979924 #14

Closed Eimert closed 5 years ago

Eimert commented 5 years ago

Hi,

I'm facing the following error message:

eimert@EIM terraform-gce $ terraform plan

Error: Error asking for user input: 1 error(s) occurred:

* provider.ansible: Unrecognized remote plugin message: 2|unix|/tmp/tf-plugin164979924

This usually means that the plugin is either invalid or simply
needs to be recompiled to support the latest protocol.

provider is installed:

eimert@EIM terraform-gce $ terraform providers
.
├── provider.ansible
├── provider.google
├── module.google-dns-managed-zone
│   └── provider.google (inherited)
└── module.powerzone
    └── provider.google (inherited)

Using terrafom ansible plugin release v0.0.4:

-rwxr-xr-x 1 eimert eimert 26528047 apr 20  2018 /home/eimert/terraform.d/plugins/terraform-provider-ansible_v0.0.4

And the latest terraform (atm):

eimert@EIM terraform-gce $ terraform --version
Terraform v0.11.9
+ provider.ansible (unversioned)
+ provider.google v1.19.1

Then I compiled the master branch, still the same error message.

-rwxr-xr-x 1 eimert eimert 24407556 okt 21 11:18 /home/eimert/terraform.d/plugins/terraform-provider-ansible

/home/eimert/terraform.d/plugins/
└── terraform-provider-ansible

The main.tf:

provider "google" {
  credentials = "${file("king-of-my-google-cloud-castle.json")}"
  project     = "smashing-dash-1992"
}

module "google-dns-managed-zone" {
  # source          = "github.com/Eimert/terraform-google-dns-managed-zone"
  source          = "./modules/terraform-google-dns-managed-zone"

  dns_name        = "clouder-zone"
  dns_zone        = "clouder.eimertvink.nl."
}

module "powerzone" {
  # source          = "git::https://github.com/Eimert/terraform-google-compute-engine-instance?ref=ansible-provisioner"
  source          = "./modules/terraform-google-compute-engine-instance"

  amount          = 1
  region          = "europe-west4"
  zone            = "europe-west4-c"
  name_prefix     = "wild-gixxer"
  machine_type    = "custom-2-4096"
  disk_type       = "pd-ssd"
  disk_size       = "15"
  disk_image       = "centos-cloud/centos-7"

  dns_name        = "${module.google-dns-managed-zone.dns_name}"
  dns_zone        = "${module.google-dns-managed-zone.dns_zone}"
  dns_record_name = "pww-dev"

  user_data       = "firestone-lab"
  username        = "eimert"
  public_key_path = "~/.ssh/id_rsa.pub"
}

resource "ansible_host" "example" {
  inventory_hostname = "${module.powerzone.addresses}"
  playbook = "play.yml"
  vars {
    ansible_user = "${module.powerzone.username}"
  }
}

AFAIK the /tmp file is not readable:

eimert@EIM terraform-gce $ less /tmp/tf-plugin394044065
/tmp/tf-plugin394044065 is not a regular file (use -f to see it)
eimert@EIM terraform-gce $ less -f /tmp/tf-plugin394044065
/tmp/tf-plugin394044065: Apparaat of adres bestaat niet
eimert@EIM terraform-gce $ stat /tmp/tf-plugin394044065
  Bestand: '/tmp/tf-plugin394044065'
  Grootte: 0            Blokken: 0            IO-blok: 4096   socket
Apparaat: fc01h/64513d   Inode: 18492238     Koppelingen: 1
Toegang: (0755/srwxr-xr-x)   UID: ( 1000/  eimert)   GID: ( 1000/  eimert)
Toegang:   2018-10-21 11:23:43.958402135 +0200
Gewijzigd: 2018-10-21 11:23:43.958402135 +0200
Veranderd: 2018-10-21 11:23:43.958402135 +0200
Ontstaan:  -

Text is partly in Dutch, apologies!

Any thoughts on getting the ansible provisioner to work? I can provide more details if necessary.

nbering commented 5 years ago

Looks like this plugin needs to be recompiled against v0.11.9. I originally developed it against v0.9.x and v0.10.x... looks like they made a breaking change to the plugin protocol that requires a library update. I'll get a new build up in the next couple days.

nbering commented 5 years ago

I've not been able to replicate this, and no one else has piped up to say it was an issue... so I'm going to close this out. We'll be getting some new builds soon for the 0.12 release anyway.