Skip to content

Commit

Permalink
Create ~/.local/share/juju directory before running juju
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
freyes committed Feb 9, 2024
1 parent eb05cf5 commit 27bfff2
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions playbooks/juju/pre.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 27bfff2

Please sign in to comment.