# How to configure Execution Environment container hostname

**URL:** <https://forum.ansible.com/t/how-to-configure-execution-environment-container-hostname/43030>\
**Category:** Get Help\
**Tags:** aap, awx, ee\
**Created:** [May 27, 2025, 2:17pm UTC](https://forum.ansible.com/t/how-to-configure-execution-environment-container-hostname/43030 "2025-05-27T14:17:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![bmohanraj](https://avatars.discourse-cdn.com/v4/letter/b/b487fb/32.png) [@bmohanraj](https://forum.ansible.com/u/bmohanraj)\
**Post date:** [May 27, 2025, 2:17pm UTC](https://forum.ansible.com/t/how-to-configure-execution-environment-container-hostname/43030/1 "2025-05-27T14:17:16Z")

</div>

**I am trying to setup custom hostname to execution environment container**.

- I have checked the execution environment definition file documentation but cannot find an option on how to setup hostname.
- The playbooks that I have will copy files based on the hostname, as the AWX/AAP runs the jobs in container, it fails to copy as hostname is not the expected one.
- so it would be helpful, if EE definition file already allows setting hostname.

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [May 27, 2025, 2:34pm UTC](https://forum.ansible.com/t/how-to-configure-execution-environment-container-hostname/43030/2 "2025-05-27T14:34:36Z")

</div>

Container hostnames can only be set at runtime, they cannot be configured during build.

---

<div class="post-metadata">

**Author:** ![bmohanraj](https://avatars.discourse-cdn.com/v4/letter/b/b487fb/32.png) [@bmohanraj](https://forum.ansible.com/u/bmohanraj)\
**Post date:** [May 27, 2025, 2:39pm UTC](https://forum.ansible.com/t/how-to-configure-execution-environment-container-hostname/43030/3 "2025-05-27T14:39:15Z")

</div>

Thanks sivel, is there any documentation available that I refer for setting hostname at runtime.

---

<div class="post-metadata">

**Author:** ![anon81884396](https://avatars.discourse-cdn.com/v4/letter/a/b782af/32.png) [@anon81884396](https://forum.ansible.com/u/anon81884396)\
**Post date:** [May 27, 2025, 5:46pm UTC](https://forum.ansible.com/t/how-to-configure-execution-environment-container-hostname/43030/4 "2025-05-27T17:46:03Z")

</div>

It may be a good idea to post your Ansible job YAML file here so people may be able to suggest a better approach. Containers are ephemeral and them having a random hostname is part of being ephemeral. There are ways to make a container’s hostname be more consistent, but managing this will introduce complexities that might be best to avoid.

You could set some kind of static variable inside your playbook instead of relying on the hostname to trigger whatever logic is dependent upon it, for instance. It’s hard to say unless you can provide context as to your use-case.

---

<div class="post-metadata">

**Author:** ![bmohanraj](https://avatars.discourse-cdn.com/v4/letter/b/b487fb/32.png) [@bmohanraj](https://forum.ansible.com/u/bmohanraj)\
**Post date:** [July 11, 2025, 3:26pm UTC](https://forum.ansible.com/t/how-to-configure-execution-environment-container-hostname/43030/5 "2025-07-11T15:26:03Z")

</div>

Apologies, yes I had to take setting static variable route, thanks.
