Welcome to the “service_status” role documentation.
Molecule is being used to test the “service_status” role. The following section highlights the drivers in service and provides an example playbook showing how the role is leveraged.
driver:
name: docker
log: true
platforms:
- capabilities:
- SYS_ADMIN
command: /sbin/init
easy_install:
- pip
environment:
http_proxy: '{{ lookup(''env'', ''http_proxy'') }}'
https_proxy: '{{ lookup(''env'', ''https_proxy'') }}'
hostname: centos7
image: centos:7
name: centos7
pkg_extras: python-setuptools python-enum34 python-netaddr ruby epel-release PyYAML
privileged: true
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /sys/fs/cgroup:/sys/fs/cgroup:ro
- capabilities:
- SYS_ADMIN
command: /sbin/init
environment:
http_proxy: '{{ lookup(''env'', ''http_proxy'') }}'
https_proxy: '{{ lookup(''env'', ''https_proxy'') }}'
hostname: centos8
image: centos:8
name: centos8
pkg_extras: python*-setuptools python*-enum34 python*-netaddr ruby python*-PyYAML
python*-libselinux
privileged: true
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /sys/fs/cgroup:/sys/fs/cgroup:ro
provisioner:
env:
ANSIBLE_LIBRARY: ../../../../library
ANSIBLE_STDOUT_CALLBACK: yaml
log: true
name: ansible
scenario:
test_sequence:
- destroy
- create
- prepare
- converge
- verify
- destroy
verifier:
name: testinfra
- become: true
gather_facts: false
hosts: all
name: Converge
tasks:
- include_role:
name: service_status
tasks_from: containers.yaml
name: Check containers - docker version, no service
- block:
- name: Activate docker service
service:
enabled: true
name: docker
state: started
- block:
- include_role:
name: service_status
tasks_from: containers.yaml
name: Run check
name: Catch failure
rescue:
- meta: clear_host_errors
name: Clear host errors
- debug:
msg: 'Success finding broken containers
'
name: Test output
- meta: end_play
name: End play
name: Check containers - docker version, with service
- fail:
msg: 'Did not find broken containers
'
name: Fail if this point is reached
driver:
name: docker
log: true
platforms:
- command: /sbin/init
easy_install:
- pip
environment:
http_proxy: '{{ lookup(''env'', ''http_proxy'') }}'
https_proxy: '{{ lookup(''env'', ''https_proxy'') }}'
hostname: centos7
image: centos:7
name: centos7
pkg_extras: python-setuptools python-enum34 python-netaddr ruby epel-release PyYAML
volumes:
- /etc/ci/mirror_info.sh:/etc/ci/mirror_info.sh:ro
- command: /sbin/init
environment:
http_proxy: '{{ lookup(''env'', ''http_proxy'') }}'
https_proxy: '{{ lookup(''env'', ''https_proxy'') }}'
hostname: centos8
image: centos:8
name: centos8
pkg_extras: python*-setuptools python*-enum34 python*-netaddr ruby python*-PyYAML
volumes:
- /etc/ci/mirror_info.sh:/etc/ci/mirror_info.sh:ro
provisioner:
env:
ANSIBLE_LIBRARY: ../../../../library
ANSIBLE_STDOUT_CALLBACK: yaml
log: true
name: ansible
scenario:
test_sequence:
- destroy
- create
- prepare
- converge
- verify
- destroy
verifier:
name: testinfra
- gather_facts: false
hosts: all
name: Converge
tasks:
- block:
- include_role:
name: service_status
tasks_from: containers.yaml
name: Detect failed podman containers
name: Check podman container state
rescue:
- meta: clear_host_errors
name: Clear host errors
- debug:
msg: 'Properly detected failed container
'
name: Test output
- meta: end_play
name: End play now
- fail:
msg: 'Did not detect failed container
'
name: Fail if we get to this point
vars:
service_status_podman_opt: --storage-driver=vfs
driver:
name: docker
log: true
platforms:
- command: /sbin/init
easy_install:
- pip
environment:
http_proxy: '{{ lookup(''env'', ''http_proxy'') }}'
https_proxy: '{{ lookup(''env'', ''https_proxy'') }}'
hostname: centos7
image: centos:7
name: centos7
pkg_extras: python-setuptools python-enum34 python-netaddr ruby epel-release PyYAML
volumes:
- /etc/ci/mirror_info.sh:/etc/ci/mirror_info.sh:ro
- command: /sbin/init
environment:
http_proxy: '{{ lookup(''env'', ''http_proxy'') }}'
https_proxy: '{{ lookup(''env'', ''https_proxy'') }}'
hostname: centos8
image: centos:8
name: centos8
pkg_extras: python*-setuptools python*-enum34 python*-netaddr ruby python*-PyYAML
volumes:
- /etc/ci/mirror_info.sh:/etc/ci/mirror_info.sh:ro
provisioner:
env:
ANSIBLE_LIBRARY: ../../../../library
ANSIBLE_STDOUT_CALLBACK: yaml
log: true
name: ansible
scenario:
test_sequence:
- destroy
- create
- prepare
- converge
- verify
- destroy
verifier:
name: testinfra
- gather_facts: false
hosts: all
name: Converge
tasks:
- block:
- include_role:
name: service_status
tasks_from: systemd.yaml
name: Run validation
name: Check service
rescue:
- meta: clear_host_errors
name: Clear errors
- debug:
msg: 'Successfully detected failed unit
'
name: Test output
- meta: end_play
name: End play
- fail:
msg: 'Did not detect failed unit
'
name: Fail if this point is reached
driver:
name: docker
log: true
platforms:
- command: /sbin/init
easy_install:
- pip
environment:
http_proxy: '{{ lookup(''env'', ''http_proxy'') }}'
https_proxy: '{{ lookup(''env'', ''https_proxy'') }}'
hostname: centos7
image: centos:7
name: centos7
pkg_extras: python-setuptools python-enum34 python-netaddr ruby epel-release PyYAML
volumes:
- /etc/ci/mirror_info.sh:/etc/ci/mirror_info.sh:ro
- command: /sbin/init
environment:
http_proxy: '{{ lookup(''env'', ''http_proxy'') }}'
https_proxy: '{{ lookup(''env'', ''https_proxy'') }}'
hostname: centos8
image: centos:8
name: centos8
pkg_extras: python*-setuptools python*-enum34 python*-netaddr ruby python*-PyYAML
volumes:
- /etc/ci/mirror_info.sh:/etc/ci/mirror_info.sh:ro
provisioner:
env:
ANSIBLE_LIBRARY: ../../../../library
ANSIBLE_STDOUT_CALLBACK: yaml
log: true
name: ansible
scenario:
test_sequence:
- destroy
- create
- prepare
- converge
- verify
- destroy
verifier:
name: testinfra
- gather_facts: false
hosts: all
name: Converge
tasks:
- include_role:
name: service_status
name: Full check with defaults
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.