ansibleofflinesnapcraft

how could I install a snap package via Ansible on an air-gapped system


Installing snap packages via Ansible on systems that are connected to internet is rather simple. EG:

  - name: Install microk8s
    become: yes
    snap:
      name: microk8s
      classic: yes
      channel: "{{ microk8s_version }}"

Now I would need to do the same on a set of nodes that are air-gapped (no direct connection to internet). I can do a 'snap download' for the required packages, and move them to the target machine(s). But then how to do this in Ansible? Is there any support for this? Or do I have to use the shell/command module ?

thx


Solution

  • I have not tested this, but this method works with other modules.

      - name: install microk8s, file on local disk
        become: yes
        snap:
          name: /path/to/file