main.yml 2.03 KB
Newer Older
Gildas Le Corguillé's avatar
Gildas Le Corguillé committed
1
2
---

Gildas Le Corguillé's avatar
Gildas Le Corguillé committed
3
4
5
6
7
8
9
10
11
- name: Gather os specific variables
  include_vars: "{{ item }}"
  with_first_found:
    - "{{ ansible_distribution }}.yml"
    - "{{ ansible_os_family }}.yml"
    - "default.yml"
  tags: vars

- name: install deps
Gildas Le Corguillé's avatar
Gildas Le Corguillé committed
12
13
  package:
    state: present
Gildas Le Corguillé's avatar
Gildas Le Corguillé committed
14
15
16
17
18
    name: "{{ role_dependencies }}"
  register: _install_result
  until: _install_result is success
  retries: 10
  delay: 2
Gildas Le Corguillé's avatar
Gildas Le Corguillé committed
19

Gildas Le Corguillé's avatar
Gildas Le Corguillé committed
20
21
22
- name: Git clone
  git:
    repo: 'https://gitlab.com/ifb-elixirfr/cluster/utils/status_bars.git'
Gildas Le Corguillé's avatar
Gildas Le Corguillé committed
23
24
    dest: "{{ status_bars_homedir }}/status_bars"
    version: "{{ status_bars_version }}"
Gildas Le Corguillé's avatar
Gildas Le Corguillé committed
25

26
27
28
29
30
31
- name: Create a directory etc/
  file:
    path: "{{ status_bars_homedir }}/etc/"
    state: directory
    mode: '0755'

Gildas Le Corguillé's avatar
Gildas Le Corguillé committed
32
- name: Create a directory var/
33
  file:
Gildas Le Corguillé's avatar
Gildas Le Corguillé committed
34
    path: "{{ tab_absolute_path }}"
35
36
37
    state: directory
    mode: '0755'

Gildas Le Corguillé's avatar
Gildas Le Corguillé committed
38
39
- name: Config
  template:
Gildas Le Corguillé's avatar
Gildas Le Corguillé committed
40
    src: 'conf.sh.j2'
Gildas Le Corguillé's avatar
conf    
Gildas Le Corguillé committed
41
    dest: "{{ status_bars_conf }}"
Gildas Le Corguillé's avatar
Gildas Le Corguillé committed
42
43
    owner: root
    mode: '0644'
44

Gildas Le Corguillé's avatar
Gildas Le Corguillé committed
45
- name: Template profile.d file
46
47
48
  template:
    src: "status_bars_profile.sh.j2"
    dest: "/etc/profile.d/status_bars_profile.sh"
Gildas Le Corguillé's avatar
lint    
Gildas Le Corguillé committed
49
50
    owner: root
    mode: '0644'
51

Gildas Le Corguillé's avatar
Gildas Le Corguillé committed
52
53
54
55
- name: Template motd script
  template:
    src: XX-status_bars.j2
    dest: "/etc/update-motd.d/{{ update_motd_d_script }}"
Gildas Le Corguillé's avatar
lint    
Gildas Le Corguillé committed
56
    owner: root
Gildas Le Corguillé's avatar
Gildas Le Corguillé committed
57
58
59
    mode: 0755
  when: update_motd_d_script is defined

60
61
62
63
- name: Cron get_cpu_usage_quota
  cron:
    name: "get_cpu_usage_quota"
    minute: "0"
64
    hour: "*/1"
Gildas Le Corguillé's avatar
Gildas Le Corguillé committed
65
    job: ". /etc/profile; bash {{ status_bars_homedir }}/status_bars/\
Gildas Le Corguillé's avatar
Gildas Le Corguillé committed
66
      get_cpu_usage_quota.sh"
67
68
69
70
71

- name: Cron get_disk_usage_quota
  cron:
    name: "get_disk_usage_quota"
    minute: "0"
72
    hour: "*/1"
Gildas Le Corguillé's avatar
Gildas Le Corguillé committed
73
    job: ". /etc/profile; bash {{ status_bars_homedir }}/status_bars/\
Gildas Le Corguillé's avatar
conf    
Gildas Le Corguillé committed
74
      get_disk_usage_quota_{{ filesystem }}.sh"
75
76
77
78
79

- name: Cron get_associations
  cron:
    name: "get_associations"
    minute: "0"
80
    hour: "*/1"
Gildas Le Corguillé's avatar
Gildas Le Corguillé committed
81
    job: ". /etc/profile; bash {{ status_bars_homedir }}/status_bars/\
Gildas Le Corguillé's avatar
Gildas Le Corguillé committed
82
      get_associations.sh"
Gildas Le Corguillé's avatar
Gildas Le Corguillé committed
83
84
85
86
87
88

- name: Cron find-rm-delete
  cron:
    name: "find-rm-delete"
    minute: "0"
    hour: "0"
89
    job: "find {{ tab_absolute_path }} -type f -mtime +7 -delete"