Skip to content

Commit

Permalink
v11y-walker-v3
Browse files Browse the repository at this point in the history
Signed-off-by: desmax74 <[email protected]>
  • Loading branch information
desmax74 committed Sep 25, 2024
1 parent f6673a2 commit 95a97be
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 1 deletion.
38 changes: 38 additions & 0 deletions roles/tpa_single_node/tasks/install_manifest_cronjob.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
- name: Set location of Podman Play Manifest
ansible.builtin.set_fact:
kube_play_file: >-
{{ tpa_single_node_kube_manifest_dir + '/' + podman_spec.kube_file_content.metadata.namespace + '_'
+ podman_spec.kube_file_content.metadata.name + '.yml' }}
- name: Copy Manifest to Server
ansible.builtin.copy:
content: "{{ podman_spec.kube_file_content | to_nice_yaml(indent=2) }}"
dest: "{{ kube_play_file }}"
mode: "0600"
register: copy_manifest

- name: Copy Systemd file to Server
ansible.builtin.template:
src: systemd/systemd-oneshot-cm.j2
dest: "{{ tpa_single_node_systemd_directory + '/' + podman_spec.systemd_file }}.service"
mode: "0600"
when: podman_spec.configmap is defined
register: copy_systemd_file

- name: Copy Systemd file to Server
ansible.builtin.template:
src: systemd/systemd-cronjob-nocm.j2
dest: "{{ tpa_single_node_systemd_directory + '/' + podman_spec.systemd_file }}.service"
mode: "0600"
when: podman_spec.configmap is not defined
register: copy_systemd_file

- name: Restart Podman Service
ansible.builtin.systemd:
state: started
enabled: true
daemon_reload: false
name: "{{ podman_spec.systemd_file }}"
no_block: true
when: copy_manifest.changed or copy_systemd_file.changed
2 changes: 1 addition & 1 deletion roles/tpa_single_node/tasks/v11y/walker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
state: present

- name: Deploy v11walker Pod
ansible.builtin.include_tasks: install_manifest.yml
ansible.builtin.include_tasks: install_manifest_cronjob.yml
vars:
podman_spec:
state: stopped
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ spec:
labels:
app: v11y-walker
spec:
restartPolicy: Never
initContainers:
- name: git-fetch
image: "{{ tpa_single_node_trustification_image }}"
Expand Down
16 changes: 16 additions & 0 deletions roles/tpa_single_node/templates/systemd/systemd-cronjob-cm.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[Unit]
Description=" Cronjob {{ podman_spec.systemd_file}}" systemd container
Documentation=man:podman-kube-play(1)
Wants=network-online.target
After=network-online.target
RequiresMountsFor=%t/containers

[Service]
Type=notify
Environment=PODMAN_SYSTEMD_UNIT=%n
TimeoutStartSec=600

ExecStart=/usr/bin/podman kube play --replace --service-container=true "{{ kube_play_file }}" --network "{{ podman_spec.network | default('podman') }}" --configmap "{{ podman_spec.configmap | default(omit) }}"

[Install]
WantedBy=default.target
16 changes: 16 additions & 0 deletions roles/tpa_single_node/templates/systemd/systemd-cronjob-nocm.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[Unit]
Description="Cronjob {{ podman_spec.systemd_file}}" systemd container
Documentation=man:podman-kube-play(1)
Wants=network-online.target
After=network-online.target
RequiresMountsFor=%t/containers

[Service]
Type=notify
Environment=PODMAN_SYSTEMD_UNIT=%n
TimeoutStartSec=600

ExecStart=/usr/bin/podman kube play --replace --service-container=true "{{ kube_play_file }}" --network "{{ podman_spec.network | default('podman') }}"

[Install]
WantedBy=default.target

0 comments on commit 95a97be

Please sign in to comment.