From 83da8c3845c5d6caf6084432cfe40c318afab999 Mon Sep 17 00:00:00 2001 From: olli Date: Wed, 28 Sep 2022 14:32:21 +0200 Subject: [PATCH] /usr/local/sbin/raspi-wifi-country.sh --- raspberry.yml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/raspberry.yml b/raspberry.yml index 558d30b..898d2ae 100644 --- a/raspberry.yml +++ b/raspberry.yml @@ -14,3 +14,32 @@ name: pi state: absent remove: yes + + - name: /usr/local/sbin/raspi-wifi-country.sh + blockinfile: + path: /usr/local/sbin/raspi-wifi-country.sh + create: yes + mode: 0500 + owner: root + group: root + marker: "# {mark} ANSIBLE MANAGED BLOCK" + block: | + [ -e /var/log/raspi-wifi-country.log ] exit 0 + raspi-config nonint do_wifi_country DE + echo "$(date) $$" >> /var/log/raspi-wifi-country.log + backup: yes + validate: /bin/bash -n %s + notify: run genpw.sh + + - name: /usr/local/sbin/raspi-wifi-country.sh shebang + lineinfile: + path: /usr/local/sbin/raspi-wifi-country.sh + insertbefore: BOF + line: "#!/bin/bash -e" + + - name: Gen initial passwords if not exists + ansible.builtin.shell: ./raspi-wifi-country.sh + args: + chdir: /usr/local/sbin + creates: /var/log/raspi-wifi-country.log + \ No newline at end of file