Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ijanos committed May 13, 2017
0 parents commit 0d7b6e3
Show file tree
Hide file tree
Showing 8 changed files with 163 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.retry

34 changes: 34 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Arch Linux ARM Raspberry Pi 3 - ansible playbook


Follow the
[official installation instructions](https://archlinuxarm.org/platforms/armv8/broadcom/raspberry-pi-3).

Python is required on the target host by Ansible so you have to install that.

```
pacman -S python
```

Check if ansible can reach the pi:

```
ansible all -i 192.168.1.256, -m ping --ask-pass -u alarm
```

Run the playbook.

```
ansible-playbook playbook.yml -i 192.168.1.256, --ask-pass -u alarm --ask-become-pass --become-method=su
```

The default user is `alarm` the password is `alarm` and the become password is
`root`.


After running the playbook successfully remove the alarm user and change the root password and create a password for the newly created user:

```
# passwd USERNAME
```

90 changes: 90 additions & 0 deletions playbook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
---
- hosts: all
become: true
vars:
gpumem: 160
hostname: mono
timezone: Europe/Budapest
username: ijanos

tasks:
- name: Set hostname
hostname:
name={{ hostname }}

- name: Setup locale.gen
template:
src: locale.gen.j2
dest: /etc/locale.gen
notify: locale-regen

- name: Setup locale.conf
template:
src: locale.conf.j2
dest: /etc/locale.conf

- name: Setup boot config
template:
src: config.txt.j2
dest: /boot/config.txt

- name: Set the timezone
file:
src: /usr/share/zoneinfo/{{ timezone }}
dest: /etc/localtime
state: link

- name: Set up memory-only journal logging
template:
src: journald.conf.j2
dest: /etc/systemd/journald.conf

- name: Upgrade the system
pacman:
update_cache: yes
upgrade: yes


- name: Install packages
pacman: name={{ item }}
with_items:
- vim
- mc
- bash-completion
- htop
- tmux
- base-devel
- avahi
- nss-mdns
- wget

- name: enable mDNS
template:
src: nsswitch.conf.j2
dest: /etc/nsswitch.conf

- name: Enable avahi service
service:
name: avahi-daemon
enabled: yes
state: started

- name: Add normal user
user:
name: "{{ username }}"
group: users
groups: wheel
append: yes
createhome: yes

- name: Allow wheel group to have sudo rights
lineinfile:
dest: /etc/sudoers
state: present
regexp: '^%wheel'
line: '%wheel ALL=(ALL) ALL'
validate: visudo -cf %s

handlers:
- name: locale-regen
command: locale-gen
11 changes: 11 additions & 0 deletions templates/config.txt.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# See /boot/overlays/README for all available options

gpu_mem={{ gpumem }}
disable_overscan=1
enable_uart=0
force_turbo=0
hdmi_ignore_cec_init=1
disable_splash=1
force_hdmi_open=1

initramfs initramfs-linux.img followkernel
4 changes: 4 additions & 0 deletions templates/journald.conf.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[Journal]
Storage=volatile
Compress=yes
RuntimeMaxUse=40M
1 change: 1 addition & 0 deletions templates/locale.conf.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
LANG=en_US.UTF-8
2 changes: 2 additions & 0 deletions templates/locale.gen.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
en_US.UTF-8 UTF-8
hu_HU.UTF-8 UTF-8
19 changes: 19 additions & 0 deletions templates/nsswitch.conf.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Begin /etc/nsswitch.conf

passwd: compat mymachines systemd
group: compat mymachines systemd
shadow: compat

publickey: files

hosts: files mdns_minimal [NOTFOUND=return] dns myhostname wins
networks: files

protocols: files
services: files
ethers: files
rpc: files

netgroup: files

# End /etc/nsswitch.conf

0 comments on commit 0d7b6e3

Please sign in to comment.