From a5528dc0fab0760d3113e2502b1a0ac0140378ee Mon Sep 17 00:00:00 2001 From: mpelle426 Date: Wed, 10 Jul 2019 16:10:59 +0100 Subject: [PATCH] -updates for autologin on gui --- ansible.cfg | 1 - roles/common/tasks/main.yaml | 7 +++++++ roles/pi/tasks/main.yaml | 28 +++++++++++++++++++++++++++- 3 files changed, 34 insertions(+), 2 deletions(-) diff --git a/ansible.cfg b/ansible.cfg index cd1d8c0..7eda540 100644 --- a/ansible.cfg +++ b/ansible.cfg @@ -73,7 +73,6 @@ host_key_checking = False # change the default callback, you can only have one 'stdout' type enabled at a time. #stdout_callback = skippy - ## Ansible ships with some plugins that require whitelisting, ## this is done to avoid running all of a type by default. ## These setting lists those that you want enabled for your system. diff --git a/roles/common/tasks/main.yaml b/roles/common/tasks/main.yaml index 987ff46..f3ce38a 100644 --- a/roles/common/tasks/main.yaml +++ b/roles/common/tasks/main.yaml @@ -76,4 +76,11 @@ become: yes - name: set keyboard to us command: raspi-config nonint do_configure_keyboard us +- name: pi + become: yes + user: + name: pi + state: present + update_password: always + password: "$6$Vmob4l5KBg11gcNV$fY.hrffHEc9gpcFhVdEmW7tepxJURBmkgQhC7kC25VsxcfHAtlqEP6Cvm6nK4jtqndkaQ/I29h/MkKk8KsdSV1" diff --git a/roles/pi/tasks/main.yaml b/roles/pi/tasks/main.yaml index ed330c0..4e4126d 100644 --- a/roles/pi/tasks/main.yaml +++ b/roles/pi/tasks/main.yaml @@ -24,4 +24,30 @@ - { regexp: '#framebuffer_width=1280', line: 'framebuffer_width=1280' } - { regexp: '#framebuffer_height=720', line: 'framebuffer_height=1024' } become: true - +- name: enable autologin symlink + become: true + file: + src: /lib/systemd/system/getty@.service + dest: /etc/systemd/system/getty.target.wants/getty@tty1.service + owner: root + group: root + state: link +- name: autologin systemd + become: true + lineinfile: + 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' } +- name: autologin replacement + become: true + lineinfile: + path: /etc/lightdm/lightdm.conf + regexp: '^\(#\|\)autologin-user=.*' + line: 'autologin-user=pi' +- name: force systemd reload + become: true + systemd: + daemon_reload: yes