cloudposse / terraform-null-ansible

Terraform Module to run ansible playbooks

Home Page:https://cloudposse.com/accelerate

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to specify hosts file?

mabushey opened this issue · comments

  • module.ansible_provisioner.null_resource.provisioner: Error running command 'ansible-playbook --user=ubuntu -e host=54.219.165.55 interview_devops_playbook.yml': exit status 4. Output: [WARNING]: provided hosts list is empty, only localhost is available. Note
    that the implicit localhost does not match 'all'

there is no inventory file being passed.... :(
How can I specify the hosts file? I would like -i ./hosts added to the command string. Terraform is awesome, but when the code is in a module it gets cached and becomes difficult to modify.

I guess it's dynamic and does not write to an inventory file. The raw install python is not idempotent so I figured it just wasn't working.

  • In the raw command, the changed does not work. Use this:
register: output
changed_when: output.stdout != ""
  • Inventory is spelled wrong: Create a runtime inventorty with an ip address of a host
  • Github is now owned by a patent troll, consider migrating to a service like Gitlab.

You should also create a group_vars/all file so people can specify the correct pem to use:

$ cat group_vars/all                                                                                                                                                                                                                             
ansible_ssh_private_key_file: ~/.ssh/my_key