ansible, timezone and JDK8

While one might think that they can change the timezone of a machine with ansible with:

  tasks:
  - name: set /etc/localtime
    timezone:
      name: UTC

with some JDK apps it is not enought, because the JVM looks at /etc/timezone. So you need to update that file too. Maybe in a more cleaner way than:

  - name: set /etc/timezone
    shell: echo UTC > /etc/timezone
    args:
      creates: /etc/timezone

Leave a comment