Ensure $HOME dir exists and has the right owner/group

This changes adds an additional task to make sure the
output of the useradd module is consistent when the
HOME dir for a given user is created.
In particular this tasks ensure the HOME dir has the
right owner/group associated to the user that has been
created.

Closes-Bug: #1917856
Change-Id: I64846594123b9d5f333082b3f7714186713caffb
This commit is contained in:
Francesco Pantano 2021-03-04 10:30:52 +01:00
parent abdcbbac44
commit 7e67d35c3d
No known key found for this signature in database
GPG Key ID: 0458D4D1F41BD75C
2 changed files with 10 additions and 0 deletions

View File

@ -78,6 +78,7 @@
state: directory
mode: "0700"
owner: "{{ ansible_user }}"
group: "{{ ansible_user }}"
become: true
- name: Ensure ssh key pair

View File

@ -27,6 +27,15 @@
{{ tripleo_admin_user }} ALL=(ALL) NOPASSWD:ALL
mode: 0440
# workaround for https://bugs.launchpad.net/tripleo/+bug/1917856
- name: ensure home dir has the right owner/group for user {{ tripleo_admin_user }}
file:
path: /home/{{ tripleo_admin_user }}
state: directory
owner: '{{ tripleo_admin_user }}'
group: '{{ tripleo_admin_user }}'
mode: 0700
- name: ensure .ssh dir exists for user {{ tripleo_admin_user }}
file:
path: /home/{{ tripleo_admin_user }}/.ssh