-
Notifications
You must be signed in to change notification settings - Fork 0
/
playbook-svc-login.yml
148 lines (121 loc) · 4.34 KB
/
playbook-svc-login.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
- name: Setup FreeIPA client on login node
hosts: "login-*.{{domain}}"
become: true
pre_tasks:
- include_tasks: tasks/setup_backup_dir.yml
- include_tasks: tasks/backup_or_restore_host_keys.yml
- include_tasks: tasks/setup_unattended_security_updates.yml
- name: Setup fail2ban
ansible.builtin.dnf:
name: ["fail2ban"]
- name: Configure fail2ban_config
ansible.builtin.template:
src: "ssh.conf.fail2ban.j2"
dest: /etc/fail2ban/jail.d/ssh.conf
- name: Enable fail2ban service
ansible.builtin.systemd_service:
name: fail2ban
state: restarted
enabled: true
- name: Setup missing Slurm dependencies
ansible.builtin.dnf:
name: ["/bin/mailx", "Lmod"]
- name: Setup motd
ansible.builtin.copy:
content: "{{login_message_of_the_day}}"
dest: /etc/motd.d/00-welcome.motd
- name: Permit mountd service
ansible.posix.firewalld:
service: mountd
state: enabled
permanent: true
- name: Permit rpc-bind service
ansible.posix.firewalld:
service: rpc-bind
state: enabled
permanent: true
- name: Permit slurm srun ranges
ansible.posix.firewalld:
port: "{{srun_port_range}}/tcp"
state: enabled
permanent: true
- name: Remove stale CA from past IPA joins
ansible.builtin.file:
state: absent
path: /etc/ipa/ca.crt
roles:
- role: linux-system-roles.postfix
postfix_conf: { relayhost: "{{postfix_smtp_relay}}" }
- role: stackhpc.openhpc
ansible_distribution_major_version: Alma9
ohpc_openhpc_repos: { "Alma9": [] } # already part of BOS
ohpc_default_extra_repos: { "Alma9": [] } # already part of BOS
openhpc_enable:
control: false # slurmctld
runtime: true # slurmd
database: false # slurmdbd
batch: false # compute node
openhpc_slurm_configless: true
openhpc_slurm_service_enabled: true
openhpc_login_only_nodes: "{{inventory_hostname}}"
openhpc_cluster_name: "{{mgmt_cluster_name}}"
openhpc_module_system_install: false
- role: freeipa.ansible_freeipa.ipaclient
state: present
ipaclient_domain: "{{domain}}"
ipaadmin_password: "{{ipa_password}}"
ipaclient_configure_dns_resolver: yes
ipaclient_dns_servers: "{{idm_ip}}"
ipaclient_force_join: yes
post_tasks:
- name: "Setup HBAC: Allow users login node access"
freeipa.ansible_freeipa.ipahbacrule:
ipaadmin_password: "{{ipa_password}}"
description: Allow users login node access
name: allow_normal_user_login_access
group: "{{idm_default_group}}"
host: "{{ansible_play_hosts}}"
servicecategory: all
state: present
run_once: true # this is a single rule to cover all login nodes, so run this once
### Restore slurm credentials ###
- name: Upload munge key
ansible.builtin.copy:
src: "{{backup_directory}}/mgmt.{{domain}}/munge.key"
dest: /etc/munge/munge.key
- name: Reload munge service
ansible.builtin.systemd_service:
name: munge
state: restarted
### Configure autofs ###
- name: Make autofs browsable by default
ansible.builtin.lineinfile:
path: /etc/autofs.conf
regexp: "^browse_mode = "
line: browse_mode = yes
### Configure webhookd provision notifications ###
- name: Create /etc/webhookd dir
ansible.builtin.file:
state: directory
path: /etc/webhookd
mode: 755
- name: Upload webhookd mTLS credentials
ansible.builtin.copy:
src: "{{backup_directory}}/mgmt.{{domain}}/{{item}}"
dest: "/etc/webhookd/{{item}}"
mode: 600
loop: [client.pem, client.key, server.pem]
- name: Setup pam_exec user provision script
ansible.builtin.template:
src: webhookd_notify_provision.sh.j2
dest: /usr/local/bin/webhookd_notify_provision.sh
mode: 700
- name: Setup pam_exec home directory script
ansible.builtin.lineinfile:
path: /etc/pam.d/sshd
line: session optional pam_exec.so quiet /usr/local/bin/webhookd_notify_provision.sh
- include_tasks: tasks/ipa_client_automount.yml
- name: Trim
ansible.builtin.shell: fstrim -av
- name: Reboot
ansible.builtin.reboot: