terraform-iac-usecases
terraform-iac-usecases copied to clipboard
remote-exec provisioner error
Hi,
I'd like to thank you for sharing your knowledge to us. God will reward you for that. However, after changing the ami in the terraform-was-ansible-lab directory, I got the following issues: aws_instance.ansible-engine (remote-exec): /tmp/terraform_1955812892.sh: line 2: ansible-playbook: command not found ╷ │ Error: remote-exec provisioner error │ │ with aws_instance.ansible-engine, │ on ansible-engine.tf line 53, in resource "aws_instance" "ansible-engine": │ 53: provisioner "remote-exec" { │ │ error executing "/tmp/terraform_1955812892.sh": Process exited with status 127
How to fix this issues? Would you mind to try with a RHEL ami?
Thank you!
@Bendjou18
Yes, the current code is with Amazon Linux AMI and you are free to change it with other AMI's. Ansible will be installed inside the Ansible Engine node using the userdata script - https://github.com/ginigangadharan/terraform-iac-usecases/blob/master/terraform-aws-ansible-lab/user-data-ansible-engine.sh
If you are using different AMI (RHEL or Fedora) then you may need to adjust the commands accordingly.
I did the adjustment, but it gave me a remote-exec provisioner error in ansible-engine.tf( line 53) and line 2 in ansible-playbook not found, while I change the "ami" in variables.tf and comment out the Amazon AMI Linux... epel line in user-data... Is there any adjustment to do in ansible-engine.tf file also?
@Bendjou18 the current playbook is based on Amazon Linux AMI. so if you are changing it then need to adjust all those items :)
I am updating the playbook to support Fedora, RHEL/CentOS, Ubuntu etc. Expecting to push the change by mid of June