summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoradmin2024-09-25 16:14:57 +0200
committeradmin2024-09-25 16:14:57 +0200
commite9c34514b1bbd1c3fe0b4660073cfb1531daa906 (patch)
treed8e721e11695c13e47a16191ff3980686d0421da
parentb7703290c62002bd9c0795fbee694d73e3301d96 (diff)
downloadansible-e9c34514b1bbd1c3fe0b4660073cfb1531daa906.tar.gz
new role hncrawler
-rw-r--r--roles/hncrawler/tasks/main.yml39
-rw-r--r--site.yml9
2 files changed, 48 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"
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