aboutsummaryrefslogtreecommitdiff
path: root/personal_infra/playbooks/roles/deploy_ragent/tasks/main.yml
blob: 0dff9664d8edd9447fb1d56ad2146d636a0a1b11 (plain)
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
---
- name: get url
  local_action:
    module: command
    cmd: "{{ inventory_dir }}/playbooks/roles/deploy_ragent/files/get.py {{ run_id|default('last') }}"
  run_once: True
  register: url
- name: download package
  command:
    argv:
      - curl
      - "{{ url.stdout|from_json|json_query(ragent['package_key'][ansible_os_family][ansible_distribution_major_version][ansible_architecture]) }}"
      - -o
      - /tmp/ragent_downloaded_package.zip
      - --header
      - "Authorization: Bearer {{ ragent_download['token'] }}"
      - "-L"
- name: unzip
  unarchive:
    src: /tmp/ragent_downloaded_package.zip
    dest: /tmp
    list_files: yes
    remote_src: yes
  register: unzipped
- name: remove previous
  package:
    name: ragent
    state: absent
- name: install package
  command: "{{ ragent['install_command'][ansible_os_family] }} /tmp/{{ unzipped.files[0] }}"
- name: configure service
  service:
    name: ragent
    enabled: yes
    state: restarted
- name: open firewall
  command: firewall-cmd --permanent --add-port=21488/tcp
  when: ansible_os_family == "RedHat" and ansible_distribution_major_version in ("7", "8", "9") and ansible_virtualization_type != "lxc" and not network.disable_firewall|default(False)
- name: reload firewall
  command: firewall-cmd --reload
  when: ansible_os_family == "RedHat" and ansible_distribution_major_version in ("7", "8", "9") and ansible_virtualization_type != "lxc" and not network.disable_firewall|default(False)
- name: force check
  community.general.nagios:
    action: forced_check
    host: "{{ inventory_hostname }}"
    service: check_ragent
  delegate_to: nagios.h1.int.pdp7.net