From 125a2823d2805fe817ccfab0dcbe85a38b599f6c Mon Sep 17 00:00:00 2001 From: L3D Date: Tue, 22 Nov 2022 17:28:41 +0100 Subject: [PATCH 1/2] Delete actions that dont work with systemd --- .github/workflows/ansible-archlinux-latest.yml | 18 ------------------ .github/workflows/ansible-centos-centos7.yml | 18 ------------------ .github/workflows/ansible-centos-centos8.yml | 18 ------------------ .github/workflows/ansible-centos-latest.yml | 18 ------------------ .github/workflows/ansible-debian-bullseye.yml | 18 ------------------ .github/workflows/ansible-debian-buster.yml | 18 ------------------ .github/workflows/ansible-debian-latest.yml | 18 ------------------ .github/workflows/ansible-debian-sid.yml | 18 ------------------ .github/workflows/ansible-debian-stable.yml | 18 ------------------ .github/workflows/ansible-debian-stretch.yml | 18 ------------------ .github/workflows/ansible-fedora-32.yml | 18 ------------------ .github/workflows/ansible-fedora-33.yml | 18 ------------------ .github/workflows/ansible-fedora-latest.yml | 18 ------------------ .github/workflows/ansible-ubuntu-latest.yml | 18 ------------------ 14 files changed, 252 deletions(-) delete mode 100644 .github/workflows/ansible-archlinux-latest.yml delete mode 100644 .github/workflows/ansible-centos-centos7.yml delete mode 100644 .github/workflows/ansible-centos-centos8.yml delete mode 100644 .github/workflows/ansible-centos-latest.yml delete mode 100644 .github/workflows/ansible-debian-bullseye.yml delete mode 100644 .github/workflows/ansible-debian-buster.yml delete mode 100644 .github/workflows/ansible-debian-latest.yml delete mode 100644 .github/workflows/ansible-debian-sid.yml delete mode 100644 .github/workflows/ansible-debian-stable.yml delete mode 100644 .github/workflows/ansible-debian-stretch.yml delete mode 100644 .github/workflows/ansible-fedora-32.yml delete mode 100644 .github/workflows/ansible-fedora-33.yml delete mode 100644 .github/workflows/ansible-fedora-latest.yml delete mode 100644 .github/workflows/ansible-ubuntu-latest.yml diff --git a/.github/workflows/ansible-archlinux-latest.yml b/.github/workflows/ansible-archlinux-latest.yml deleted file mode 100644 index e823f0c..0000000 --- a/.github/workflows/ansible-archlinux-latest.yml +++ /dev/null @@ -1,18 +0,0 @@ ---- -name: Ansible check archlinux:latest - -# yamllint disable-line rule:truthy -on: [push, pull_request] - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: ansible check with archlinux:latest - uses: roles-ansible/check-ansible-archlinux-latest-action@master - with: - targets: "./" diff --git a/.github/workflows/ansible-centos-centos7.yml b/.github/workflows/ansible-centos-centos7.yml deleted file mode 100644 index 401d2c0..0000000 --- a/.github/workflows/ansible-centos-centos7.yml +++ /dev/null @@ -1,18 +0,0 @@ ---- -name: Ansible check centos:centos7 - -# yamllint disable-line rule:truthy -on: [push, pull_request] - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: ansible check with ubuntu:centos7 - uses: roles-ansible/check-ansible-centos-centos7-action@master - with: - targets: "./" diff --git a/.github/workflows/ansible-centos-centos8.yml b/.github/workflows/ansible-centos-centos8.yml deleted file mode 100644 index f20097b..0000000 --- a/.github/workflows/ansible-centos-centos8.yml +++ /dev/null @@ -1,18 +0,0 @@ ---- -name: Ansible check centos:centos8 - -# yamllint disable-line rule:truthy -on: [push, pull_request] - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: ansible check with ubuntu:centos8 - uses: roles-ansible/check-ansible-centos-centos8-action@master - with: - targets: "./" diff --git a/.github/workflows/ansible-centos-latest.yml b/.github/workflows/ansible-centos-latest.yml deleted file mode 100644 index 94eb54b..0000000 --- a/.github/workflows/ansible-centos-latest.yml +++ /dev/null @@ -1,18 +0,0 @@ ---- -name: Ansible check centos:latest - -# yamllint disable-line rule:truthy -on: [push, pull_request] - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: ansible check with ubuntu:latest - uses: roles-ansible/check-ansible-centos-latest-action@master - with: - targets: "./" diff --git a/.github/workflows/ansible-debian-bullseye.yml b/.github/workflows/ansible-debian-bullseye.yml deleted file mode 100644 index 4b7c45d..0000000 --- a/.github/workflows/ansible-debian-bullseye.yml +++ /dev/null @@ -1,18 +0,0 @@ ---- -name: Ansible check debian:bullseye - -# yamllint disable-line rule:truthy -on: [push, pull_request] - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: ansible check with debian:bullseye - uses: roles-ansible/check-ansible-debian-bullseye-action@main - with: - targets: "./" diff --git a/.github/workflows/ansible-debian-buster.yml b/.github/workflows/ansible-debian-buster.yml deleted file mode 100644 index d76b02c..0000000 --- a/.github/workflows/ansible-debian-buster.yml +++ /dev/null @@ -1,18 +0,0 @@ ---- -name: Ansible check debian:buster - -# yamllint disable-line rule:truthy -on: [push, pull_request] - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: ansible check with debian:buster - uses: roles-ansible/check-ansible-debian-buster-action@master - with: - targets: "./" diff --git a/.github/workflows/ansible-debian-latest.yml b/.github/workflows/ansible-debian-latest.yml deleted file mode 100644 index f7eb5b6..0000000 --- a/.github/workflows/ansible-debian-latest.yml +++ /dev/null @@ -1,18 +0,0 @@ ---- -name: Ansible check debian:latest - -# yamllint disable-line rule:truthy -on: [push, pull_request] - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: ansible check with debian:latest - uses: roles-ansible/check-ansible-debian-latest-action@master - with: - targets: "./" diff --git a/.github/workflows/ansible-debian-sid.yml b/.github/workflows/ansible-debian-sid.yml deleted file mode 100644 index 2e3215a..0000000 --- a/.github/workflows/ansible-debian-sid.yml +++ /dev/null @@ -1,18 +0,0 @@ ---- -name: Ansible check debian:sid - -# yamllint disable-line rule:truthy -on: [push, pull_request] - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: ansible check with debian:sid - uses: roles-ansible/check-ansible-debian-sid-action@master - with: - targets: "./" diff --git a/.github/workflows/ansible-debian-stable.yml b/.github/workflows/ansible-debian-stable.yml deleted file mode 100644 index e47f773..0000000 --- a/.github/workflows/ansible-debian-stable.yml +++ /dev/null @@ -1,18 +0,0 @@ ---- -name: Ansible check debian:stable - -# yamllint disable-line rule:truthy -on: [push, pull_request] - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: ansible check with debian:stable - uses: roles-ansible/check-ansible-debian-stable-action@master - with: - targets: "./" diff --git a/.github/workflows/ansible-debian-stretch.yml b/.github/workflows/ansible-debian-stretch.yml deleted file mode 100644 index c947cae..0000000 --- a/.github/workflows/ansible-debian-stretch.yml +++ /dev/null @@ -1,18 +0,0 @@ ---- -name: Ansible check debian:stretch - -# yamllint disable-line rule:truthy -on: [push, pull_request] - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: ansible check with debian:stretch - uses: roles-ansible/check-ansible-debian-stretch-action@master - with: - targets: "./" diff --git a/.github/workflows/ansible-fedora-32.yml b/.github/workflows/ansible-fedora-32.yml deleted file mode 100644 index e362dd4..0000000 --- a/.github/workflows/ansible-fedora-32.yml +++ /dev/null @@ -1,18 +0,0 @@ ---- -name: Ansible check fedora:32 - -# yamllint disable-line rule:truthy -on: [push, pull_request] - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: ansible check with fedora:32 - uses: roles-ansible/check-ansible-fedora-32-action@master - with: - targets: "./" diff --git a/.github/workflows/ansible-fedora-33.yml b/.github/workflows/ansible-fedora-33.yml deleted file mode 100644 index 70c52ad..0000000 --- a/.github/workflows/ansible-fedora-33.yml +++ /dev/null @@ -1,18 +0,0 @@ ---- -name: Ansible check fedora:33 - -# yamllint disable-line rule:truthy -on: [push, pull_request] - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: ansible check with fedora:33 - uses: roles-ansible/check-ansible-fedora-33-action@master - with: - targets: "./" diff --git a/.github/workflows/ansible-fedora-latest.yml b/.github/workflows/ansible-fedora-latest.yml deleted file mode 100644 index 7cfbdf7..0000000 --- a/.github/workflows/ansible-fedora-latest.yml +++ /dev/null @@ -1,18 +0,0 @@ ---- -name: Ansible check fedora:latest - -# yamllint disable-line rule:truthy -on: [push, pull_request] - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: ansible check with fedora:latest - uses: roles-ansible/check-ansible-fedora-latest-action@master - with: - targets: "./" diff --git a/.github/workflows/ansible-ubuntu-latest.yml b/.github/workflows/ansible-ubuntu-latest.yml deleted file mode 100644 index b9544a5..0000000 --- a/.github/workflows/ansible-ubuntu-latest.yml +++ /dev/null @@ -1,18 +0,0 @@ ---- -name: Ansible check ubuntu:latest - -# yamllint disable-line rule:truthy -on: [push, pull_request] - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: ansible check with ubuntu:latest - uses: roles-ansible/check-ansible-ubuntu-latest-action@master - with: - targets: "./" From b8c301413decd68f5bb285fd688632046a9980cb Mon Sep 17 00:00:00 2001 From: L3D Date: Tue, 22 Nov 2022 17:43:34 +0100 Subject: [PATCH 2/2] improve systemd workflow --- handlers/main.yml | 6 ++++-- templates/ping_exporter.service.j2 | 6 +++++- vars/main.yml | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/handlers/main.yml b/handlers/main.yml index 338c366..4f2ae4c 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -1,4 +1,6 @@ --- - name: Systemctl restart ping_exporter.service - ansible.builtin.debug: - msg: "in progress..." + become: true + ansible.builtin.systemd: + name: 'ping_exporter.service' + state: 'restarted' diff --git a/templates/ping_exporter.service.j2 b/templates/ping_exporter.service.j2 index 53027b7..cd618bd 100644 --- a/templates/ping_exporter.service.j2 +++ b/templates/ping_exporter.service.j2 @@ -1,11 +1,15 @@ -# {{ ansible_managed }} +{{ ansible_managed | comment }} [Unit] Description=Execute the ping_exporter server. [Service] +Type=simple WorkingDirectory={{ ping_exporter__user_home }} +User={{ ping_exporter__user }} +Group={{ ping_exporter__group }} ExecStart=/usr/bin/ping_exporter --config.path {{ ping_exporter__user_home }}/ping_exporter_config.yml +AmbientCapabilities=CAP_NET_RAW [Install] WantedBy=multi-user.target diff --git a/vars/main.yml b/vars/main.yml index c67b361..bee4dc1 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -3,5 +3,5 @@ ping_exporter__repo: 'https://github.com/czerwonk/ping_exporter.git' ping_exporter__repo_api: 'https://api.github.com/repos/czerwonk/ping_exporter/releases/latest' # versionscheck -playbook_version_number: 03 # should be a integer +playbook_version_number: 04 # should be a integer playbook_version_path: 'do1jlr.prometheus_ping_exporter.version'