2016-06-14 20:24:23 +00:00
|
|
|
---
|
|
|
|
# tasks file for unifi_controller_rhel
|
|
|
|
|
|
|
|
- name: abort if os is not suitable
|
|
|
|
when: ansible_os_family != "RedHat"
|
2016-06-14 23:17:13 +00:00
|
|
|
fail: msg="{{ansible_os_family}} is not supported by this playbook"
|
|
|
|
|
|
|
|
- name: create mongo repository
|
|
|
|
template: src=mongodb-org-3.2.repo.j2 dest=/etc/yum.repos.d/mongodb-org-3.2.repo owner=root group=root
|
2016-06-14 20:24:23 +00:00
|
|
|
|
|
|
|
- name: install java and mongodb
|
|
|
|
when: ansible_os_family == "RedHat"
|
|
|
|
yum: name={{ item }} state=present
|
|
|
|
with_items:
|
|
|
|
- java-1.6.0-openjdk
|
|
|
|
- jakarta-commons-daemon-jsvc
|
2016-06-14 23:17:13 +00:00
|
|
|
- mongodb-org
|
2016-06-14 20:24:23 +00:00
|
|
|
|
|
|
|
- name: no need for the standard mongod service
|
|
|
|
service: name=mongod enabled=no state=stopped
|
|
|
|
|
|
|
|
- name: setup unifi group
|
2016-06-14 23:17:13 +00:00
|
|
|
group: name={{ unifi_controller_rhel_unifi_gid }} system=yes state=present
|
2016-06-14 20:24:23 +00:00
|
|
|
|
|
|
|
- name: setup unifi user
|
2016-06-14 23:17:13 +00:00
|
|
|
user: name={{ unifi_controller_rhel_unifi_uid }} home={{ unifi_controller_rhel_unifi_prefix }}/UniFi createhome=no shell=/sbin/nologin system=yes state=present
|
2016-06-14 20:24:23 +00:00
|
|
|
|
|
|
|
- name: copy unifi zipball to host
|
2016-06-14 23:17:13 +00:00
|
|
|
copy: src={{ unifi_controller_rhel_unifi_zip_file }} dest={{ unifi_controller_rhel_unifi_zip_dest }} force=no
|
2016-06-14 20:24:23 +00:00
|
|
|
|
|
|
|
- name: extract unifi
|
2016-06-14 23:17:13 +00:00
|
|
|
command: /usr/bin/unzip -o {{ unifi_controller_rhel_unifi_zip_dest }} -d {{ unifi_controller_rhel_unifi_prefix }} creates={{ unifi_controller_rhel_unifi_prefix }}/UniFi
|
|
|
|
|
|
|
|
- name: create unifi data directory
|
|
|
|
file: dest={{ unifi_controller_rhel_unifi_prefix }}/UniFi/data state=directory
|
2016-06-14 20:24:23 +00:00
|
|
|
|
|
|
|
- name: fix permissions
|
2016-06-14 23:17:13 +00:00
|
|
|
command: /bin/chown -R {{ unifi_controller_rhel_unifi_uid }}:{{ unifi_controller_rhel_unifi_gid }} {{ unifi_controller_rhel_unifi_prefix }}/UniFi
|
2016-06-14 20:24:23 +00:00
|
|
|
|
|
|
|
- name: symlink mongod binary to where unifi path
|
2016-06-14 23:17:13 +00:00
|
|
|
file: src=/usr/bin/mongod dest={{ unifi_controller_rhel_unifi_prefix }}/UniFi/bin/mongod state=link
|
2016-06-14 20:24:23 +00:00
|
|
|
|
|
|
|
- name: install custom config.properties
|
2016-06-14 23:17:13 +00:00
|
|
|
template: src=config.properties.j2 dest={{ unifi_controller_rhel_unifi_prefix }}/UniFi/data/config.properties owner={{ unifi_controller_rhel_unifi_uid }} group={{ unifi_controller_rhel_unifi_gid }}
|
2016-06-14 20:24:23 +00:00
|
|
|
|
|
|
|
- name: install init script
|
2016-06-14 23:17:13 +00:00
|
|
|
template: src=unifi.init.j2 dest=/etc/init.d/UniFi owner=root group=root mode=755
|
2016-06-14 20:24:23 +00:00
|
|
|
|
|
|
|
- name: start unifi service
|
2016-06-14 23:17:13 +00:00
|
|
|
service: name=UniFi enabled=yes state=started
|