forked from ome/prod-playbooks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtraining-server.yml
93 lines (81 loc) · 2.61 KB
/
training-server.yml
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# Production tuning of server limits.conf, Postgres and NGINX required, but this will install a minimal OMERO server,
# OMERO.web with NGINX and systemd configuration controlling both.
# Install the latest release, including PostgreSQL on the same server
# users-to-be-added to come from host_vars
- hosts: training-server
roles:
- role: omero-server
# Taking this from the openstack playbook os-omero.yml, to install the systemd config.
omero_systemd_setup: True
vars:
- postgresql_users_databases:
- user: omero
password: omero
databases: [omero]
- users_to_control_omero:
- "centos"
- users_to_be_added:
- "fm1"
- "fm2"
- users_password: "invalid"
- fm_groupname: "facility-managers"
tasks:
- name: training-server | add operating system group for trainers
become: true
group:
name: trainers
state: present
- name: training-server | add sample images folder
become: true
file:
path: /var/sample-images
owner: root
group: trainers
mode: 0775
state: directory
- name: training-server | add operating system group for facility managers
become: true
group:
name: facility-managers
state: present
- name: training-server | add facility manager operating system users
become: true
user:
name: "{{item}}"
state: present
groups: users,{{ fm_groupname }}
password: "{{ users_password }}"
with_items: "{{ users_to_be_added }}"
- name: training-server | add symlinks to sample images in fm users homedirs
become: true
file:
path: ~{{ item }}/sample-images
owner: root
src: /var/sample-images
state: link
with_items: "{{ users_to_be_added }}"
- name: training-server | add OMERO.DropBox folders
become: true
file:
path: /OMERO/DropBox/{{ item }}
owner: omero
group: "{{ fm_groupname }}"
mode: 0775
state: directory
with_items: "{{ users_to_be_added }}"
- name: training-server | allow OMERO user sudo by list of users in variable
become: true
lineinfile:
dest: /etc/sudoers
state: present
line: '{{ item }} ALL=(omero:omero) NOPASSWD:ALL'
validate: 'visudo -cf %s'
with_items: "{{ users_to_control_omero }}"
- name: training-server | allow OMERO service control by list of users in variable
become: true
lineinfile:
dest: /etc/sudoers
state: present
line: '{{ item }} ALL=(root) NOPASSWD:/usr/bin/systemctl ?* omero.service, /usr/bin/systemctl ?* omero-web.service'
validate: 'visudo -cf %s'
with_items: "{{ users_to_control_omero }}"