Skip to content

Commit

Permalink
Merge pull request #466 from gibizer/libvirt-user
Browse files Browse the repository at this point in the history
[edpm_libvirt]Add libvirt user to the EDPM host
  • Loading branch information
openshift-ci[bot] authored Oct 24, 2023
2 parents 69e44dd + 1f57c7d commit 7ffa1aa
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
14 changes: 14 additions & 0 deletions roles/edpm_libvirt/molecule/default/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,17 @@
- { "name": "edpm_libvirt.target", "enabled": "static"}
- { "name": "edpm_libvirt_guests.service", "running":false }
- { "name": "virt-guest-shutdown.target", "enabled": "static", "running":false }

- name: Check if user exists
ansible.builtin.getent:
database: passwd
key: libvirt
register: libvirt_user

- name: Assert that libvirt user is created with kolla uid and gid
ansible.builtin.assert:
that:
# user
- "libvirt_user.ansible_facts.getent_passwd.libvirt[1] == '42473'"
# group
- "libvirt_user.ansible_facts.getent_passwd.libvirt[2] == '42473'"
3 changes: 3 additions & 0 deletions roles/edpm_libvirt/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
# License for the specific language governing permissions and limitations
# under the License.

- name: Ensure libvirt user
ansible.builtin.include_tasks: user.yml

- name: Configure libvirt
ansible.builtin.include_tasks: configure.yml

Expand Down
11 changes: 11 additions & 0 deletions roles/edpm_libvirt/tasks/user.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
- name: Configure libvirt user and group on the host
ansible.builtin.import_role:
name: edpm_users
vars:
edpm_users_users:
# 42473 is matching with the uid and gid created by kolla in the libvirt containers
- {"name": "libvirt", "uid": "42473", "gid": "42473", "shell": "/sbin/nologin", "comment": "libvirt user"}
edpm_users_extra_dirs: []
tags:
- edpm_users

0 comments on commit 7ffa1aa

Please sign in to comment.