-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folder creation for volumes (containers) (#55)
* Added folder creation for volumes (containers, not pods) First it checks if the folder already exists and if it does, it won't adjust any permissions. This helps if podman can't manage the permissions correctly. It allows for changing the owner and group in case it is needed to set a specific UID and GID. It also allows to change the mode. I added explanations for :U as well, which tells podman to change the permissions to the container user recuresively. This works if the service inside the container doesn't run with a different user than the container.
- Loading branch information
Showing
3 changed files
with
36 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- | ||
- name: Check if {{ item }} is existing | ||
become: yes | ||
ansible.builtin.stat: | ||
path: "{{ item }}" | ||
register: _container_folder | ||
|
||
- name: Create directory {{ item }} and set permissions | ||
become: yes | ||
ansible.builtin.file: | ||
path: "{{ item }}" | ||
owner: "{{ container_dir_owner|default(container_run_as_user) }}" | ||
group: "{{ container_dir_group|default(container_run_as_group) }}" | ||
mode: '{{ container_dir_mode|default(omit) }}' | ||
state: directory | ||
when: not (_container_folder.stat.isdir is defined and _container_folder.stat.isdir) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters