How would I indicate to the machine what kubernetes installation it needs to use? For clarity, I'm using these roles: https://github.com/geerlingguy/ansible-role-kubernetes#two-or-more-nodes-single-master-cluster
On Wednesday, September 18, 2019 at 12:17:30 AM UTC-7, Rickard von Essen wrote: > > Try to remove the inventory_file option > > On Wed, Sep 18, 2019, 07:20 Kevin Galkov <[email protected] <javascript:>> > wrote: > >> Hi #packer! >> >> I am trying to learn more about Packer and Ansible. I think those too >> along with Terraform, Bazel and jsonnet will be great to use! >> >> With packer I am able to pass in a playbook.yml and an inventory file to >> Ansible. However, I would like to be able to specify to ansible what host >> it is currently running on, so it knows what section of the inventory file >> to utilize. >> >> I tried the `host_alias` parameter, but I then ended up with: >> >> amazon-ebs: fatal: [master_host]: UNREACHABLE! => {"changed": false, >> "msg": "Failed to connect to the host via ssh: ssh: Could not resolve >> hostname master_host: nodename nor servname provided, or not known", >> "unreachable": true} >> >> Any ideas on what is the best way to tell Ansible what machine it is >> provisioning through Packer? >> >> Thank you! >> >> Kevin >> >> [provision.yml file:::] >> --- >> >> - hosts: all >> >> vars: >> kubernetes_allow_pods_on_master: true >> >> roles: >> - geerlingguy.docker >> - geerlingguy.kubernetes >> >> [inventory_master file:::] >> [master] >> master_host >> >> [master:vars] >> kubernetes_role=master >> >> [node] >> node_host1 >> node_host2 >> >> [node:vars] >> kubernetes_role=node >> >> [example.json file:::] >> { >> "variables": { >> "aws_access_key": "", >> "aws_secret_key": "" >> }, >> "builders": [{ >> "type": "amazon-ebs", >> "access_key": "{{user `aws_access_key`}}", >> "secret_key": "{{user `aws_secret_key`}}", >> "region": "us-east-1", >> "source_ami_filter": { >> "filters": { >> "virtualization-type": "hvm", >> "name": "ubuntu/images/*ubuntu-xenial-16.04-amd64-server-*", >> "root-device-type": "ebs" >> }, >> "owners": ["099720109477"], >> "most_recent": true >> }, >> "instance_type": "t2.micro", >> "ssh_username": "ubuntu", >> "ami_name": "packer-example {{timestamp}}" >> }], >> "provisioners": [{ >> "type": "ansible", >> "user": "root", >> "playbook_file": "/Users/kevin/pdev/tgkj/corp/dev/provision.yml", >> "inventory_file": >> "/Users/kevin/pdev/tgkj/corp/dev/inventory_master.yml", >> "host_alias": "master_host" >> }, { >> "type": "shell", >> "inline": [ >> "echo Thanks to https://alex.dzyoba.com/blog/packer-for-docker/ >> and make sure to use jsonnet to properly share the configuration." >> ] >> } >> ] >> } >> >> -- >> This mailing list is governed under the HashiCorp Community Guidelines - >> https://www.hashicorp.com/community-guidelines.html. Behavior in >> violation of those guidelines may result in your removal from this mailing >> list. >> >> GitHub Issues: https://github.com/mitchellh/packer/issues >> IRC: #packer-tool on Freenode >> --- >> You received this message because you are subscribed to the Google Groups >> "Packer" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/packer-tool/0a2dffd5-e0f2-4927-bde9-af089c4ecd55%40googlegroups.com >> >> <https://groups.google.com/d/msgid/packer-tool/0a2dffd5-e0f2-4927-bde9-af089c4ecd55%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list. GitHub Issues: https://github.com/mitchellh/packer/issues IRC: #packer-tool on Freenode --- You received this message because you are subscribed to the Google Groups "Packer" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/ad4ad6fd-80a5-4cd8-9170-dcd1d31e4bb7%40googlegroups.com.
