--- - name: Install taskd hosts: raspberry gather_facts: false tasks: # Installation - name: Install build tools apt: pkg: - gcc - make - cmake - gnutls-dev - uuid-dev - name: Create user become: true user: name: taskd - name: Add public key to authorized_keys become: true authorized_key: user: taskd state: present key: "{{ lookup('file', '~/.ssh/id_rsa.pub') }}" - name: Build taskd from source remote_user: taskd shell: | cd /tmp git clone --recursive https://github.com/GothenburgBitFactory/taskserver.git cd taskserver cmake -DCMAKE_BUILD_TYPE=release . make - name: Install taskd become: true shell: | cd /tmp/taskserver make install # Configuration - name: Setup initial config remote_user: taskd environment: TASKDDATA: /home/taskd/data shell: | mkdir -p ~/data/orgs taskd init taskd config server taskd.eug-vs.xyz:53589 - name: Push vars for generating keys remote_user: taskd copy: src: ./files/taskd/vars dest: /tmp/taskserver/pki - name: Generate keys & certificates remote_user: taskd environment: TASKDDATA: /home/taskd/data shell: | cd /tmp/taskserver/pki ./generate cp server.*.pem ~/data cp ca.cert.pem ~/data taskd config --force server.cert ~/data/server.cert.pem taskd config --force server.key ~/data/server.key.pem taskd config --force server.crl ~/data/server.crl.pem taskd config --force ca.cert ~/data/ca.cert.pem - name: Add hostname become: true shell: echo "192.168.0.131 taskd.eug-vs.xyz" >> /etc/hosts - name: Create systemd unit become: true copy: src: ./files/taskd/taskd.service dest: /etc/systemd/system - name: Enable and start the service become: true systemd: name: taskd state: restarted