---
-
  name: "Stopping pkg server"
  become: true
  ansible.builtin.service: 
    name: "pkg/server:{{ pkg_server.omnios_release }}_{{ pkg_server.archive }}"
    state: stopped
    enabled: false
-
  name: "Downloading packages from source"
  become: true
  ansible.builtin.command: "pfexec pkgrecv -s {{ pkg_server.repo_url }}/{{ pkg_server.omnios_release }}/{{ pkg_server.archive }}/ -d file:///{{ storage_disk.path }}/{{ pkg_server.omnios_release }}/pkg/ --clone -p *"

-
  name: "Recreating package repository caches"
  become: true
  ansible.builtin.command: "pfexec pkgrepo rebuild -s /{{ storage_disk.path }}/{{ pkg_server.omnios_release }}/pkg/"

-
  name: "Starting pkg server"
  become: true
  ansible.builtin.service: 
    name: "pkg/server:{{ pkg_server.omnios_release }}_{{ pkg_server.archive }}"
    state: started
    enabled: true

