Compare commits
3
Commits
891549d3fe
...
6d5f532b2b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6d5f532b2b | ||
|
|
fcaa1e9204 | ||
|
|
7c3b5fc054 |
No files matched your search
+34
@@ -0,0 +1,34 @@
|
|||||||
|
# Edit this file to introduce tasks to be run by cron.
|
||||||
|
#
|
||||||
|
# Each task to run has to be defined through a single line
|
||||||
|
# indicating with different fields when the task will be run
|
||||||
|
# and what command to run for the task
|
||||||
|
#
|
||||||
|
# To define the time you can provide concrete values for
|
||||||
|
# minute (m), hour (h), day of month (dom), month (mon),
|
||||||
|
# and day of week (dow) or use '*' in these fields (for 'any').
|
||||||
|
#
|
||||||
|
# Notice that tasks will be started based on the cron's system
|
||||||
|
# daemon's notion of time and timezones.
|
||||||
|
#
|
||||||
|
# Output of the crontab jobs (including errors) is sent through
|
||||||
|
# email to the user the crontab file belongs to (unless redirected).
|
||||||
|
#
|
||||||
|
# For example, you can run a backup of all your user accounts
|
||||||
|
# at 5 a.m every week with:
|
||||||
|
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
|
||||||
|
#
|
||||||
|
# For more information see the manual pages of crontab(5) and cron(8)
|
||||||
|
#
|
||||||
|
# m h dom mon dow command
|
||||||
|
ANSIBLE_CONFIG=/home/justin/Ansible/ansible.cfg
|
||||||
|
|
||||||
|
#30 * * * * ansible-playbook /home/justin/Ansible/set-time.yaml
|
||||||
|
30 * * * * ansible-playbook /home/justin/Ansible/ubuntu/dns-flush.yaml >> /home/justin/cron-logs/dns-flush.log 2>&1
|
||||||
|
0 5 * * * ansible-playbook /home/justin/Ansible/docker/update-docker-compose.yaml >> /home/justin/cron-logs/update-docker-compose.log 2>&1
|
||||||
|
30 5 * * * ansible-playbook /home/justin/Ansible/docker/restart-qtorrnt.yaml >> /home/justin/cron-logs/restart-qtorrnt.log 2>&1
|
||||||
|
0 6 * * * ansible-playbook /home/justin/Ansible/ubuntu/restart-beszel.yaml >> /home/justin/cron-logs/restart-beszel.log 2>&1
|
||||||
|
#0 2 * * * ansible-playbook /home/justin/Ansible/ubuntu/update.yaml >> /home/justin/cron-logs/update.log 2>&1
|
||||||
|
#0 7 * * * ansible-playbook /home/justin/Ansible/ubuntu/reboot.yaml >> /home/justin/cron-logs/reboot.log 2>&1
|
||||||
|
0 5 * * 2 ansible-playbook /home/justin/Ansible/ubuntu/maint-clean-logs-cache.yaml >> /home/justin/cron-logs/maint-clean-logs-cache.log 2>&1
|
||||||
|
0 0 1,15 * * ansible-playbook /home/justin/Ansible/ubuntu/fix-ssh-host-keys.yaml >> /home/justin/cron-logs/fix-ssh-host-keys.log 2>&1
|
||||||
@@ -7,6 +7,7 @@
|
|||||||
community.docker.docker_compose_v2:
|
community.docker.docker_compose_v2:
|
||||||
project_src: /home/justin/docker/qbits
|
project_src: /home/justin/docker/qbits
|
||||||
pull: always
|
pull: always
|
||||||
|
recreate: auto
|
||||||
register: result
|
register: result
|
||||||
retries: 3
|
retries: 3
|
||||||
delay: 3
|
delay: 3
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
---
|
||||||
|
# Installs patchman-client on every Ubuntu server and enrolls it with the
|
||||||
|
# Patchman server on patch.ki5bhv.com. Role settings: roles/patchman_client/defaults/main.yml
|
||||||
|
- name: Install and enroll patchman-client
|
||||||
|
hosts: ubuntu_servers
|
||||||
|
become: true
|
||||||
|
roles:
|
||||||
|
- patchman_client
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
---
|
||||||
|
# Patchman server URL, including the /patchman path.
|
||||||
|
# Clients must be in a network allowed to upload (192.168.1.0/24 by default).
|
||||||
|
patchman_server_url: "http://192.168.1.8/patchman"
|
||||||
|
|
||||||
|
# Comma or space delimited tags shown on the host in Patchman.
|
||||||
|
patchman_client_tags: "Server"
|
||||||
|
|
||||||
|
# Options passed to curl when uploading.
|
||||||
|
patchman_client_curl_options: "--insecure --connect-timeout 60 --max-time 300"
|
||||||
|
|
||||||
|
# Report protocol: 1 = text, 2 = json (needs jq and, by default, an API key).
|
||||||
|
patchman_client_protocol: 1
|
||||||
|
patchman_client_api_key: ""
|
||||||
|
|
||||||
|
# Daily report schedule. The minute is derived from the hostname so servers
|
||||||
|
# don't all report at the same moment, but stays stable between runs.
|
||||||
|
patchman_cron_enabled: true
|
||||||
|
patchman_cron_hour: "2"
|
||||||
|
patchman_cron_minute: "{{ 59 | random(seed=inventory_hostname) }}"
|
||||||
|
|
||||||
|
# Send a report right away when the client is installed or its config changes.
|
||||||
|
patchman_report_on_change: true
|
||||||
Executable
+1215
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
- name: Send patchman report
|
||||||
|
ansible.builtin.command: /usr/sbin/patchman-client
|
||||||
|
changed_when: true
|
||||||
|
when: patchman_report_on_change | bool
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
---
|
||||||
|
- name: Install client dependencies
|
||||||
|
ansible.builtin.package:
|
||||||
|
name: "{{ ['curl'] + (['jq'] if patchman_client_protocol | int == 2 else []) }}"
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: Install cron
|
||||||
|
ansible.builtin.package:
|
||||||
|
name: "{{ 'cron' if ansible_facts['os_family'] == 'Debian' else 'cronie' }}"
|
||||||
|
state: present
|
||||||
|
when: patchman_cron_enabled | bool
|
||||||
|
|
||||||
|
- name: Install patchman-client script
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: patchman-client
|
||||||
|
dest: /usr/sbin/patchman-client
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: "0755"
|
||||||
|
notify: Send patchman report
|
||||||
|
|
||||||
|
- name: Create /etc/patchman
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: /etc/patchman
|
||||||
|
state: directory
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: "0755"
|
||||||
|
|
||||||
|
- name: Configure patchman-client
|
||||||
|
ansible.builtin.template:
|
||||||
|
src: patchman-client.conf.j2
|
||||||
|
dest: /etc/patchman/patchman-client.conf
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
# keep the file private when it holds an API key
|
||||||
|
mode: "{{ '0600' if patchman_client_api_key else '0644' }}"
|
||||||
|
notify: Send patchman report
|
||||||
|
|
||||||
|
# Writes the whole file so it replaces any hand-made /etc/cron.d/patchman-client
|
||||||
|
- name: Schedule daily patchman report
|
||||||
|
ansible.builtin.template:
|
||||||
|
src: patchman-client.cron.j2
|
||||||
|
dest: /etc/cron.d/patchman-client
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: "0644"
|
||||||
|
when: patchman_cron_enabled | bool
|
||||||
|
|
||||||
|
- name: Remove daily patchman report schedule
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: /etc/cron.d/patchman-client
|
||||||
|
state: absent
|
||||||
|
when: not patchman_cron_enabled | bool
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
# {{ ansible_managed }}
|
||||||
|
|
||||||
|
# Patchman server
|
||||||
|
server={{ patchman_server_url }}
|
||||||
|
|
||||||
|
# Options to curl
|
||||||
|
curl_options="{{ patchman_client_curl_options }}"
|
||||||
|
|
||||||
|
# Comma or space delimited tags to send
|
||||||
|
tags="{{ patchman_client_tags }}"
|
||||||
|
|
||||||
|
# Does the client output a report of the upload (e.g. for cronjob output)
|
||||||
|
report=false
|
||||||
|
|
||||||
|
# Protocol version (1 = text, 2 = json)
|
||||||
|
# Protocol 2 requires jq to be installed
|
||||||
|
protocol={{ patchman_client_protocol }}
|
||||||
|
|
||||||
|
# API key for protocol 2 authentication
|
||||||
|
{% if patchman_client_api_key %}
|
||||||
|
api_key={{ patchman_client_api_key }}
|
||||||
|
{% else %}
|
||||||
|
#api_key=pm_your_api_key_here
|
||||||
|
{% endif %}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
# {{ ansible_managed }}
|
||||||
|
# Send a daily package report to the Patchman server ({{ patchman_server_url }})
|
||||||
|
SHELL=/bin/sh
|
||||||
|
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
||||||
|
|
||||||
|
{{ patchman_cron_minute }} {{ patchman_cron_hour }} * * * root /usr/sbin/patchman-client 2>&1 | logger -t patchman-client
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
---
|
||||||
|
- name: Restart beszel-agent service
|
||||||
|
hosts: ubuntu_servers
|
||||||
|
become: true
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
- name: Restart beszel-agent
|
||||||
|
ansible.builtin.systemd:
|
||||||
|
name: beszel-agent
|
||||||
|
state: restarted
|
||||||
Reference in new issue
Block a user