Added basic documentation server

This commit is contained in:
barry 2024-02-11 15:26:38 -06:00
parent 065d240468
commit c93df6d0d3
10 changed files with 111 additions and 8 deletions

6
hosts
View File

@ -1,7 +1,7 @@
# Server Names and their IP Addresses Go Here
[n0xb0x]
192.168.2.119
n0xb0x.local
[bitb0x]
192.168.2.103
@ -21,10 +21,10 @@ bitcoin_rpcpassword=rVhfmriXjB8uFekmn7sLvnUiY610JaOx
zerotier_network=
[n0xb0x:vars]
app_list=['bitcoin.yml']
hostname=n0xb0x
app_list=['bitcoin.yml','docs.yml']
ansible_user=n0xb0x
ansible_password=n0xb0x
coreos=true
#registry_url=git.boxxy.net/b0xxer/
registry_url=localhost
registry_user=

View File

@ -0,0 +1,19 @@
FROM docker.io/almalinux/9-minimal:latest
LABEL maintainer="n0x@n0xb0x.org"
COPY requirements.txt requirements.txt
RUN microdnf update -y \
&& microdnf install -y \
ca-certificates \
python3 \
python3-pip \
&& microdnf clean all && rm -fr /tmp/* /var/tmp/* \
&& pip3 install -r requirements.txt
EXPOSE 8081 80
WORKDIR /srv
CMD python -m http.server -d /srv/site 80

1
roles/apps/files/docs/build.sh Executable file
View File

@ -0,0 +1 @@
buildah bud -f Containerfile -t doc-web:1.0

View File

@ -0,0 +1 @@
site_name: My Docs

View File

@ -0,0 +1,2 @@
mkdocs==1.5.3

View File

@ -6,6 +6,11 @@
chdir: ~/Containers/bitcoin
cmd: ./build.sh
- name: rebuild_docs
ansible.builtin.shell:
chdir: ~/Containers/docs
cmd: ./build.sh
- name: reload_systemctl
ansible.builtin.systemd_service:
daemon_reload: true

49
roles/apps/tasks/docs.yml Normal file
View File

@ -0,0 +1,49 @@
---
# tasks file for build
#
- name: Create ~/srv/docs
ansible.builtin.file:
path: ~/srv/docs/site
state: directory
- name: Create ~/srv/docs
ansible.builtin.file:
path: ~/srv/docs/docs
state: directory
- name: Make dir for docs Containers
ansible.builtin.file:
path: ~/Containers/docs
state: directory
- name: Copy Containerfile Template
ansible.builtin.copy:
src: docs/Containerfile
dest: ~/Containers/docs/Containerfile
notify: rebuild_docs
- name: Copy build script
ansible.builtin.copy:
src: docs/build.sh
dest: ~/Containers/docs/build.sh
mode: '0700'
notify: rebuild_docs
- name: Copy requirements.txt file
ansible.builtin.copy:
src: docs/requirements.txt
dest: ~/Containers/docs/requirements.txt
notify: rebuild_docs
- name: Copy mkdocs.yml file
ansible.builtin.copy:
src: docs/mkdocs.yml
dest: ~/srv/docs/mkdocs.yml
notify: rebuild_docs
- name: Copy docs-node.container file
ansible.builtin.template:
src: docs/docs-node.container.j2
dest: /home/{{ ansible_user }}/.config/containers/systemd/docs-node.container
notify: reload_systemctl

View File

@ -0,0 +1,21 @@
[Unit]
Description=Documentation Server
[Container]
Image={{ registry_url }}/doc-web:1.0
PublishPort=8081:80
# Use volume
Volume=/home/{{ansible_user}}/srv/docs:/srv:Z
[Service]
# Restart service when sleep finishes
Restart=always
# Extend Timeout to allow time to pull the image
TimeoutStartSec=900
# ExecStartPre flag and other systemd commands can go here, see systemd.unit(5) man page.
# ExecStartPre=/usr/share/mincontainer/setup.sh
[Install]
# Start by default on boot
WantedBy=multi-user.target default.target

View File

@ -3,6 +3,9 @@
#
#
- name: Determine OS variant
register: variant
ansible.builtin.shell: grep VARIANT_ID /etc/os-release | sed 's/VARIANT_ID=//g'
- name: Create /etc/sysusers.d directory
become: yes
become_method: sudo
@ -17,6 +20,7 @@
src: parsec.conf
dest: /etc/sysusers.d/parsec.conf
setype: etc_t
when: variant.stdout=="iot"
- name: Enable Cockpit Service
become: yes
@ -33,7 +37,7 @@
service: cockpit
permanent: yes
state: enabled
when: coreos==True
when: variant.stdout=="iot"
- name: Enable Avahi Service
become: yes
@ -50,7 +54,7 @@
service: mdns
permanent: yes
state: enabled
when: coreos==True
when: variant.stdout=="iot"
- name: Modify nsswitch file for mdns lookups
become: yes
@ -61,11 +65,11 @@
line: 'hosts: files mdns4_minimal [NOTFOUND=return] dns myhostname'
notify: restart_avahi
- name: Set hostname to bitb0x
- name: Set hostname to {{ hostname }}
become: yes
become_method: sudo
ansible.builtin.hostname:
name: bitb0x
name: "{{ hostname }}"
notify: restart_avahi
- name: Enable Zerotier

View File

@ -38,7 +38,8 @@
- cockpit-ostree
- cockpit-podman
- zerotier-one
- python3-firewall
- python3-pip
- caddy
- name: Reboot System
become: yes