Browse Source

AddUser Role

pull/90/head
Antoine Legrand 8 years ago
parent
commit
dd61f685b8
5 changed files with 30 additions and 19 deletions
  1. 1
      cluster.yml
  2. 15
      roles/adduser/defaults/main.yml
  3. 13
      roles/adduser/tasks/main.yml
  4. 2
      roles/apps/k8s-kubedns
  5. 18
      roles/download/tasks/main.yml

1
cluster.yml

@ -1,6 +1,7 @@
---
- hosts: k8s-cluster
roles:
- { role: adduser, tags: adduser }
- { role: download, tags: download }
- { role: kubernetes/preinstall, tags: preinstall }
- { role: docker, tags: docker }

15
roles/adduser/defaults/main.yml

@ -0,0 +1,15 @@
---
addusers:
- name: etcd
comment: "Etcd user"
createhome: yes
home: "/var/lib/etcd"
system: yes
shell: /bin/nologin
- name: kube
comment: "Kubernetes user"
shell: /sbin/nologin
system: yes
group: "{{ kube_cert_group }}"
createhome: no

13
roles/adduser/tasks/main.yml

@ -0,0 +1,13 @@
- name: User | Create User Group
group: name={{item.group|default(item.name)}} system={{item.system|default(omit)}}
with_items: addusers
- name: User | Create User
user:
comment: "{{item.comment|default(omit)}}"
createhome: "{{item.create_home|default(omit)}}"
group: "{{item.group|default(item.name)}}"
home: "{{item.home|default(omit)}}"
name: "{{item.name}}"
system: "{{item.system|default(omit)}}"
with_items: addusers

2
roles/apps/k8s-kubedns

@ -1 +1 @@
Subproject commit b5015aed8ff5eed9c325911205cfbb23ad0e57be
Subproject commit d6df09a89721d98e2969a8abf29b4eb5e787fca6

18
roles/download/tasks/main.yml

@ -1,22 +1,4 @@
---
- name: certs | create system kube-cert groups
group: name={{ kube_cert_group }} state=present system=yes
- name: Create system kube user
user:
name=kube
comment="Kubernetes user"
shell=/sbin/nologin
state=present
system=yes
groups={{ kube_cert_group }}
- name: Create etcd user
user:
name: etcd
shell: /bin/nologin
home: /var/lib/etcd
- name: Create dest directories
file: path={{local_release_dir}}/{{item.dest|dirname}} state=directory recurse=yes
with_items: downloads

Loading…
Cancel
Save