summaryrefslogtreecommitdiff
path: root/roles/hncrawler/tasks/main.yml
diff options
context:
space:
mode:
Diffstat (limited to 'roles/hncrawler/tasks/main.yml')
-rw-r--r--roles/hncrawler/tasks/main.yml39
1 files changed, 39 insertions, 0 deletions
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"