# Cloud-init, Ansible and VM/Hostname

**URL:** <https://community.learnlinux.tv/t/cloud-init-ansible-and-vm-hostname/3989>\
**Category:** Linux on Servers\
**Created:** [June 16, 2024, 3:53am UTC](https://community.learnlinux.tv/t/cloud-init-ansible-and-vm-hostname/3989 "2024-06-16T03:53:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Witenite](https://community.learnlinux.tv/letter_avatar_proxy/v4/letter/w/4bbf92/32.png) [@Witenite](https://community.learnlinux.tv/u/Witenite)\
**Post date:** [June 16, 2024, 3:53am UTC](https://community.learnlinux.tv/t/cloud-init-ansible-and-vm-hostname/3989/1 "2024-06-16T03:53:21Z")

</div>

With Cloud-Init, Am I able to pass the {name} variable of the VM name to Ansible? I want to use Ansible to make the /etc/hosts file. I have it set as a boot cmd in Cloud-Init now. Any ideas?
