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 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
|
---
- name: Setup Phosh OSK Data wiki builder
gather_facts: false
hosts: all
vars:
pod_user: pod-builder
pod_home: "/home/pod-builder"
wikiextractorpkg: "wikiextractor_3.0.7-1_all.deb"
tasks:
- name: Ensure we have a package list
ansible.builtin.apt:
update_cache: true
- name: Add packages
ansible.builtin.apt:
pkg:
- git
- htop
- kitty-terminfo
- python3-nltk
- python3-tqdm
- screen
- sqlite3
- vim-nox
- wget
- name: Add user
ansible.builtin.user:
name: "{{ pod_user }}"
system: true
create_home: true
shell: /usr/sbin/nologin
home: "{{ pod_home }}"
- name: Download wikiextractor until in Debian
ansible.builtin.get_url:
url: "https://people.debian.org/~agx/wikiextractor/{{ wikiextractorpkg }}"
dest: "{{ pod_home }}/{{ wikiextractorpkg }}"
- name: Install wikiextractor
ansible.builtin.command: dpkg -i "{{ pod_home }}/{{ wikiextractorpkg }}"
- name: Copy script
ansible.builtin.copy:
src: ../pod-db-from-wiki-dump
dest: "{{ pod_home }}/pod-db-from-wiki-dump"
owner: pod-builder
mode: '0755'
- name: Creates directory
ansible.builtin.file:
path: "{{ pod_home }}/output"
state: directory
owner: "{{ pod_user }}"
- name: Check for wiki data volume
ansible.builtin.stat:
path: "/dev/disk/by-label/wiki-data"
register: d
- name: Mount data volume
ansible.posix.mount:
path: "{{ pod_home }}/output"
src: "/dev/disk/by-label/wiki-data"
state: mounted
fstype: ext4
when: d.stat.islnk is defined and d.stat.islnk
- name: Allow access to output dir
ansible.builtin.file:
path: "{{ pod_home }}/output"
state: directory
owner: "{{ pod_user }}"
|