Browse Source

Merge pull request #589 from sdodson/issue585

Lookup ansible_ssh_user group for kubeconfig perms
Brenton Leanhardt 9 years ago
parent
commit
a6d3017291
1 changed files with 6 additions and 2 deletions
  1. 6 2
      roles/openshift_master/tasks/main.yml

+ 6 - 2
roles/openshift_master/tasks/main.yml

@@ -169,13 +169,17 @@
   shell: echo {{ openshift_master_cluster_password | quote }} | passwd --stdin hacluster
   when: install_result | changed
 
+- name: Lookup default group for ansible_ssh_user
+  command: "/usr/bin/id -g {{ ansible_ssh_user }}"
+  register: _ansible_ssh_user_gid
+
 - name: Create the client config dir(s)
   file:
     path: "~{{ item }}/.kube"
     state: directory
     mode: 0700
     owner: "{{ item }}"
-    group: "{{ item }}"
+    group: "{{ 'root' if item == 'root' else _ansible_ssh_user_gid.stdout  }}"
   with_items:
   - root
   - "{{ ansible_ssh_user }}"
@@ -196,7 +200,7 @@
     state: file
     mode: 0700
     owner: "{{ item }}"
-    group: "{{ item }}"
+    group: "{{ 'root' if item == 'root' else _ansible_ssh_user_gid.stdout  }}"
   with_items:
   - root
   - "{{ ansible_ssh_user }}"