From 13fb6f0db4a6299ac4e75b2f73911d011caa88e9 Mon Sep 17 00:00:00 2001 From: Pig Monkey Date: Sat, 3 Sep 2016 17:26:39 -0700 Subject: [PATCH] autoset timezone via localtime If you happen to have a VPN in a different timezone that is set as a trusted network, things may get a little weird. --- group_vars/all | 3 +++ playbook.yml | 1 + roles/localtime/tasks/main.yml | 25 +++++++++++++++++++++++++ 3 files changed, 29 insertions(+) create mode 100644 roles/localtime/tasks/main.yml diff --git a/group_vars/all b/group_vars/all index 44be395..b77d100 100644 --- a/group_vars/all +++ b/group_vars/all @@ -111,3 +111,6 @@ fingerprint: False tor: run_on: trusted + +localtime: + run_on: trusted diff --git a/playbook.yml b/playbook.yml index 8b74779..fcd3740 100644 --- a/playbook.yml +++ b/playbook.yml @@ -58,6 +58,7 @@ - { role: calibre, tags: ['calibre'] } - { role: aws, tags: ['aws'] } - { role: parcimonie, tags: ['parcimonie'], when: "tor is defined" } + - { role: localtime, tags: ['localtime'], when: "localtime is defined" } vars_prompt: - name: user_password prompt: "Enter desired user password" diff --git a/roles/localtime/tasks/main.yml b/roles/localtime/tasks/main.yml new file mode 100644 index 0000000..64e7389 --- /dev/null +++ b/roles/localtime/tasks/main.yml @@ -0,0 +1,25 @@ +--- +- name: Install localtime + aur: name=localtime-git user={{ user.name }} + tags: + - aur + +- name: Enable and start localtime + service: name=localtime enabled=yes state=started + when: localtime.run_on == "all" + +- name: Remove localtime from trusted unit list + lineinfile: dest=/usr/local/etc/trusted_units + state=absent + line=localtime.service + when: localtime.run_on == "all" + +- name: Disable localtime + service: name=localtime enabled=no + when: localtime.run_on == "trusted" + +- name: Add localtime to trusted unit list + lineinfile: dest=/usr/local/etc/trusted_units + state=present + line=localtime.service + when: localtime.run_on == "trusted"