From aa10a99caa39b52fba5e571bdb977ccffb96e29c Mon Sep 17 00:00:00 2001 From: Pig Monkey Date: Sun, 5 Feb 2017 18:56:36 -0800 Subject: [PATCH] add wttr script I've had this in ~/bin for a year or so. Might as well keep it here. --- playbook.yml | 1 + roles/wttr/files/wttr.sh | 3 +++ roles/wttr/tasks/main.yml | 3 +++ 3 files changed, 7 insertions(+) create mode 100755 roles/wttr/files/wttr.sh create mode 100644 roles/wttr/tasks/main.yml diff --git a/playbook.yml b/playbook.yml index afec78f..0277a64 100644 --- a/playbook.yml +++ b/playbook.yml @@ -64,6 +64,7 @@ - { role: localtime, tags: ['localtime'], when: "localtime is defined" } - { role: wormhole, tags: ['wormhole'] } - { role: bluetooth, tags: ['bluetooth'], when: "bluetooth is defined" } + - { role: wttr, tags: ['wttr'] } vars_prompt: - name: user_password prompt: "Enter desired user password" diff --git a/roles/wttr/files/wttr.sh b/roles/wttr/files/wttr.sh new file mode 100755 index 0000000..98f1582 --- /dev/null +++ b/roles/wttr/files/wttr.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +curl wttr.in/"${1:-$(curl http://ip-api.com/json | jq 'if (.zip | length) != 0 then .zip else .city end')}" diff --git a/roles/wttr/tasks/main.yml b/roles/wttr/tasks/main.yml new file mode 100644 index 0000000..dcd7d43 --- /dev/null +++ b/roles/wttr/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- name: Push wttr script + copy: src=wttr.sh dest=/usr/local/bin/wttr mode=0755