aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmil Renner Berthing <esmil@labitat.dk>2019-07-09 17:03:31 +0200
committerEmil Renner Berthing <esmil@labitat.dk>2019-07-09 17:03:31 +0200
commitf83816c4549368e4dfa2c2b7556726ecaef10164 (patch)
treebf2f2840817c693a0b2141265cbe6125bf4476f3
parent18629c52f8d3d411cc52208e74bfbfc5862996d4 (diff)
downloadlabitat-ansible-f83816c4549368e4dfa2c2b7556726ecaef10164.tar.gz
labitat-ansible-f83816c4549368e4dfa2c2b7556726ecaef10164.tar.xz
labitat-ansible-f83816c4549368e4dfa2c2b7556726ecaef10164.zip
doorputer: lockserver: handle updated lockserver
-rw-r--r--roles/doorputer/files/lockserver.service2
-rw-r--r--roles/doorputer/tasks/lockserver.yml21
-rw-r--r--roles/doorputer/vars/main.yml5
3 files changed, 22 insertions, 6 deletions
diff --git a/roles/doorputer/files/lockserver.service b/roles/doorputer/files/lockserver.service
index a09666d..03f4e2d 100644
--- a/roles/doorputer/files/lockserver.service
+++ b/roles/doorputer/files/lockserver.service
@@ -6,7 +6,7 @@ Type=simple
User=doorman
WorkingDirectory=/home/doorman
ExecStartPre=/home/doorman/lockserver/init.sh
-ExecStart=/home/doorman/lockserver/lockd.py
+ExecStart=/home/doorman/lockserver/lockserver
StandardOutput=syslog
StandardError=inherit
Restart=on-failure
diff --git a/roles/doorputer/tasks/lockserver.yml b/roles/doorputer/tasks/lockserver.yml
index 57b9e2b..033e80d 100644
--- a/roles/doorputer/tasks/lockserver.yml
+++ b/roles/doorputer/tasks/lockserver.yml
@@ -37,14 +37,25 @@
chdir: '/home/doorman'
creates: '/home/doorman/users.db'
-- name: Create pasword file
- copy:
- dest: '~doorman/lockserver.password'
- content: "{{ doorputer_webpassword }}\n"
+- name: Make sure ~doorman/.config exists
+ file:
+ dest: '~doorman/.config'
+ state: directory
+ owner: doorman
+ group: users
+ mode: 0700
+
+- name: Create lockserver.ini
+ ini_file:
+ path: '~doorman/.config/lockserver.ini'
+ section: "{{ item.key.split('.',1)[0] }}"
+ option: "{{ item.key.split('.',1)[1] }}"
+ value: "{{ item.value|ternary(item.value,omit) }}"
+ state: "{{ item.value|ternary('present','absent') }}"
owner: doorman
group: users
mode: 0600
- when: doorputer_webpassword is defined
+ with_dict: '{{ lockserver_conf }}'
- name: Install lockserver service
copy:
diff --git a/roles/doorputer/vars/main.yml b/roles/doorputer/vars/main.yml
index f07df60..e2fb021 100644
--- a/roles/doorputer/vars/main.yml
+++ b/roles/doorputer/vars/main.yml
@@ -24,4 +24,9 @@ apt_packages:
'python3-serial': present
'sqlite3': present
+lockserver_conf:
+ 'Database.Path': '/home/doorman/users.db'
+ 'Serial.Device': '/dev/ttyUSB0'
+ 'Daymode.GPIONumber': '2'
+
# vim: set ts=2 sw=2 et: