Initial Commit - Semaphore testing after podman-host

This commit is contained in:
Mike Holloway 2025-11-28 22:39:22 -05:00
commit fbc6af6134
8 changed files with 204 additions and 0 deletions

52
meta/main.yml Normal file
View File

@ -0,0 +1,52 @@
galaxy_info:
author: Mike Holloway
description: Technical Consultant
company: EquilibrateIT Inc.
# If the issue tracker for your role is not on github, uncomment the
# next line and provide a value
# issue_tracker_url: http://example.com/issue/tracker
# Choose a valid license ID from https://spdx.org - some suggested licenses:
# - BSD-3-Clause (default)
# - MIT
# - GPL-2.0-or-later
# - GPL-3.0-only
# - Apache-2.0
# - CC-BY-4.0
license: BSD-3-Clause
min_ansible_version: 2.1
# If this a Container Enabled role, provide the minimum Ansible Container version.
# min_ansible_container_version:
#
# Provide a list of supported platforms, and for each platform a list of versions.
# If you don't wish to enumerate all versions for a particular platform, use 'all'.
# To view available platforms and versions (or releases), visit:
# https://galaxy.ansible.com/api/v1/platforms/
#
# platforms:
# - name: Fedora
# versions:
# - all
# - 25
# - name: SomePlatform
# versions:
# - all
# - 1.0
# - 7
# - 99.99
galaxy_tags: []
# List tags for your role here, one per line. A tag is a keyword that describes
# and categorizes the role. Users find roles by searching for tags. Be sure to
# remove the '[]' above, if you add tags to this list.
#
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
# Maximum 20 tags per role.
dependencies: []
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
# if you add dependencies to this list.

4
tasks/certificates.yml Normal file
View File

@ -0,0 +1,4 @@
# step ca certificate "ca.equilibrateit.test" ca.equilibrateit.test.crt ca.equilibrateit.test.key
# chown 100999:100999 ~stepca/nginx/certs/ca.equilibrateit.test.*
# manual standup passes test
# curl --connect-to ca.equilibrateit.test:4443:localhost:4443 https://ca.equilibrateit.test:4443/health

53
tasks/containers.yml Normal file
View File

@ -0,0 +1,53 @@
- name: Container tasks
block:
- name: Pod State created
containers.podman.podman_pod:
name: "pod_nextcloud"
state: created
share: ipc,uts
hostname: "{{ ansible_host }}"
restart_policy: always
- name: nextcloud Container State created
containers.podman.podman_container:
name: "nextcloud_app_1"
state: created
pod: "pod_nextcloud"
image: "docker.io/nextcloud/nextcloud:stable-fpm"
network: bridge
ports:
- 9000:9000
volumes:
- "/home/{{ user.name }}/nextcloud/data:/home/step"
env:
VIRTUAL_HOST_MULTIPORTS: "{{ lookup('ansible.builtin.template','nextcloud_multiports.json.j2')}}"
VIRTUAL_PROTO: "https"
- name: NGINX Proxy Container State created
containers.podman.podman_container:
name: "nextcloud_nginx-proxy_1"
state: created
pod: "pod_nextcloud"
image: "docker.io/nginxproxy/nginx-proxy:latest"
network: bridge
ports:
- 8080:80
- 4443:443
volumes:
- "/home/{{ user.name }}/nginx/html:/usr/share/nginx/html"
- "/home/{{ user.name }}/nginx/nextcloud_internal_vhost:/etc/nginx/vhost.d/{{ ansible_host }}_location"
- "/home/{{ user.name }}/nginx/certs:/etc/nginx/certs"
- "/run/user/{{ getent_passwd[user.name][2] }}/podman/podman.sock:/tmp/docker.sock:ro"
- name: Container State started
containers.podman.podman_container:
name: "{{ container_to_start }}"
state: started
pod: "pod_nextcloud"
with_items:
- "nextcloud_app_1"
- "nextcloud_nginx-proxy_1"
tags:
- init
loop_control:
loop_var: "container_to_start"

21
tasks/files.yml Normal file
View File

@ -0,0 +1,21 @@
- name: Container Path data State directory
file:
path: "/home/{{ user.name }}/nextcloud/data"
state: directory
owner: "100999"
group: "100999"
- name: Container Path certs State directory
file:
path: "/home/{{ user.name }}/nginx/certs"
state: directory
owner: "100999"
group: "100999"
- name: Container Path html State directory
file:
path: "/home/{{ user.name }}/nginx/html"
state: directory
owner: "100999"
group: "100999"

23
tasks/firewall.yml Normal file
View File

@ -0,0 +1,23 @@
- name: Root port forwards for web traffic.
firewalld:
rich_rule: "{{ item }}"
zone: public
permanent: true
immediate: true
state: enabled
with_items:
- "rule family=ipv4 forward-port port=80 protocol=tcp to-port=8080"
- "rule family=ipv4 forward-port port=443 protocol=tcp to-port=4443"
firewalld:
rich_rule: "{{ item }}"
zone: trusted
permanent: true
immediate: true
state: enabled
with_items:
- "rule family=ipv4 forward-port port=80 protocol=tcp to-port=8080"
- "rule family=ipv4 forward-port port=443 protocol=tcp to-port=4443"
- command:
cmd: "firewall-cmd --reload"

8
tasks/include-vars.yml Normal file
View File

@ -0,0 +1,8 @@
---
- name: Load a variable file based on the OS type, or a default if not found.
include_vars: "{{ item }}"
with_first_found:
- "{{ ansible_distribution }}-{{ ansible_distribution_version }}.yml"
- "{{ ansible_distribution }}.yml"
- "{{ ansible_os_family }}.yml"
- "default.yml"

25
tasks/main.yml Normal file
View File

@ -0,0 +1,25 @@
---
# tasks file for podman_nextcloud
- import_tasks: include-vars.yml
#- import_tasks: packages.yml
- import_tasks: firewall.yml
when: '"molecule" not in group_names'
- name: Parse passwd
getent:
database: passwd
- block:
- include_tasks: files.yml
with_items:
- "{{ service_users }}"
loop_control:
loop_var: "user"
- include_tasks: containers.yml
with_items:
- "{{ service_users }}"
loop_control:
loop_var: "user"
when: '"nextcloud" in user.services'

18
tasks/packages.yml Normal file
View File

@ -0,0 +1,18 @@
- name: RPM fetch
get_url:
url: https://github.com/smallstep/cli/releases/download/v0.28.2/step-cli_amd64.rpm
checksum: sha256:https://github.com/smallstep/cli/releases/download/v0.28.2/checksums.txt
dest: /tmp/
register: client_rpm
- name: RPM State present
dnf:
name: "{{ client_rpm.dest }}"
state: present
disable_gpg_check: True
when: '"OK" in client_rpm.msg'
- name: Required Host Packages State latest
dnf:
name: openssl
state: latest