summaryrefslogtreecommitdiff
path: root/setup.yml
diff options
context:
space:
mode:
authorJohannes Stoelp <johannes.stoelp@gmail.com>2025-04-04 02:32:57 +0200
committerJohannes Stoelp <johannes.stoelp@gmail.com>2025-04-04 02:35:04 +0200
commit07cc232165d566d78e62dfc9eed9f5d5bb8831be (patch)
tree1cd764fa914480e556ec423efe9030398e5c184f /setup.yml
parent78561724fa4f58b8d256227f8913e712ecbd30f5 (diff)
downloadansible-ship-main.tar.gz
ansible-ship-main.zip
setup: rename to servicesHEADmain
Diffstat (limited to 'setup.yml')
-rw-r--r--setup.yml128
1 files changed, 0 insertions, 128 deletions
diff --git a/setup.yml b/setup.yml
deleted file mode 100644
index 9dc1926..0000000
--- a/setup.yml
+++ /dev/null
@@ -1,128 +0,0 @@
-- name: ship setup
- hosts: all
- gather_facts: no
- vars:
- user: "{{ '$USER' | expandvars }}"
- data: "{{ '$HOME/services' | expandvars }}"
-
- # podman-rootless
- #
- # * using native overflay fs support (no fuse)
- # - at least kernel version 5.13
- # - podman info -f '{{.Store.GraphDriverName}}'
- # -> "overlay"
- # - podman info -f '{{index .Store.GraphStatus "Native Overlay Diff"}}'
- # -> true
- # - if configured with different storage driver before may need to run
- # podman system reset # deletes every image/container/.. with old driver
- # - cat .local/share/containers/storage/overlay/.has-mount-program
- # -> false
- #
- # * configure storage driver
- # > cat .config/containers/storage.conf
- # [storage]
- # driver = "overlay"
-
- tasks:
-
- # -- LINGER ----------------------------------------------------------------
-
- # Enable lingering for user. A user manager is spawned for the user at boot
- # and kept around after logouts. This allows users who are not logged in to
- # run long-running services.
- - name: enable-linger
- become: true
- command: loginctl enable-linger {{ user }}
- args:
- # Command is not re-run if following file exits.
- # https://docs.ansible.com/ansible/latest/collections/ansible/builtin/command_module.html#parameter-creates
- creates: "/var/lib/systemd/linger/{{ user }}"
-
- # -- COPY FILES ------------------------------------------------------------
-
- - name: copy-files
- ansible.builtin.copy:
- src: "{{ item }}"
- dest: "{{ data }}"
- mode: preserve
- loop:
- - ftp
- - mosquitto
-
- # -- FTP SERVER ------------------------------------------------------------
-
- - name: build-podman-ftp
- containers.podman.podman_image:
- name: ftp
- path: "{{ data }}/ftp"
- force: true
- register: ftp_build
-
- - name: run-podman-ftp
- containers.podman.podman_container:
- name: ftp
- image: ftp
- network: host
- volumes:
- - "{{ data }}/ftp/inbox:/inbox"
- command: python3 -m pyftpdlib --write -d /inbox -u pleb -P moose
- recreate: "{{ ftp_build.changed }}"
-
- # -- MOSQUITTO SERVER ------------------------------------------------------
-
- # Use `mosquitto_sub -t '#'` to subscribe to all topics.
- - name: run-podman-mosquitto
- containers.podman.podman_container:
- name: mosquitto
- image: docker.io/eclipse-mosquitto
- ports:
- - "1883:1883/tcp"
- volumes:
- - "{{ data }}/mosquitto/mosquitto.conf:/mosquitto/config/mosquitto.conf"
-
- # -- HOME ASSISTANT --------------------------------------------------------
-
- - name: add-user-to-group
- become: true
- user:
- name: "{{ user }}"
- groups: dialout
- append: yes
-
- - name: run-podman-home-assistant
- containers.podman.podman_container:
- name: homeassistant
- image: ghcr.io/home-assistant/home-assistant:stable
- network: host
- # Keep groups, eg dialout for ttyUSB0.
- group_add: keep-groups
- volumes:
- - "{{ data }}/home-assistant/config:/config"
- - "/etc/localtime:/etc/localtime:ro"
- device:
- - "/dev/ttyUSB0:/dev/ttyUSB0"
-
- # -- USER SYSTEMD UNITS ----------------------------------------------------
-
- - name: generate-user-systemd-units
- containers.podman.podman_generate_systemd:
- name: "{{ item }}"
- dest: ~/.config/systemd/user/
- restart_policy: on-failure
- restart_sec: 10
- loop:
- - ftp
- - mosquitto
- - homeassistant
-
- - name: enable-user-systemd-units
- ansible.builtin.systemd:
- name: "container-{{ item }}"
- scope: user
- daemon_reload: true
- #state: started
- enabled: true
- loop:
- - ftp
- - mosquitto
- - homeassistant