|
|
- - hosts: default
- debugger: on_failed
- vars:
- unifi_software_url: https://dl.ubnt.com/unifi/5.10.21/UniFi.unix.zip
- tasks:
- - replace:
- path: /etc/apk/repositories
- regexp: '^#(.*v\d+.\d+/community.*)$'
- replace: '\1'
- - apk:
- name: openjdk8-jre
- state: present
- update_cache: yes
- - apk:
- name: '{{item}}'
- state: present
- loop:
- - shadow
- - mongodb
- - s6
- - unzip
- - user:
- name: unifi
- home: /srv/unifi
- - get_url:
- url: '{{unifi_software_url}}'
- dest: /tmp/UniFi.unix.zip
- - command: unzip /tmp/UniFi.unix.zip
- args:
- chdir: /tmp
- warn: false
- - shell: mv /tmp/UniFi/* /srv/unifi
- - command: rm /srv/unifi/bin/mongod
- - file:
- path: /srv/unifi
- owner: unifi
- mode: o-rwx
- recurse: yes
- - file:
- dest: /srv/unifi/bin/mongod
- src: /usr/bin/mongod
- state: link
- - file:
- path: /etc/unifi/log
- state: directory
- - template:
- src: templates/unifi/run
- dest: /etc/unifi/run
- mode: 755
- - template:
- src: templates/unifi/log/run
- dest: /etc/unifi/log/run
- mode: 755
- - user:
- name: log
- home: /var/log
- - file:
- path: /var/log/unifi
- state: directory
- owner: log
- mode: 750
- - template:
- src: templates/init.d/unifi
- dest: /etc/init.d/unifi
- mode: 755
- - service:
- name: unifi
- state: started
- enabled: yes
|