---
- name: install i3lock
  apt:
    name: "i3lock"
    state: present

- name: install lock script
  copy:
    src: lock
    dest: /usr/local/bin/lock
    mode: 0755

- name: copy lock systemd service
  copy:
    src: lock.service
    dest: /lib/systemd/system/lock.service

- name: enable lock systemd service
  service:
    name: lock
    enabled: true

- name: susped at lid close when docked
  ini_file:
    path: /etc/systemd/logind.conf
    section: Login
    option: HandleLidSwitchDocked
    value: suspend
