forked from twobitcircus/rpi-build-and-boot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplaybook.yml
executable file
·87 lines (73 loc) · 6.75 KB
/
playbook.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
---
- hosts: localhost
remote_user: vagrant
vars:
image: 2016-05-27-raspbian-jessie-lite.img
offset_boot: 4194304
offset_root: 70254592
tasks:
- apt: upgrade=dist update_cache=yes
- file: path=/opt/raspberrypi state=directory
- apt: name=nfs-kernel-server
- lineinfile: dest=/etc/exports line="/opt/raspberrypi/root 192.168.0.0/16(rw,sync,no_root_squash,no_subtree_check)"
- lineinfile: dest=/etc/cron.d/opt_raspberrypi_root line="* * * * * root /bin/mount /opt/raspberrypi/root" create=yes
- service: name=nfs-kernel-server state=restarted
- apt: name=build-essential
- apt: name=pkg-config
- apt: name=git
- apt: name=python-pip
- apt: name=python-dev
- apt: name=unzip
- apt: name=gawk
- apt: name=libudev-dev
- apt: name=sshpass
- pip: name=ansible
- pip: name=paramiko
- pip: name=PyYAML
- pip: name=jinja2
- pip: name=httplib2
- apt: name=tinyproxy
- lineinfile: dest="/etc/tinyproxy.conf" line="Allow 192.168.0.0/16"
- service: name=tinyproxy state=restarted
- file: path=/opt/raspberrypi/boot state=directory
- file: path=/opt/raspberrypi/root state=directory
- mount: src="/vagrant/{{image}}" name="/opt/raspberrypi/boot" fstype="auto" opts="loop,offset={{offset_boot}},noauto" state="mounted"
- mount: src="/vagrant/{{image}}" name="/opt/raspberrypi/root" fstype="auto" opts="loop,offset={{offset_root}},noauto" state="mounted"
- lineinfile: dest=/etc/rc.local line="mount /opt/raspberrypi/root" insertbefore="exit 0"
- lineinfile: dest=/etc/rc.local line="mount /opt/raspberrypi/boot" insertbefore="exit 0"
# the rpi is unbootable unless it is told not to mount the root filesystem from the card!. also added dns to cmdline.txt and iptables filter.
- lineinfile: dest=/opt/raspberrypi/root/etc/fstab regexp="^\/dev\/mmcblk0p2" state="absent"
- replace: dest=/opt/raspberrypi/boot/cmdline.txt regexp="rootwait$" replace="dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 elevator=deadline root=/dev/nfs rootfstype=nfs nfsroot=192.168.178.250:/opt/raspberrypi/root,udp,vers=3 rw fsck.repair=no rootwait ip=192.168.178.201:::::eth0:off smsc95xx.turbo_mode=N" backup=no
# build helpies
- file: path=/opt/RPI_BUILD_ROOT state=directory
- file: src=/opt/raspberrypi/root/etc dest=/opt/RPI_BUILD_ROOT/etc state=link
- file: src=/opt/raspberrypi/root/lib dest=/opt/RPI_BUILD_ROOT/lib state=link
- file: src=/opt/raspberrypi/root/opt dest=/opt/RPI_BUILD_ROOT/opt state=link
- command: rsync -avz /opt/raspberrypi/root/usr/ /opt/RPI_BUILD_ROOT/usr
- file: src=/opt/raspberrypi/root/lib/arm-linux-gnueabihf/libanl.so.1 dest=/opt/raspberrypi/root/usr/lib/arm-linux-gnueabihf/libanl.so state=link
- file: src=/opt/raspberrypi/root/lib/arm-linux-gnueabihf/libBrokenLocale.so.1 dest=/opt/raspberrypi/root/usr/lib/arm-linux-gnueabihf/libBrokenLocale.so state=link
- file: src=/opt/raspberrypi/root/lib/arm-linux-gnueabihf/libcidn.so.1 dest=/opt/raspberrypi/root/usr/lib/arm-linux-gnueabihf/libcidn.so state=link
- file: src=/opt/raspberrypi/root/lib/arm-linux-gnueabihf/libcrypt.so.1 dest=/opt/raspberrypi/root/usr/lib/arm-linux-gnueabihf/libcrypt.so state=link
- file: src=/opt/raspberrypi/root/lib/arm-linux-gnueabihf/libdbus-1.so.3.8.13 dest=/opt/raspberrypi/root/usr/lib/arm-linux-gnueabihf/libdbus-1.so state=link
- file: src=/opt/raspberrypi/root/lib/arm-linux-gnueabihf/libdl.so.2 dest=/opt/raspberrypi/root/usr/lib/arm-linux-gnueabihf/libdl.so state=link
- file: src=/opt/raspberrypi/root/lib/arm-linux-gnueabihf/libexpat.so.1.6.0 dest=/opt/raspberrypi/root/usr/lib/arm-linux-gnueabihf/libexpat.so state=link
- file: src=/opt/raspberrypi/root/lib/arm-linux-gnueabihf/libglib-2.0.so.0 dest=/opt/raspberrypi/root/usr/lib/arm-linux-gnueabihf/libglib-2.0.so state=link
- file: src=/opt/raspberrypi/root/lib/arm-linux-gnueabihf/liblzma.so.5.0.0 dest=/opt/raspberrypi/root/usr/lib/arm-linux-gnueabihf/liblzma.so state=link
- file: src=/opt/raspberrypi/root/lib/arm-linux-gnueabihf/libm.so.6 dest=/opt/raspberrypi/root/usr/lib/arm-linux-gnueabihf/libm.so state=link
- file: src=/opt/raspberrypi/root/lib/arm-linux-gnueabihf/libnsl.so.1 dest=/opt/raspberrypi/root/usr/lib/arm-linux-gnueabihf/libnsl.so state=link
- file: src=/opt/raspberrypi/root/lib/arm-linux-gnueabihf/libnss_compat.so.2 dest=/opt/raspberrypi/root/usr/lib/arm-linux-gnueabihf/libnss_compat.so state=link
- file: src=/opt/raspberrypi/root/lib/arm-linux-gnueabihf/libnss_dns.so.2 dest=/opt/raspberrypi/root/usr/lib/arm-linux-gnueabihf/libnss_dns.so state=link
- file: src=/opt/raspberrypi/root/lib/arm-linux-gnueabihf/libnss_files.so.2 dest=/opt/raspberrypi/root/usr/lib/arm-linux-gnueabihf/libnss_files.so state=link
- file: src=/opt/raspberrypi/root/lib/arm-linux-gnueabihf/libnss_hesiod.so.2 dest=/opt/raspberrypi/root/usr/lib/arm-linux-gnueabihf/libnss_hesiod.so state=link
- file: src=/opt/raspberrypi/root/lib/arm-linux-gnueabihf/libnss_nisplus.so.2 dest=/opt/raspberrypi/root/usr/lib/arm-linux-gnueabihf/libnss_nisplus.so state=link
- file: src=/opt/raspberrypi/root/lib/arm-linux-gnueabihf/libnss_nis.so.2 dest=/opt/raspberrypi/root/usr/lib/arm-linux-gnueabihf/libnss_nis.so state=link
- file: src=/opt/raspberrypi/root/lib/arm-linux-gnueabihf/libpcre.so.3 dest=/opt/raspberrypi/root/usr/lib/arm-linux-gnueabihf/libpcre.so state=link
- file: src=/opt/raspberrypi/root/lib/arm-linux-gnueabihf/libpng12.so.0 dest=/opt/raspberrypi/root/usr/lib/arm-linux-gnueabihf/libpng12.so.0 state=link
- file: src=/opt/raspberrypi/root/lib/arm-linux-gnueabihf/libresolv.so.2 dest=/opt/raspberrypi/root/usr/lib/arm-linux-gnueabihf/libresolv.so state=link
- file: src=/opt/raspberrypi/root/lib/arm-linux-gnueabihf/libthread_db.so.1 dest=/opt/raspberrypi/root/usr/lib/arm-linux-gnueabihf/libthread_db.so state=link
- file: src=/opt/raspberrypi/root/lib/arm-linux-gnueabihf/libusb-0.1.so.4 dest=/opt/raspberrypi/root/usr/lib/arm-linux-gnueabihf/libusb-0.1.so.4 state=link
- file: src=/opt/raspberrypi/root/lib/arm-linux-gnueabihf/libusb-1.0.so.0.1.0 dest=/opt/raspberrypi/root/usr/lib/arm-linux-gnueabihf/libusb-1.0.so state=link
- file: src=/opt/raspberrypi/root/lib/arm-linux-gnueabihf/libutil.so.1 dest=/opt/raspberrypi/root/usr/lib/arm-linux-gnueabihf/libutil.so state=link
- file: src=/opt/raspberrypi/root/lib/arm-linux-gnueabihf/libz.so.1.2.8 dest=/opt/raspberrypi/root/usr/lib/arm-linux-gnueabihf/libz.so state=link
- file: src=/opt/raspberrypi/root/lib/arm-linux-gnueabihf/libudev.so.1.5.0 dest=/opt/raspberrypi/root/usr/lib/arm-linux-gnueabihf/libudev.so state=link
handlers: