layereight.pimatic

ansible-pimatic

An Ansible role to install and set up pimatic – smart home automation software for the Raspberry Pi.

Requirements

  • Raspberry Pi with Raspbian operating system
  • Network access to the Raspberry Pi and SSH enabled
  • A user with sudo permissions

Installing the role via Ansible Galaxy

To install the role, run:

$ ansible-galaxy install layereight.pimatic

If you want to install a specific version alongside other roles using a role file:

$ ansible-galaxy install -r roles.yml

roles.yml

- name: layereight.pimatic
  src: layereight.pimatic
  version: "2.0.1"

See also the Ansible Galaxy documentation and the Ansible Galaxy introduction

Role Variables

Required

  • pimatic_nodejs_arch: This must be set to the hardware architecture for Node.js, usually armv6l (for Pi Model A, B, B+, or Zero) or armv7l (for Pi 2 Model B or Pi 3 Model B).

Optional

  • pimatic_nodejs_version

    • default: "v10.18.1"
    • description: The version of Node.js to install
  • pimatic_app_dir

    • default: "pimatic-app"
    • description: The directory name in the user's home directory where pimatic will be installed. For example, if the user is pi, the installation directory will be /home/pi/pimatic-app.
  • pimatic_port

    • default: 8080
    • description: The port that pimatic's web interface will use. You can set it to 443 if you enable pimatic_ssl.
  • pimatic_config_template

    • default: "config.json.j2"
    • description: The standard configuration that comes with the role. You can provide your own configuration template by changing this variable.
  • pimatic_waitfor_startup

    • default: true
    • description: Whether the role waits for pimatic to start up. Depending on your hardware and configured plugins, this can take up to 1 hour.
  • pimatic_ssl

    • default: false
    • description: Set to true to create self-signed SSL certificates. The role will then provide paths to the generated SSL key and certificate.
  • pimatic_ssl_cn

    • default: "{{ ansible_fqdn }}"
    • description: Common Name in the certificate.
  • pimatic_ssl_c

    • default: "DE"
    • description: Country in the certificate.
  • pimatic_ssl_st

    • default: "Berlin"
    • description: State in the certificate.
  • pimatic_ssl_l

    • default: "Berlin"
    • description: Location in the certificate.
  • pimatic_ssl_o

    • default: "pimatic"
    • description: Organization in the certificate.
  • pimatic_ssl_ou

    • default: "pimatic"
    • description: Organizational Unit in the certificate.

Provided Variables

  • pimatic_ssl_privkey: Provided when pimatic_ssl is set to true. You can use this variable in your configuration template to set up an HTTPS server.

  • pimatic_ssl_cert: Provided when pimatic_ssl is set to true. You can use this variable in your configuration template to set up an HTTPS server.

Example Playbook

To run a typical playbook:

$ ansible-playbook -i inventory pimatic.yml

inventory

[raspberrypi]
pizero ansible_host=192.168.0.101 ansible_user=pi ansible_ssh_pass=raspberry 

pimatic.yml

- hosts: raspberrypi
  
  roles:
    - pimatic
  
  vars:
    pimatic_nodejs_arch: "armv6l"
    pimatic_port: 443
    pimatic_config_template: "pimatic_config.json.j2"
    pimatic_ssl: true
    pimatic_admin_password: "verysecret"

templates/pimatic_config.json.j2

{
  "settings": {
    "httpServer": {
      "enabled": false
    },
    "httpsServer": {
      "enabled": true,
      "port": {{ pimatic_port }},
      "hostname": "",
      "keyFile": "{{ pimatic_ssl_privkey }}",
      "certFile": "{{ pimatic_ssl_cert }}"
    },
    "database": {
    }
  },
  "plugins": [
    {
      "plugin": "cron"
    },
    {
      "plugin": "mobile-frontend"
    }
  ],
  "devices": [],
  "rules": [],
  "pages": [
    {
      "id": "favourite",
      "name": "Favourites",
      "devices": []
    }
  ],
  "groups": [],
  "users": [
    {
      "username": "admin",
      "password": "{{ pimatic_admin_password }}",
      "role": "admin"
    }
  ],
  "roles": [
    {
      "name": "admin",
      "permissions": {
        "pages": "write",
        "rules": "write",
        "variables": "write",
        "messages": "write",
        "events": "write",
        "devices": "write",
        "groups": "write",
        "plugins": "write",
        "updates": "write",
        "database": "write",
        "config": "write",
        "controlDevices": true,
        "restart": true
      }
    }
  ]
}
Informazioni sul progetto

An Ansible role to install and configure pimatic - a smart home automation software for the Raspberry Pi.

Installa
ansible-galaxy install layereight.pimatic
Licenza
Unknown
Download
98
Proprietario