From 27bfff295471f6dd79019301be0cad6f98695886 Mon Sep 17 00:00:00 2001 From: Felipe Reyes Date: Fri, 9 Feb 2024 12:15:33 -0300 Subject: [PATCH] Create ~/.local/share/juju directory before running juju The juju snap when installed in strict confirment (>=3.0) can't create the directory ~/.local/share/ due to the restriction in the AppArmor profile, machines used by Zuul don't have that directory available by default. This change adds a new task before installing juju to create the needed directories. The ansible module ansible.builtin.file creates intermediary directories (if missing). --- playbooks/juju/pre.yaml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/playbooks/juju/pre.yaml b/playbooks/juju/pre.yaml index 91e8a97..93101fe 100644 --- a/playbooks/juju/pre.yaml +++ b/playbooks/juju/pre.yaml @@ -5,6 +5,17 @@ src: "/home/ubuntu/{{ zuul.project.src_dir }}/" dest: "/home/ubuntu/{{ zuul.project.src_dir | replace('charm-', '') }}" remote_src: yes + # NOTE(freyes): fixes the error below when running `juju` in a fresh + # environment. + # ERROR cannot create juju home directory: mkdir /home/ubuntu/.local/share: permission denied + # WARNING Installing Juju in a strictly confined Snap. To ensure correct operation, create the ~/.local/share/juju directory manually. + - name: Create ~/.local/share/juju directory to run Juju snap in strict mode + ansible.builtin.file: + path: /home/ubuntu/.local/share/juju + state: directory + owner: ubuntu + group: ubuntu + mode: '0700' - name: 'install crashdump' become: true snap: