From e9c34514b1bbd1c3fe0b4660073cfb1531daa906 Mon Sep 17 00:00:00 2001 From: admin Date: Wed, 25 Sep 2024 16:14:57 +0200 Subject: new role hncrawler --- roles/hncrawler/tasks/main.yml | 39 +++++++++++++++++++++++++++++++++++++++ site.yml | 9 +++++++++ 2 files changed, 48 insertions(+) create mode 100644 roles/hncrawler/tasks/main.yml diff --git a/roles/hncrawler/tasks/main.yml b/roles/hncrawler/tasks/main.yml new file mode 100644 index 0000000..5980f75 --- /dev/null +++ b/roles/hncrawler/tasks/main.yml @@ -0,0 +1,39 @@ +- name: check git repo installed + ansible.builtin.stat: + path: /home/horus/code/hncrawler + register: hncrawler_installed + +- name: git clone hncrawler + remote_user: horus + git: + repo: git@git.iamfabulous.de:hncrawler + dest: /home/horus/code/hncrawler + accept_hostkey: yes + #ssh_opts: "-o StrictHostKeyChecking=no" + when: not hncrawler_installed + +- name: compile hncrawler (make build) + remote_user: horus + ansible.builtin.shell: make build + args: + chdir: /home/horus/code/hncrawler + +- name: check hncrawler config.json installed + ansible.builtin.stat: + path: /home/horus/code/hncrawler/config.json + register: hncrawler_config_installed + +- name: copy config.json + remote_user: horus + copy: + src: config.json + dest: /home/horus/code/hncrawler/config.json + when: 0 > 1 + #when: not hncrawler_config_installed + +- name: set cronjob for hncrawler + ansible.builtin.cron: + name: "crawlt stories on HN for hncrawler" + minute: "*/30" + user: "horus" + job: "/home/horus/code/hncrawler/hncrawler -s -c /home/horus/code/hncrawler/config.json" diff --git a/site.yml b/site.yml index 814e85c..7163cf0 100644 --- a/site.yml +++ b/site.yml @@ -138,3 +138,12 @@ - nextcloud #the_user: "{{ ansible_user_id }}" + +# ------------------------------------------------------------ + +- name: hncrawler + hosts: code + roles: + - hncrawler + tags: + - hncrawler -- cgit v1.2.3