forked from usmqe/usmqe-setup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_teardown.clouduser.yml
37 lines (32 loc) · 1022 Bytes
/
test_teardown.clouduser.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
---
# This teardown playbook reverts environment when we don't have direct ssh
# root access on storage machines and need to connect via different user and
# then use sudo into normal, direct root access allowed, state.
- hosts: "usm_server:usm_nodes:usm_client"
remote_user: cloud-user
become: yes
handlers:
- name: restart sshd
service: name=sshd state=restarted
tasks:
- name: Allow direct ssh access for root again
lineinfile:
dest: /etc/ssh/sshd_config
regexp: '^AllowUsers'
state: absent
notify:
- restart sshd
- hosts: "usm_server:usm_nodes:usm_client"
remote_user: root
tasks:
- name: Remove sudoers file for cloud-user
file:
path: /etc/sudoers.d/90-cloud-init-users
state: absent
- name: HACK - wait for some time to prevent failure of the next task
pause: minutes=1
- name: Remove cloud-user account including homedir
user:
name: cloud-user
remove: yes
state: absent