Skip to content

Commit

Permalink
Merge pull request #713 from jpodivin/ownership-fallback
Browse files Browse the repository at this point in the history
Setting default ownership on file/dir creation
  • Loading branch information
openshift-merge-bot[bot] authored Jul 29, 2024
2 parents 9a2cec3 + 7d42f65 commit 25aef28
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
path: "{{ edpm_derive_pci_device_spec_conf_dir }}"
setype: "container_file_t"
state: directory
owner: "{{ ansible_user }}"
group: "{{ ansible_user }}"
owner: "{{ ansible_user | default(ansible_user_id) }}"
group: "{{ ansible_user | default(ansible_user_id) }}"
mode: "0755"

- name: Check if edpm node has the sriov nova conf
Expand Down
4 changes: 2 additions & 2 deletions roles/edpm_extra_mounts/tasks/extra_mounts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
ansible.builtin.file:
path: "{{ item.path }}"
state: directory
owner: "{{ item.owner | default(omit) }}"
group: "{{ item.group | default(omit) }}"
owner: "{{ item.owner | default(ansible_user) | default(ansible_user_id) }}"
group: "{{ item.group | default(ansible_user) | default(ansible_user_id) }}"
mode: "{{ item.mode | default('0775') }}"
loop: "{{ edpm_default_mounts }}"
tags:
Expand Down
9 changes: 4 additions & 5 deletions roles/edpm_libvirt/tasks/configure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
path: "{{ item.path }}"
state: directory
setype: "{{ item.setype | default('container_file_t') }}"
owner: "{{ item.owner | default(ansible_user) }}"
group: "{{ item.group | default(ansible_user) }}"
owner: "{{ item.owner | default(ansible_user) | default(ansible_user_id) }}"
group: "{{ item.group | default(ansible_user) | default(ansible_user_id) }}"
mode: "{{ item.mode | default(omit) }}"
loop:
- {"path": "/etc/tmpfiles.d/", "owner": "root", "group": "root"}
Expand All @@ -36,9 +36,8 @@
src: "{{ item.src }}"
dest: "/etc/{{ item.dest }}"
mode: "{{ item.mode | default('0640') }}"
# FIXME: update to libvirt user/group
owner: "root"
group: "root"
owner: "{{ 'libvirt' | default(ansible_user) | default(ansible_user_id) }}"
group: "{{ 'libvirt' | default(ansible_user) | default(ansible_user_id) }}"
loop:
- {"src": "virtlogd.conf", "dest": "libvirt/virtlogd.conf"}
- {"src": "virtnodedevd.conf", "dest": "libvirt/virtnodedevd.conf"}
Expand Down
4 changes: 2 additions & 2 deletions roles/edpm_neutron_sriov/tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
path: "{{ item.path }}"
setype: "container_file_t"
state: directory
owner: "{{ item.owner | default(omit) }}"
group: "{{ item.group | default(omit) }}"
owner: "{{ item.owner | default(ansible_user) | default(ansible_user_id) }}"
group: "{{ item.group | default(ansible_user) | default(ansible_user_id) }}"
mode: "{{ item.mode | default(omit) }}"
loop:
- {'path': "/var/lib/openstack/config/containers", "mode": "0755", "owner": "{{ ansible_user }}", "group": "{{ ansible_user }}"}
Expand Down
8 changes: 4 additions & 4 deletions roles/edpm_nova/tasks/configure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@
path: "{{ item.path }}"
state: "directory"
setype: "container_file_t"
owner: "{{ item.owner | default(ansible_user) }}"
group: "{{ item.group | default(ansible_user) }}"
owner: "{{ item.owner | default(ansible_user) | default(ansible_user_id) }}"
group: "{{ item.group | default(ansible_user) | default(ansible_user_id) }}"
mode: "{{ item.mode | default(omit) }}"
loop:
- {"path": "{{ edpm_nova_config_dest }}", "mode": "0755"}
Expand All @@ -87,8 +87,8 @@
path: "{{ item.path }}"
setype: "container_file_t"
state: "directory"
owner: "{{ item.owner | default(omit) }}"
group: "{{ item.group | default(omit) }}"
owner: "{{ item.owner | default(ansible_user) | default(ansible_user_id) }}"
group: "{{ item.group | default(ansible_user) | default(ansible_user_id) }}"
mode: "{{ item.mode | default(omit) }}"
loop:
- {"path": "/var/lib/nova", "mode": "0755"}
Expand Down
8 changes: 4 additions & 4 deletions roles/edpm_swift/tasks/configure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
path: "{{ item.path }}"
state: "directory"
setype: "container_file_t"
owner: "{{ item.owner | default(ansible_user) }}"
group: "{{ item.group | default(ansible_user) }}"
owner: "{{ item.owner | default(ansible_user) | default(ansible_user_id) }}"
group: "{{ item.group | default(ansible_user) | default(ansible_user_id) }}"
mode: "{{ item.mode | default(omit) }}"
loop:
- {"path": "{{ edpm_swift_config_dest }}", "mode": "0755"}
Expand All @@ -49,8 +49,8 @@
path: "{{ item.path }}"
state: "directory"
setype: "container_file_t"
owner: "{{ item.owner | default(ansible_user) }}"
group: "{{ item.group | default(ansible_user) }}"
owner: "{{ item.owner | default(ansible_user) | default(ansible_user_id) }}"
group: "{{ item.group | default(ansible_user) | default(ansible_user_id) }}"
mode: "{{ item.mode | default(omit) }}"
loop:
- {"path": "/srv/node", "mode": "0750", "owner": "swift", "group": "swift"}
Expand Down
4 changes: 2 additions & 2 deletions roles/edpm_users/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
ansible.builtin.file:
path: "{{ item.path }}"
state: directory
owner: "{{ item.owner | default(omit) }}"
group: "{{ item.group | default(omit) }}"
owner: "{{ item.owner | default(ansible_user) | default(ansible_user_id) }}"
group: "{{ item.group | default(ansible_user) | default(ansible_user_id) }}"
setype: "{{ item.setype | default(omit) }}"
seuser: "{{ item.seuser | default(omit) }}"
mode: "{{ item.mode | default(omit) }}"
Expand Down

0 comments on commit 25aef28

Please sign in to comment.