Configure hosts file: file.managed: - name: /etc/hosts - source: salt://hosts/files/hosts.jinja - template: jinja - user: root - group: root - mode: "0644" Configure hostname file: file.managed: - name: /etc/hostname - source: salt://hosts/files/hostname.jinja - template: jinja - user: root - group: root - mode: "0644" Run hostname command: cmd.run: - name: hostname {{ pillar['network']['hostname'] }} - onchanges: - file: Configure hosts file - file: Configure hostname file