From f4133798f65d61430bc4ae8a83000302411d5331 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Sat, 19 Mar 2016 16:28:09 -0700 Subject: [PATCH] openqa/server: make geekotest static UID/GID optional I'm still kinda trying to make the openqa roles usable outside of infra, so now I have a minute, let's do this: it makes the static UID/GID for geekotest optional and configurable, instead of hard coding it. For infra we set the value to 601, as we are already using, in the openqa and openqa-stg group config. --- inventory/group_vars/openqa | 2 ++ inventory/group_vars/openqa-stg | 2 ++ roles/openqa/server/tasks/main.yml | 17 +++++++++-------- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/inventory/group_vars/openqa b/inventory/group_vars/openqa index 1c88254073..ef318e46ea 100644 --- a/inventory/group_vars/openqa +++ b/inventory/group_vars/openqa @@ -3,6 +3,8 @@ virt_install_command: "{{ virt_install_command_one_nic }} --cpu=host-passthrough external_hostname: openqa.fedoraproject.org +openqa_static_uid = 601 + openqa_hostname: localhost openqa_email: adamwill@fedoraproject.org openqa_nickname: adamwill diff --git a/inventory/group_vars/openqa-stg b/inventory/group_vars/openqa-stg index b595b6fb18..b15e30e9e5 100644 --- a/inventory/group_vars/openqa-stg +++ b/inventory/group_vars/openqa-stg @@ -14,6 +14,8 @@ virt_install_command: "{{ virt_install_command_one_nic }} --cpu=host-passthrough external_hostname: openqa.stg.fedoraproject.org +openqa_static_uid = 601 + openqa_hostname: localhost openqa_email: adamwill@fedoraproject.org openqa_nickname: adamwill diff --git a/roles/openqa/server/tasks/main.yml b/roles/openqa/server/tasks/main.yml index 635ccdd882..f2865b03e7 100644 --- a/roles/openqa/server/tasks/main.yml +++ b/roles/openqa/server/tasks/main.yml @@ -18,6 +18,9 @@ ## default - ansible_nodename # Optional vars +# - openqa_static_uid +## int - a static ID for the geekotest user and group if desired +## this is useful for NFS mounting openQA data files # - openqa_dbname ## string - The name of the database to use # - openqa_dbhost @@ -35,23 +38,21 @@ # set, the server will use a local SQLite database and the other values # are ignored. -# As we want to store some geekotest-owned files in shared storage, we -# need to ensure geekotest always has the same uid/gid if we re-deploy -# the servers. So we create the account here with uid/gid 601. +- name: Create geekotest group with static GID + group: "name=geekotest gid={{ openqa_static_uid }} system=yes" + when: "openqa_static_uid is defined" -- name: Create geekotest group with static GID 601 - group: name=geekotest gid=601 system=yes - -- name: Create geekotest user with static UID 601 +- name: Create geekotest user with static UID user: name: geekotest comment: "openQA user" - uid: 601 + uid: "{{ openqa_static_uid }}" group: geekotest home: "/var/lib/openqa" createhome: no system: yes shell: /sbin/nologin + when: "openqa_static_uid is defined" # note: we need updates-testing until fedfind 2.x and openQA 4.3-21 go stable - name: Install required packages (testing)