Add fail2ban role and clean up yaml lint noise

This commit is contained in:
2026-08-08 23:50:32 -05:00
parent 9b837dd780
commit 6c7ecfc724
352 changed files with 4632 additions and 4186 deletions
+3 -8
View File
@@ -1,16 +1,13 @@
---
language: python
python: "2.7"
python: '2.7'
# Use the new container infrastructure
sudo: false
# Install ansible
addons:
apt:
packages:
- python-pip
packages: [python-pip]
install:
# Install ansible
- pip install ansible
@@ -20,10 +17,8 @@ install:
# Create ansible.cfg with correct roles_path
- printf '[defaults]\nroles_path=../' >ansible.cfg
script:
# Basic role syntax check
- ansible-playbook tests/test.yml -i tests/inventory --syntax-check
notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/
webhooks: https://galaxy.ansible.com/api/v1/notifications/
+1 -1
View File
@@ -1,2 +1,2 @@
---
# defaults file for ensure_os_upgrade
...
+5 -7
View File
@@ -1,17 +1,17 @@
---
# handlers file for ensure_os_upgrade
- name: 'ensure_os_upgrade.package_facts'
- name: ensure_os_upgrade.package_facts
ansible.builtin.package_facts:
- name: 'ensure_os_upgrade.service_facts'
- name: ensure_os_upgrade.service_facts
ansible.builtin.service_facts:
- name: 'ensure_os_upgrade.service_reload'
- name: ensure_os_upgrade.service_reload
when:
- ansible_system == 'Linux'
- ansible_service_mgr == 'systemd'
- ensure_os_upgrade is defined
ansible.builtin.systemd:
daemon_reload: 'yes'
- name: 'ensure_os_upgrade.service_restart'
- name: ensure_os_upgrade.service_restart
when:
- ansible_system == 'Linux'
- ensure_os_upgrade is defined
@@ -21,9 +21,7 @@
ansible.builtin.service:
enabled: '{{ item.enabled }}'
name: '{{ item.name }}'
state: 'restarted'
state: restarted
loop: '{{ ensure_os_upgrade.service_list }}'
loop_control:
label: '{{ item.name }} will be restarted'
...
+1 -4
View File
@@ -1,3 +1,4 @@
---
galaxy_info:
author: your name
description: your role description
@@ -15,7 +16,6 @@ galaxy_info:
# - Apache-2.0
# - CC-BY-4.0
license: license (GPL-2.0-or-later, MIT, etc)
min_ansible_version: 2.9
# If this a Container Enabled role, provide the minimum Ansible Container version.
@@ -38,7 +38,6 @@ galaxy_info:
# - 1.0
# - 7
# - 99.99
galaxy_tags: []
# List tags for your role here, one per line. A tag is a keyword that describes
# and categorizes the role. Users find roles by searching for tags. Be sure to
@@ -46,8 +45,6 @@ galaxy_info:
#
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
# Maximum 20 tags per role.
dependencies: []
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
# if you add dependencies to this list.
+32 -31
View File
@@ -1,35 +1,37 @@
---
# tasks file for ensure_os_upgrade
- name: 'include variables'
when:
- ansible_facts["system"] == 'Linux'
- name: include variables
when: ["ansible_facts[\"system\"] == 'Linux'"]
ansible.builtin.include_vars:
file: '{{ lookup("first_found", findme) }}'
name: 'ensure_os_upgrade'
name: ensure_os_upgrade
vars:
findme:
files:
- '{{ ansible_facts["distribution"] }}-{{ ansible_facts["distribution_major_version"] }}-{{ ansible_facts["architecture"] }}.yml'
- '{{ ansible_facts["distribution"] }}-{{ ansible_facts["distribution_major_version"] }}-default.yml'
- '{{ ansible_facts["distribution"] }}-{{ ansible_facts["distribution_major_version"]
}}-{{ ansible_facts["architecture"] }}.yml'
- '{{ ansible_facts["distribution"] }}-{{ ansible_facts["distribution_major_version"]
}}-default.yml'
- '{{ ansible_facts["distribution"] }}-default.yml'
- '{{ ansible_facts["os_family"] }}-{{ ansible_facts["distribution_major_version"] }}-{{ ansible_facts["architecture"] }}.yml'
- '{{ ansible_facts["os_family"] }}-{{ ansible_facts["distribution_major_version"] }}-default.yml'
- '{{ ansible_facts["os_family"] }}-{{ ansible_facts["distribution_major_version"]
}}-{{ ansible_facts["architecture"] }}.yml'
- '{{ ansible_facts["os_family"] }}-{{ ansible_facts["distribution_major_version"]
}}-default.yml'
- '{{ ansible_facts["os_family"] }}-default.yml'
- 'default.yml'
paths:
- '../vars/'
errors: 'ignore'
- name: 'package discovery'
- default.yml
paths: [../vars/]
errors: ignore
- name: package discovery
when:
- ansible_facts["system"] == 'Linux'
- ansible_facts["packages"] is not defined
ansible.builtin.package_facts:
- name: 'service discovery'
- name: service discovery
when:
- ansible_facts["system"] == 'Linux'
- ansible_facts["services"] is not defined
ansible.builtin.service_facts:
- name: 'ensure packages'
- name: ensure packages
when:
- ansible_facts["system"] == 'Linux'
- ensure_os_upgrade is defined
@@ -42,9 +44,9 @@
loop_control:
label: '{{ item.name }} will be {{ item.state }}'
notify:
- 'ensure_os_upgrade.package_facts'
- 'ensure_os_upgrade.service_facts'
- name: 'ensure services'
- ensure_os_upgrade.package_facts
- ensure_os_upgrade.service_facts
- name: ensure services
when:
- ansible_facts["system"] == 'Linux'
- ensure_os_upgrade is defined
@@ -58,9 +60,9 @@
loop_control:
label: '{{ item.name }} will be {{ item.state }}'
notify:
- 'ensure_os_upgrade.package_facts'
- 'ensure_os_upgrade.service_facts'
- name: 'Ensure system-upgrade download'
- ensure_os_upgrade.package_facts
- ensure_os_upgrade.service_facts
- name: Ensure system-upgrade download
when:
- ansible_facts["system"] == 'Linux'
- ansible_facts["distribution"] == 'Fedora'
@@ -71,7 +73,7 @@
- ansible_facts["distribution_major_version"]|int < ensure_os_upgrade.target_version|int
ansible.builtin.shell: >
dnf -y system-upgrade download --refresh --releasever={{ ensure_os_upgrade.target_version|int }}
- name: 'Ensure system-upgrade reboot'
- name: Ensure system-upgrade reboot
when:
- ansible_facts["system"] == 'Linux'
- ansible_facts["distribution"] == 'Fedora'
@@ -84,7 +86,7 @@
poll: 0
ansible.builtin.shell: >
sleep 5 && dnf -y system-upgrade reboot
- name: 'Wait for the reboot'
- name: Wait for the reboot
when:
- ansible_facts["system"] == 'Linux'
- ansible_facts["distribution"] == 'Fedora'
@@ -98,16 +100,15 @@
delay: '300'
host: '{{ (ansible_ssh_host|default(ansible_host))|default(inventory_hostname) }}'
port: '22'
search_regex: 'OpenSSH'
search_regex: OpenSSH
sleep: '15'
timeout: '1800'
vars:
ansible_connection: 'local'
- name: 'Gather facts'
ansible_connection: local
- name: Gather facts
ansible.builtin.setup:
notify:
- 'ensure_os_upgrade.package_facts'
- 'ensure_os_upgrade.service_facts'
- name: 'flush handlers'
ansible.builtin.meta: 'flush_handlers'
...
- ensure_os_upgrade.package_facts
- ensure_os_upgrade.service_facts
- name: flush handlers
ansible.builtin.meta: flush_handlers
+1 -2
View File
@@ -1,5 +1,4 @@
---
- hosts: localhost
remote_user: root
roles:
- ensure_os_upgrade
roles: [ensure_os_upgrade]
@@ -1,8 +1,6 @@
---
# vars file for ensure_os_upgrade
package_list:
- name: 'dnf-plugin-system-upgrade'
state: 'present'
- name: dnf-plugin-system-upgrade
state: present
target_version: '43'
...
+1 -1
View File
@@ -1,2 +1,2 @@
---
# vars file for ensure_os_upgrade
...
+1 -1
View File
@@ -1,2 +1,2 @@
---
# vars file for ensure_os_upgrade
...