aboutsummaryrefslogtreecommitdiffstats
path: root/roles/obsd_cgit/tasks/markdown.yml
blob: fccac0862d93260f2c821935b1d7932929af91da (plain) (blame)
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
- name: md2html exists # noqa: name[casing]
  ansible.builtin.stat:
    path: /var/www/bin/md2html
  register: obsd_cgit_md2html_bin

- name: Install lowdown package
  ansible.builtin.package:
    name: lowdown
    state: present
  when: not obsd_cgit_md2html_bin.stat.exists

- name: Copy md2html into /tmp
  ansible.builtin.copy:
    src: md2html.c
    dest: /tmp/
    owner: root
    group: wheel
    mode: "0755"

- name: Ensure /var/www/bin directory exists
  ansible.builtin.file:
    path: "/var/www/bin"
    state: directory
    owner: root
    group: bin
    mode: "0755"

- name: Statically compile md2html to /var/www/bin/md2html
  ansible.builtin.command: |
    cc md2html.c \
      -o /var/www/bin/md2html \
      -I/usr/local/include \
      -L/usr/local/lib \
      -llowdown \
      -lm \
      -static \
      -pie \
      -s
  args:
    chdir: /tmp
    creates: /var/www/bin/md2html

- name: Ensure root:bin owns md2html binary
  ansible.builtin.file:
    path: /var/www/bin/md2html
    owner: root
    group: bin
    mode: "0755"

- name: Remove lowdown package
  ansible.builtin.package:
    name: lowdown
    state: absent