/
apt_systems.yml
88 lines (78 loc) · 2.56 KB
/
apt_systems.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
---
- name: Setup local repo files.
import_tasks: apt/repos.yml
tags:
- repos
# http://tracker.ceph.com/issues/15090
# We don't know why it's happening, but something is corrupting the
# apt-cache. Let's try just blasting it each time.
- name: Blast the apt cache.
command:
sudo apt-get clean
- name: Update apt cache.
apt:
update_cache: yes
# try for 2 minutes before failing
retries: 24
delay: 5
tags:
- repos
- packages
- name: Perform package related tasks.
import_tasks: apt/packages.yml
tags:
- packages
# This was ported directly from chef. I was unable to figure out a better way
# to do this, but it seems to just be adding the user_xattr option to the root filesystem mount.
# I believe perl was used here initially because the mount resources provided by chef and ansible
# require both the name (i.e. /) and the source (UUID="<some_uuid>") to ensure it's editing the correct line
# in /etc/fstab. This won't work for us because the root file system source (UUID or label) is different depending
# on the image used to create this node (downburst and cobbler use different images).
- name: Use perl to add user_xattr to the root mount options in fstab.
command:
perl -pe 'if (m{^([^#]\S*\s+/\s+\S+\s+)(\S+)(\s+.*)$}) { $_="$1$2,user_xattr$3\n" unless $2=~m{(^|,)user_xattr(,|$)}; }' -i.bak /etc/fstab
args:
creates: /etc/fstab.bak
register: add_user_xattr
when:
- modify_fstab == true
- not containerized_node
- name: Enable xattr for this boot.
command:
mount -o remount,user_xattr /
when: add_user_xattr is defined and
add_user_xattr is changed
- name: Ensure fuse, kvm and disk groups exist.
group:
name: "{{ item }}"
state: present
with_items:
- fuse
- kvm
- disk
- name: Upload /etc/fuse.conf.
template:
src: fuse.conf
dest: /etc/fuse.conf
owner: root
group: fuse
mode: 0644
- name: Add teuthology user to groups fuse, kvm and disk.
user:
name: "{{ teuthology_user }}"
# group sets the primary group, while groups just adds
# the user to the specified group or groups.
groups: fuse,kvm,disk
append: yes
- import_tasks: static_ip.yml
when:
- "'vps' not in group_names"
- not containerized_node
- name: Stop apache2
service:
name: apache2
state: stopped
# There's an issue with ansible<=2.9 and our custom built kernels (5.8 as of this commit) where the service and systemd modules don't have backwards compatibility with init scripts
ignore_errors: "{{ 'ceph' in ansible_kernel }}"
when:
- not containerized_node