diff options
Diffstat (limited to 'roles/doorputer/tasks')
-rw-r--r-- | roles/doorputer/tasks/bluetooth.yml | 16 | ||||
-rw-r--r-- | roles/doorputer/tasks/lockserver.yml | 69 | ||||
-rw-r--r-- | roles/doorputer/tasks/main.yml | 27 |
3 files changed, 112 insertions, 0 deletions
diff --git a/roles/doorputer/tasks/bluetooth.yml b/roles/doorputer/tasks/bluetooth.yml new file mode 100644 index 0000000..ef64f35 --- /dev/null +++ b/roles/doorputer/tasks/bluetooth.yml @@ -0,0 +1,16 @@ +--- +- name: Disable hciuart service + systemd: + name: hciuart.service + enabled: no + masked: no + state: stopped + +- name: Disable bluetooth service + systemd: + name: bluetooth.service + enabled: no + masked: no + state: stopped + +# vim: set ts=2 sw=2 et: diff --git a/roles/doorputer/tasks/lockserver.yml b/roles/doorputer/tasks/lockserver.yml new file mode 100644 index 0000000..57b9e2b --- /dev/null +++ b/roles/doorputer/tasks/lockserver.yml @@ -0,0 +1,69 @@ +--- +- name: Create doorman user + user: + comment: 'Doorman Doris' + name: doorman + shell: '/bin/bash' + uid: 3000 + group: users + groups: + - dialout + - gpio + +- name: Check out lockserver repo + git: + dest: '~doorman/lockserver' + repo: 'https://github.com/labitat/lockserver.git' + accept_hostkey: yes + clone: yes + update: yes + remote: origin + +- name: Make sure doorman owns git repo + file: + dest: '~doorman/lockserver' + owner: doorman + group: users + recurse: yes + +- name: Initialize database + command: + argv: + - '/usr/bin/sqlite3' + - 'users.db' + - '.read lockserver/structure.sql' + become_user: doorman + args: + chdir: '/home/doorman' + creates: '/home/doorman/users.db' + +- name: Create pasword file + copy: + dest: '~doorman/lockserver.password' + content: "{{ doorputer_webpassword }}\n" + owner: doorman + group: users + mode: 0600 + when: doorputer_webpassword is defined + +- name: Install lockserver service + copy: + dest: '/etc/systemd/system/lockserver.service' + src: lockserver.service + owner: root + group: root + mode: 0644 + register: lockserver_service + +- name: Reload systemd + command: systemctl daemon-reload + when: lockserver_service is changed + +- name: Enable lockserver service + systemd: + name: lockserver.service + enabled: yes + masked: no + state: started + +# vim: set ts=2 sw=2 et: diff --git a/roles/doorputer/tasks/main.yml b/roles/doorputer/tasks/main.yml new file mode 100644 index 0000000..62a693a --- /dev/null +++ b/roles/doorputer/tasks/main.yml @@ -0,0 +1,27 @@ +--- +- name: Install network configuration + copy: + dest: '/etc/systemd/network/10-eth0.network' + src: eth0.network + owner: root + group: root + mode: 0644 + tags: + - networkd-config + +- name: Set message of the day + copy: + dest: '/etc/motd' + src: motd + owner: root + group: root + mode: 0644 + tags: + - motd + +- import_tasks: bluetooth.yml + tags: bluetooth +- import_tasks: lockserver.yml + tags: lockserver + +# vim: set ts=2 sw=2 et: |