AddUser Role
This commit is contained in:
parent
87d8d87c6e
commit
dd61f685b8
5 changed files with 30 additions and 19 deletions
|
@ -1,6 +1,7 @@
|
||||||
---
|
---
|
||||||
- hosts: k8s-cluster
|
- hosts: k8s-cluster
|
||||||
roles:
|
roles:
|
||||||
|
- { role: adduser, tags: adduser }
|
||||||
- { role: download, tags: download }
|
- { role: download, tags: download }
|
||||||
- { role: kubernetes/preinstall, tags: preinstall }
|
- { role: kubernetes/preinstall, tags: preinstall }
|
||||||
- { role: docker, tags: docker }
|
- { role: docker, tags: docker }
|
||||||
|
|
15
roles/adduser/defaults/main.yml
Normal file
15
roles/adduser/defaults/main.yml
Normal file
|
@ -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
Normal file
13
roles/adduser/tasks/main.yml
Normal file
|
@ -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
|
|
@ -1 +1 @@
|
||||||
Subproject commit b5015aed8ff5eed9c325911205cfbb23ad0e57be
|
Subproject commit d6df09a89721d98e2969a8abf29b4eb5e787fca6
|
|
@ -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
|
- name: Create dest directories
|
||||||
file: path={{local_release_dir}}/{{item.dest|dirname}} state=directory recurse=yes
|
file: path={{local_release_dir}}/{{item.dest|dirname}} state=directory recurse=yes
|
||||||
with_items: downloads
|
with_items: downloads
|
||||||
|
|
Loading…
Reference in a new issue