summaryrefslogtreecommitdiff
path: root/roles/hncrawler/tasks/main.yml
blob: 5980f75417a98042b3f98f7f5b7e1acb9980bad4 (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
- 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"