You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1.0 KiB

- hosts: attitude-adjuster
become: yes
vars_files:
- vars.yml.private
tasks:
- name: change hostname to {{ ansible_hostname }}
hostname:
name: "{{ ansible_hostname }}"
notify: reboot
- name: update hostname in /etc/hosts
replace:
path: /etc/hosts
regexp: '(\s+)raspberrypi(\s+.*)?$'
replace: '\{{ ansible_hostname }}\2'
notify: reboot
- name: disable wifi
lineinfile:
path: /boot/config.txt
insertafter: dtoverlay
line: dtoverlay=pi3-disable-wifi
notify: reboot
- name: create user
user:
name: alpha
password: "{{ password | password_hash('sha512') }}"
shell: /bin/bash
- name: give user sudo access
lineinfile:
path: /etc/sudoers.d/alpha
line: "alpha ALL=(ALL) NOPASSWD: ALL"
create: yes
validate: visudo -cf %s
- name: add ssh keys
authorized_key:
user: alpha
key: https://github.com/kejadlen.keys
handlers:
- name: reboot
reboot: