# Updating /etc/hosts on automation-job pods?

**URL:** <https://forum.ansible.com/t/updating-etc-hosts-on-automation-job-pods/38550>\
**Category:** AWX Project\
**Tags:** awx\
**Created:** [October 26, 2023, 5:58pm UTC](https://forum.ansible.com/t/updating-etc-hosts-on-automation-job-pods/38550 "2023-10-26T17:58:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![russellcecalabp](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/russellcecalabp/32/1544_2.png) [@russellcecalabp](https://forum.ansible.com/u/russellcecalabp)\
**Post date:** [October 26, 2023, 5:58pm UTC](https://forum.ansible.com/t/updating-etc-hosts-on-automation-job-pods/38550/1 "2023-10-26T17:58:31Z")

</div>

Hi,

I recently had to move my K3 cluster runnning AWX-operator. The IP addresses of my nodes had to change from 10.0.3.51, 10.0.3.52, 10.0.3.53 to 10.6.3.44, 10.6.3.45, 10.6.3.71.  
I updated hostAlias in my awx-demo deployment:

271 dnsPolicy: ClusterFirst

272 hostAliases:  
273 - hostnames:  
274 - [awx.bugfocus.com](http://awx.bugfocus.com)  
275 ip: 10.6.3.44  
276 initContainers:  
277 - command:  
278 - /bin/sh  
279 - -c  
280 - |  
281 hostname=$MY\_POD\_NAME  
282 receptor --cert-makereq bits=2048 commonname=$hostname dnsname=$hostname nodeid=$hostname outreq=/etc/receptor/tls/receptor.req outkey=/etc/receptor/tls/receptor.key  
283 receptor --cert-signreq req=/etc/receptor/tls/receptor.req cacert=/etc/receptor/tls/ca/receptor-ca.crt cakey=/etc/receptor/tls/ca/receptor-ca.key outcert=/etc/receptor/tls/ receptor.crt verify=yes

And added these commands to the initContainer value:

cp /etc/hosts /etc/hosts.BU  
grep -v bugfocus /etc/hosts \> /tmp/hosts  
echo “10.6.3.44 awx [awx.bugfocus.com](http://awx.bugfocus.com)” \>\> /tmp/hosts  
cp /tmp/hosts /etc/hosts

But still on my automation-job pods the /etc/hosts file has the old IP address. What can I do to correct the /etc/hosts when my automation-job pods get created?
