Remove patchman_client role and install playbook
Patchman has been uninstalled from all servers and patch.ki5bhv.com taken out of the inventory. Keep patchman-remove.yaml for cleanup. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
4aeb08ab1f
commit
5752e877cb
8 files changed
+3
-1338
No files matched your search
@@ -1,8 +0,0 @@
|
|||||||
---
|
|
||||||
# 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
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
# Removes patchman-client from every Ubuntu server: undoes patchman-client.yaml
|
# Removes patchman-client from every Ubuntu server (undoes the old
|
||||||
# (roles/patchman_client). Leaves curl, jq and cron installed since other
|
# patchman_client role, removed from this repo). Leaves curl, jq and cron
|
||||||
# things use them. Hosts stay listed on the Patchman server until deleted there.
|
# installed since other things use them.
|
||||||
- name: Remove patchman-client
|
- name: Remove patchman-client
|
||||||
hosts: ubuntu_servers
|
hosts: ubuntu_servers
|
||||||
become: true
|
become: true
|
||||||
|
|||||||
@@ -1,23 +0,0 @@
|
|||||||
---
|
|
||||||
# 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
|
|
||||||
File diff suppressed because it is too large.
Load diff
@@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
- name: Send patchman report
|
|
||||||
ansible.builtin.command: /usr/sbin/patchman-client
|
|
||||||
changed_when: true
|
|
||||||
when: patchman_report_on_change | bool
|
|
||||||
@@ -1,54 +0,0 @@
|
|||||||
---
|
|
||||||
- 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
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
# {{ 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 %}
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
# {{ 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
|
|
||||||
Reference in new issue
Block a user