From 5f62d66005f8939b5cbfd485e2cad813be589646 Mon Sep 17 00:00:00 2001 From: Gilles Mouchet Date: Sat, 29 Jun 2024 16:13:22 +0200 Subject: [PATCH] add somes gmotools --- files/updhosts/update-hosts.cron | 1 + main.yml | 2 +- update-hosts-file.yml | 17 +++++++++++++++++ yum-check-update.yml | 11 ++++++++--- 4 files changed, 27 insertions(+), 4 deletions(-) create mode 100644 files/updhosts/update-hosts.cron create mode 100644 update-hosts-file.yml diff --git a/files/updhosts/update-hosts.cron b/files/updhosts/update-hosts.cron new file mode 100644 index 0000000..a3076a7 --- /dev/null +++ b/files/updhosts/update-hosts.cron @@ -0,0 +1 @@ +*/5 * * * * root /usr/local/bin/gmotools/update-hosts.sh > /dev/null 2>&1 \ No newline at end of file diff --git a/main.yml b/main.yml index 37b218b..b12e04a 100644 --- a/main.yml +++ b/main.yml @@ -29,7 +29,7 @@ name: role-postfix - include_tasks: yum-check-update.yml - + - include_tasks: update-hosts-file.yml - name: import netdata role import_role: name: role-netdata diff --git a/update-hosts-file.yml b/update-hosts-file.yml new file mode 100644 index 0000000..4aa0395 --- /dev/null +++ b/update-hosts-file.yml @@ -0,0 +1,17 @@ +--- +- name: create destination folder + file: + path: /usr/local/bin/gmotools + state: directory + +- name: copy script to folder + copy: + src: /tmp/hostsupd/update-hosts.sh + dest: /usr/local/bin/gmotools/update-hosts.sh + mode: 0750 + remote_src: yes + +- name: copy cron file + copy: + src: updhosts/update-hosts.cron + dest: /etc/cron.d/update-hosts.cron \ No newline at end of file diff --git a/yum-check-update.yml b/yum-check-update.yml index 7ef4c04..2d2bc0e 100644 --- a/yum-check-update.yml +++ b/yum-check-update.yml @@ -1,12 +1,17 @@ --- +- name: create destination folder + file: + path: /usr/local/bin/gmotools + state: directory + - name: get check-yum-update copy: src: /tmp/yumupd/check-yum-updates.sh - dest: /usr/local/bin/check-yum-updates.sh + dest: /usr/local/bin/gmotools/check-yum-updates.sh mode: 0755 - name: create link crontab daily file: - src: /usr/local/bin/check-yum-updates.sh - dest: /etc/cron.daily/check-yum-updates.sh + src: /usr/local/bin/gmotools/check-yum-updates.sh + dest: /etc/cron.daily/check-yum-updates state: link