check_rsyslog¶
About The Role¶
An Ansible role which detects package presence and running service on the target host and fails if it doesn’t find it.
Requirements¶
No requirements.
Dependencies¶
No dependencies.
Example Playbook¶
- hosts: localhost
  gather_facts: true
  roles:
    - check_rsyslog
License¶
Apache
Full Description¶
Role Documentation¶
Welcome to the ‘check_rsyslog’ role documentation.
Molecule Scenarios¶
Molecule is being used to test the ‘check_rsyslog’ role. The following section highlights the drivers in service and provides an example playbook showing how the role is leveraged.
- Driver: podman:
 
Scenario: default¶
Molecule Platform(s)¶
- name: centos
  hostname: centos
  image: centos/centos:stream8
  registry:
    url: quay.io
  dockerfile: ../../../../../.config/molecule/Dockerfile
  pkg_extras: python*-setuptools python*-pyyaml
  volumes:
  - /etc/ci/mirror_info.sh:/etc/ci/mirror_info.sh:ro
  privileged: true
  environment:
    http_proxy: "{{ lookup('env', 'http_proxy') }}"
    https_proxy: "{{ lookup('env', 'https_proxy') }}"
  ulimits:
  - host
  command: /sbin/init
Molecule Inventory¶
hosts:
  all:
    hosts:
      centos:
        ansible_python_interpreter: /usr/bin/python3
Example default playbook¶
- name: Converge
  hosts: all
  gather_facts: false
  tasks:
  - block:
    - include_role:
        name: check_rsyslog
        tasks_from: yum.yaml
    rescue:
    - debug:
        msg: Lack of rsyslog package detected!
  - name: Install rsyslog package
    yum:
      name: rsyslog
  - block:
    - include_role:
        name: check_rsyslog
        tasks_from: yum.yaml
  - block:
    - include_role:
        name: check_rsyslog
        tasks_from: systemctl.yaml
    rescue:
    - debug:
        msg: Inactivity of the rsyslog service detected!
  - name: Enable rsyslog service
    systemd:
      name: rsyslog.service
      state: started
  - block:
    - include_role:
        name: check_rsyslog
        tasks_from: systemctl.yaml
  - block:
    - include_role:
        name: check_rsyslog