---

- name: Setup silent login for user odoo
  file:
    path: /home/odoo/.hushlogin
    state: touch
    mode: 0644
    owner: odoo

- name: Create openbox config dir
  file:
    path: /home/odoo/.config/openbox
    state: directory
    owner: odoo
    mode: 0755

- name: Setup openbox autostart for user odoo
  template:
    src: autostart.j2
    dest: /home/odoo/.config/openbox/autostart
    mode: 0644
    owner: odoo

- name: Start graphical screen when user logs in
  copy:
    src: bash_profile
    dest: /home/odoo/.bash_profile
    mode: 0644
    owner: odoo

- name: Create autostart config dir
  file:
    path: /etc/systemd/system/getty@tty1.service.d
    state: directory
    owner: root
    mode: 0755

- name: Login user odoo when system starts
  copy:
    src: tty_unit
    dest: /etc/systemd/system/getty@tty1.service.d/override.conf
    mode: 0644
    owner: root

- name: Restart the login service
  systemd:
    daemon_reload: yes
    name: getty@tty1
    state: restarted

