---
ipfs-group:
  group.present:
    - name: ipfs
    - gid: 899

ipfs-user:
  user.present:
    - name: ipfs
    - uid: 899
    - gid: 899
    - home: /var/lib/ipfs
    - allow_uid_change: true
    - allow_gid_change: true

ipfs-dir:
  file.directory:
    - name: /var/lib/ipfs
    - user: ipfs
    - group: ipfs
    - mode: 0750
    - recurse:
      - user

ipfs-init:
  cmd.run:
    - name: /usr/local/sbin/ipfs init
    - runas: ipfs
    - cwd: /var/lib/ipfs
    - success_retcodes:
      - 0
      - 1
    - watch-in:
      - service: ipfs-service