Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save wsaribeiro/44416fb865ccd8d9e1ad8f618b63ac7a to your computer and use it in GitHub Desktop.

Select an option

Save wsaribeiro/44416fb865ccd8d9e1ad8f618b63ac7a to your computer and use it in GitHub Desktop.

Revisions

  1. @jerm jerm revised this gist Jun 3, 2014. No changes.
  2. @jerm jerm revised this gist Jun 3, 2014. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions gistfile1.yml
    Original file line number Diff line number Diff line change
    @@ -12,9 +12,9 @@

    tasks:
    - name: check current timezone
    shell: bash -c "[[ $(TZ='America/New_York' date | awk '{print $5}') == $(date | awk '{print $5}') ]]"
    shell: cat /etc/timezone
    register: current_zone
    - debug: msg="{{current_zone}}"

    - name: Set timezone variables
    copy: content={{my_zone}}
    dest=/etc/timezone
  3. @jerm jerm revised this gist Jun 3, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.yml
    Original file line number Diff line number Diff line change
    @@ -12,7 +12,7 @@

    tasks:
    - name: check current timezone
    shell: "[[ $(TZ='America/New_York' date | awk '{print $5}') == $(date | awk '{print $5}') ]]"
    shell: bash -c "[[ $(TZ='America/New_York' date | awk '{print $5}') == $(date | awk '{print $5}') ]]"
    register: current_zone
    - debug: msg="{{current_zone}}"
    - name: Set timezone variables
  4. @jerm jerm created this gist Jun 3, 2014.
    30 changes: 30 additions & 0 deletions gistfile1.yml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,30 @@
    ---
    - name: Group by Distribution
    hosts: all
    tasks:
    - group_by: key={{ansible_distribution}}

    - name: Set Time Zone
    hosts: Ubuntu
    gather_facts: False
    vars:
    - my_zone: 'America/New_York'

    tasks:
    - name: check current timezone
    shell: "[[ $(TZ='America/New_York' date | awk '{print $5}') == $(date | awk '{print $5}') ]]"
    register: current_zone
    - debug: msg="{{current_zone}}"
    - name: Set timezone variables
    copy: content={{my_zone}}
    dest=/etc/timezone
    owner=root
    group=root
    mode=0644
    backup=yes
    when: current_zone.stdout != my_zone
    notify:
    - update timezone
    handlers:
    - name: update timezone
    command: dpkg-reconfigure --frontend noninteractive tzdata