From e576055a4fb243428d3b1e15624ce8c2943ef224 Mon Sep 17 00:00:00 2001 From: mpelle426 Date: Wed, 10 Jul 2019 18:15:08 +0100 Subject: [PATCH] -more autologin fixes --- roles/pi/tasks/main.yaml | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/roles/pi/tasks/main.yaml b/roles/pi/tasks/main.yaml index 4e4126d..a0759b9 100644 --- a/roles/pi/tasks/main.yaml +++ b/roles/pi/tasks/main.yaml @@ -34,19 +34,16 @@ state: link - name: autologin systemd become: true - lineinfile: + blockinfile: path: /etc/systemd/system/getty@tty1.service.d/autologin.conf - line: {{ item.line }} - with_items: - - { '[Service]' } - - { 'ExecStart=' } - - { 'ExecStart=-/sbin/agetty --autologin pi --noclear %I \$TERM' } + create: yes + block: | + [Service] + ExecStart= + ExecStart=-/sbin/agetty --autologin pi --noclear %I \$TERM - name: autologin replacement become: true - lineinfile: - path: /etc/lightdm/lightdm.conf - regexp: '^\(#\|\)autologin-user=.*' - line: 'autologin-user=pi' + command: '/bin/sed /etc/lightdm/lightdm.conf -i -e "s/^\(#\|\)autologin-user=.*/autologin-user=pi/"' - name: force systemd reload become: true systemd: