From 4283dff9b4e10e16112af4fe904d820c80ff0f50 Mon Sep 17 00:00:00 2001 From: Mark Goddard Date: Mon, 9 Jul 2018 18:55:54 +0100 Subject: [PATCH] Fix ownership of virtualenv in bootstrap-servers In I86bf5e1df3d6568c4f1ca6f4757f08a3dd22754d, creation of the kolla user was moved to after package installation to ensure the sudo package is installed when required. This change does not work when python dependencies are installed in a virtual environment however - when the virtualenv variable is set. This change moves the ownership change of the virtualenv to after the kolla user has been created. It also uses the kolla_user and kolla_group variables to set the user and group appropriately. Change-Id: I320e5d611099ad162945a98d5505a79606da0eba TrivialFix --- ansible/roles/baremetal/tasks/install.yml | 10 ---------- ansible/roles/baremetal/tasks/post-install.yml | 10 ++++++++++ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/ansible/roles/baremetal/tasks/install.yml b/ansible/roles/baremetal/tasks/install.yml index c957fccacb..e8b252e99b 100644 --- a/ansible/roles/baremetal/tasks/install.yml +++ b/ansible/roles/baremetal/tasks/install.yml @@ -88,16 +88,6 @@ virtualenv_site_packages: "{{ virtualenv is none | ternary(omit, virtualenv_site_packages) }}" become: True -- name: Ensure virtualenv has correct ownership - file: - path: "{{ virtualenv }}" - recurse: True - state: directory - owner: kolla - group: kolla - become: True - when: virtualenv is not none - - name: Remove packages package: name: "{{ item }}" diff --git a/ansible/roles/baremetal/tasks/post-install.yml b/ansible/roles/baremetal/tasks/post-install.yml index fa208018bd..b7e516a2de 100644 --- a/ansible/roles/baremetal/tasks/post-install.yml +++ b/ansible/roles/baremetal/tasks/post-install.yml @@ -31,6 +31,16 @@ become: True when: create_kolla_user | bool +- name: Ensure virtualenv has correct ownership + file: + path: "{{ virtualenv }}" + recurse: True + state: directory + owner: "{{ kolla_user }}" + group: "{{ kolla_group }}" + become: True + when: virtualenv is not none + - name: Ensure node_config_directory directory exists for user kolla file: path: "{{ node_config_directory }}"