Get current hostname and push it into conf file with ansible
serverfault.com › questions › 760832Mar 02, 2016 · Show activity on this post. I'm working into an ansible playbook to get the current hostname of a server and then set it into a configuration file. I cannot figure it out how can I push the shell output using the lineinfile module. - name: Get hostname shell: echo $HOSTNAME register: result - name: Set hostname on conf file lineinfile: dest=/etc/teste/linux/zabbix_agentd.conf regexp="^Hostname=.*" insertafter="^# Hostname=" line=Hostname=????