mirror of
https://github.com/proffalken/ansible-openhab
synced 2026-01-11 23:08:47 +01:00
Initial import of the role after tidying it up
This commit is contained in:
41
tasks/debian.yml
Normal file
41
tasks/debian.yml
Normal file
@@ -0,0 +1,41 @@
|
||||
---
|
||||
# Debian specfic tasks for OpenHAB
|
||||
- name: Add APT Key
|
||||
apt_key:
|
||||
url: "https://bintray.com/user/downloadSubjectPublicKey?username=openhab"
|
||||
state: present
|
||||
|
||||
- name: Add the APT Repo
|
||||
apt_repository:
|
||||
repo: "deb http://dl.bintray.com/openhab/apt-repo stable main"
|
||||
state: present
|
||||
|
||||
- name: Install OpenHAB
|
||||
apt:
|
||||
name: openhab-runtime
|
||||
state: present
|
||||
update_cache: yes
|
||||
|
||||
- name: Install OpenHAB Actions
|
||||
apt:
|
||||
name: "openhab-addon-action-{{ item.key }}"
|
||||
state: present
|
||||
update_cache: yes
|
||||
with_dict: "{{ openhab_actions }}"
|
||||
ignore_errors: True
|
||||
|
||||
- name: Install OpenHAB Bindings
|
||||
apt:
|
||||
name: "openhab-addon-binding-{{ item.key }}"
|
||||
state: present
|
||||
update_cache: yes
|
||||
with_dict: "{{ openhab_bindings }}"
|
||||
ignore_errors: True
|
||||
|
||||
- name: Install OpenHAB Persistence
|
||||
apt:
|
||||
name: "openhab-addon-persistence-{{ item.key }}"
|
||||
state: present
|
||||
update_cache: yes
|
||||
with_dict: "{{ openhab_persistence }}"
|
||||
ignore_errors: True
|
||||
59
tasks/main.yml
Normal file
59
tasks/main.yml
Normal file
@@ -0,0 +1,59 @@
|
||||
---
|
||||
# tasks file for openhab
|
||||
# include the distro-specific stuff
|
||||
- name: Include the Debian config
|
||||
include: debian.yml
|
||||
when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu'
|
||||
|
||||
- name: Use the variables to build out the configuration file
|
||||
template:
|
||||
src: openhab.cfg.j2
|
||||
dest: /etc/openhab/configurations/openhab.cfg
|
||||
owner: openhab
|
||||
group: openhab
|
||||
|
||||
- name: Copy in the items files
|
||||
copy:
|
||||
src: "{{ item }}"
|
||||
dest: "/etc/openhab/configurations/items/"
|
||||
owner: openhab
|
||||
group: openhab
|
||||
mode: 0644
|
||||
with_fileglob:
|
||||
- items/*
|
||||
|
||||
- name: Copy in the Sitemaps
|
||||
copy:
|
||||
src: "{{ item }}"
|
||||
dest: "/etc/openhab/configurations/sitemaps/"
|
||||
owner: openhab
|
||||
group: openhab
|
||||
mode: 0644
|
||||
with_fileglob:
|
||||
- sitemaps/*
|
||||
|
||||
- name: Copy in the Persistence Config
|
||||
copy:
|
||||
src: "{{ item }}"
|
||||
dest: "/etc/openhab/configurations/persistence/"
|
||||
owner: openhab
|
||||
group: openhab
|
||||
mode: 0644
|
||||
with_fileglob:
|
||||
- persistence/*
|
||||
|
||||
- name: Copy in the Rules
|
||||
copy:
|
||||
src: "{{ item }}"
|
||||
dest: "/etc/openhab/configurations/rules/"
|
||||
owner: openhab
|
||||
group: openhab
|
||||
mode: 0644
|
||||
with_fileglob:
|
||||
- rules/*
|
||||
|
||||
- name: Enable and start the OpenHAB service
|
||||
service:
|
||||
name: openhab
|
||||
state: running
|
||||
enabled: True
|
||||
1
tasks/rhel.yml
Normal file
1
tasks/rhel.yml
Normal file
@@ -0,0 +1 @@
|
||||
---
|
||||
Reference in New Issue
Block a user