--- /dev/null
+#!/usr/bin/env python3
+
+import json
+import sys
+import urllib.request
+
+run_id = sys.argv[1]
+
+if run_id == "last":
+ runs = json.loads(urllib.request.urlopen("https://api.github.com/repos/alexpdp7/ragent/actions/runs?branch=master").read().decode('utf8'))
+ run_id = runs["workflow_runs"][0]["id"]
+
+run = json.loads(urllib.request.urlopen("https://api.github.com/repos/alexpdp7/ragent/actions/runs/%s" % run_id).read().decode('utf8'))
+artifacts = json.loads(urllib.request.urlopen(run['artifacts_url']).read().decode('utf8'))['artifacts']
+urls = {a['name']: 'https://api.github.com/repos/alexpdp7/ragent/actions/artifacts/%s/zip' % a["id"] for a in artifacts}
+print(json.dumps(urls))
--- /dev/null
+---
+- 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
+ uri:
+ url: "{{ url.stdout|from_json|json_query(ragent['package_key'][ansible_os_family][ansible_distribution_major_version][ansible_architecture]) }}"
+ dest: /tmp/ragent_downloaded_package.zip
+ user: " {{ ragent_download['user'] }}"
+ password: "{{ ragent_download['token'] }}"
+ force_basic_auth: yes
+ follow_redirects: all
+- 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"
+- 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"
--- /dev/null
+---
+ragent:
+ package_key:
+ Debian:
+ '9':
+ x86_64: debian_stretch
+ armv7l: debian_stretch_rpi3
+ '10': # apparently the stretch package works for buster
+ x86_64: debian_stretch
+ armv7l: debian_stretch_rpi3
+ '11': # apparently the stretch package works for bullseye
+ x86_64: debian_stretch
+ armv7l: debian_stretch_rpi3
+ '20': # and it also works for Ubuntu 20.04
+ x86_64: debian_stretch
+ RedHat:
+ '7':
+ x86_64: el7
+ '8':
+ x86_64: el8
+ aarch64: el8_rpi4
+ '9':
+ x86_64: el8
+ install_command:
+ Debian: "dpkg -i"
+ RedHat: "rpm -i"
service_description => "ssh",
check_command => "check_ssh",
}
+
+# https://github.com/alexpdp7/ragent/issues/352
+if $facts['os']['family'] == 'RedHat' and $facts['os']['release']['major'] == '9' {
+ package {'compat-openssl11':}
+}