diff options
Diffstat (limited to 'roles/doorputer')
-rw-r--r-- | roles/doorputer/files/lockserver.service | 2 | ||||
-rw-r--r-- | roles/doorputer/tasks/lockserver.yml | 21 | ||||
-rw-r--r-- | roles/doorputer/vars/main.yml | 5 |
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: |