-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathaddReleaseManagerUser.yml
More file actions
72 lines (59 loc) · 1.78 KB
/
addReleaseManagerUser.yml
File metadata and controls
72 lines (59 loc) · 1.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# This playbook adds an release-manager user with the given name to the downloads machine.
# It creates a linux user, adds it to release-manager group and puts the ssh key to downloads and jumphosts.
# The Google Authenticator file is only put to the jumphosts.
# The parameters `username` and `path_to_google_auth` are required.
# Usage:
# ansible-playbook addReleaseManagerUser.yml --extra-vars "username=tacocat path_to_google_auth=absolute/path/to/.google_authenticator"
- hosts:
- jumphost
become: true
become_user: root
pre_tasks:
- name: Create release-manager group
group:
name: release-manager
state: present
- name: Create a linux user and add it to release-manager group
user:
name: "{{ username }}"
create_home: yes
groups: release-manager
append: yes
state: present
shell: /bin/bash
roles:
- role: add_ssh_key
vars:
username: "{{ username }}"
- role: add_GA_file
vars:
username: "{{ username }}"
path_to_google_auth: "{{ path_to_google_auth }}"
- hosts:
- static
become: true
become_user: root
pre_tasks:
- name: Create release-manager group
group:
name: release-manager
state: present
- name: Create a linux user and add it to release-manager group
user:
name: "{{ username }}"
create_home: yes
state: present
groups: release-manager
append: yes
shell: /bin/bash
- name: Create public_html directory for user
file:
state: directory
dest: "/home/{{ username }}/public_html"
mode: "755"
owner: "{{ username }}"
group: "{{ username }}"
roles:
- role: add_ssh_key
vars:
username: "{{ username }}"