Skip to content

Commit

Permalink
Compatible with the ansible version shipped on the Pi
Browse files Browse the repository at this point in the history
Little shell script errors
  • Loading branch information
ke4roh committed Oct 26, 2020
1 parent 7a2334b commit c882c0f
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
hosts
calendar-install-*.run
package
makeself-2.4.2*
playbook.retry
rpi-calendar
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ makeself-$(MAKESELF_VER)/makeself.sh:
rm makeself-$(MAKESELF_VER).run

calendar-install-$(CALENDAR_VER).run: makeself-$(MAKESELF_VER)/makeself.sh install.sh hosts-localhost playbook.yml $(wildcard roles/**/*)
mkdir -p package
cp -r hosts-localhost install.sh roles playbook.yml package/.
mkdir -p rpi-calendar
cp -r hosts-localhost install.sh roles playbook.yml rpi-calendar/.
# makeself.sh [args] archive_dir file_name label startup_script [script_args]
makeself-$(MAKESELF_VER)/makeself.sh package calendar-install-$(CALENDAR_VER).run "Installing setup scripts" install.sh
makeself-$(MAKESELF_VER)/makeself.sh --notemp rpi-calendar calendar-install-$(CALENDAR_VER).run "Installing setup scripts" ./install.sh


.PHONY: clean package release

clean:
rm -rf package calendar-install-*.run
rm -rf rpi-calendar calendar-install-*.run

package: calendar-install-$(CALENDAR_VER).run

Expand Down
6 changes: 3 additions & 3 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function makeFileWithMode {

# check ssh is turned on
sudo systemctl status ssh | grep -q "Active: active" || sudo systemctl start ssh
sudo systemctl status ssh | grep Loaded: | grep -q enabled || sudo systemctl enable ssh
sudo systemctl status ssh | grep Loaded: | grep -q "ssh.service; enabled" || sudo systemctl enable ssh

# check ssh keygen ran for pi
[[ -f /home/pi/.ssh/id_rsa ]] || (echo -e "\n\n\n" | ssh-keygen 2>&1 >/dev/null)
Expand All @@ -21,9 +21,9 @@ grep -q "$(cat /home/pi/.ssh/id_rsa.pub)" $ak || (cat /home/pi/.ssh/id_rsa.pub >
# check pi has the localhost known_host
kh="/home/pi/.ssh/known_hosts"
makeFileWithMode $kh 600
grep -q localhost $kh | ssh-keyscan localhost >>$kh
grep -q localhost $kh || ssh-keyscan localhost >>$kh

# install Ansible if necessary
sudo dpkg -s ansible 2>&1 >/dev/null || sudo apt-get install ansible
sudo dpkg -s ansible 2>&1 >/dev/null || sudo apt-get install -y ansible

ansible-playbook playbook.yml -i hosts-localhost -u pi
6 changes: 3 additions & 3 deletions roles/calendar/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

- name: Load the uinput module so we can fake keystrokes
lineinfile:
path: /etc/modules
dest: /etc/modules
create: true
line: "uinput"

Expand Down Expand Up @@ -91,13 +91,13 @@

- name: Remove default screensaver config
lineinfile:
path: /etc/xdg/lxsession/LXDE-pi/autostart
dest: /etc/xdg/lxsession/LXDE-pi/autostart
state: absent
line: "@xscreensaver -no-splash"

- name: Turn off screensaver in LXDE autostart
blockinfile:
path: /etc/xdg/lxsession/LXDE-pi/autostart
dest: /etc/xdg/lxsession/LXDE-pi/autostart
create: true
owner: pi
block: |
Expand Down
7 changes: 5 additions & 2 deletions roles/common/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
---
- name: Install Aptitude for package management
package:
name: aptitude
state: latest

- name: Update apt repo and cache on all Debian/Ubuntu boxes
apt:
update_cache=yes
force_apt_get=yes
cache_valid_time=3600

- name: Upgrade all packages on servers
apt:
upgrade=dist
force_apt_get=yes

- name: Check if a reboot is needed on all servers
register: reboot_required_file
Expand Down

0 comments on commit c882c0f

Please sign in to comment.