pibase/roles/pi/tasks/main.yml

48 lines
1.6 KiB
YAML

---
- name: Set the hostname
hostname: name="pi-{{hostid}}"
- name: Put the hostname in /etc/hosts
lineinfile: path=/etc/hosts line="127.0.1.1 pi-{{hostid}}"
- name: Add the user {{user}}
user:
name: "{{user}}"
# TODO(michaelh): change to a public password
password: '$6$3/nNUZfJvg9V9$9OkDm4wO25wyuNJq0Iw3Pw15uCmcUoLBkq/8C0HuRR2vRtrcJVXU6VU6k0d9/gSCWkoEBNDAkHAubZ.wrT43H.'
groups: sudo,dialout,video,audio
state: present
- name: Set authorized keys for pi and {{user}}
authorized_key:
user: "{{ item }}"
state: present
# TODO(michaelh): pull the invoking users public key
key: "{{ lookup('file', '/home/michaelh/.ssh/id_rsa.pub') }}"
with_items:
- "{{ user }}"
- pi
- name: Change the default password for pi and {{ user }}
user:
name: "{{ item }}"
# TODO(michaelh): change to a public password
password: '$6$3/nNUZfJvg9V9$9OkDm4wO25wyuNJq0Iw3Pw15uCmcUoLBkq/8C0HuRR2vRtrcJVXU6VU6k0d9/gSCWkoEBNDAkHAubZ.wrT43H.'
with_items:
- pi
- "{{ user }}"
- name: Modify config.txt
lineinfile: path=/boot/config.txt line={{ item }}
with_items:
- "gpu_mem=16"
- "hdmi_mode=1"
- "boot_delay=0"
- "disable_splash=1"
- name: Disable docs and man pages
template: src=01-nodoc dest=/etc/dpkg/dpkg.cfg.d/01-nodoc
- include: i2c.yml
- include: swap.yml
- name: Update the package cache
action: apt update_cache=yes cache_valid_time=3600
- name: Install the basics
apt: name=jed,git,psmisc,unzip,f2fs-tools,python3
- name: Install the dev bits
apt: name=build-essential,man,manpages-posix-dev,ack-grep,screen,f2fs-tools
- include: node_exporter.yml