Skip to content

Commit 4b6ee74

Browse files
committed
Add systemd timer for periodic inspector
1 parent 8ed4bd5 commit 4b6ee74

File tree

9 files changed

+129
-0
lines changed

9 files changed

+129
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Periodic Inspector
2+
3+
The periodic inspector can be run at sites to inspect the hardware
4+
characteristics of individual nodes.
5+
6+
The periodic inspector tool is bundled into the site tools Docker
7+
image.
8+
9+
A systemd timer is configured to run the inspector once a day.
10+
11+
## Configuration and Execution
12+
13+
The site tools containing the periodic inspector are installed onto the
14+
`control` node in the site configuration Ansible inventory. The configuration
15+
steps are included in the `post-deploy`. You can also manually configure and
16+
run the image tools by executing the `chameleon_periodic_inspector` playbook.
17+
18+
```shell
19+
cc-ansible --playbook playbooks/chameleon_periodic_inspector.yml
20+
```
21+
22+
The playbook will pull the latest `chameleon_periodic_inspector` Docker image
23+
to run the tool.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
- hosts: chameleon-periodic-inspector
3+
roles:
4+
- chameleon_periodic_inspector

playbooks/post_deploy.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
- hosts: chameleon-image-tools
1515
roles: [chameleon_image_tools]
1616

17+
- hosts: chameleon-periodic-inspector
18+
roles: [chameleon_periodic_inspector]
19+
1720
- hosts: deployment
1821
roles:
1922
- role: chameleon_mariadb
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
chameleon_resource_discovery_docker_image: ghcr.io/chameleoncloud/chameleon_site_tools:sha-384af41
3+
chameleon_resource_discovery_config_dir: /etc/hammers
4+
5+
chameleon_resource_discovery_parallel: 5
6+
chameleon_resource_discovery_limit: 5
7+
chameleon_resource_discovery_provide_manageable: true
8+
chameleon_resource_discovery_reinspect_failed: true
9+
chameleon_resource_discovery_expire_days: 7
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
---
2+
- name: Pull Docker image
3+
become: True
4+
docker_image:
5+
source: pull
6+
name: "{{ chameleon_resource_discovery_docker_image }}"
7+
force_source: yes
8+
9+
- name: Ensure config directory exists
10+
become: yes
11+
file:
12+
path: "{{ chameleon_resource_discovery_config_dir }}"
13+
state: directory
14+
15+
- name: Template envvars file
16+
become: yes
17+
template:
18+
src: envvars.j2
19+
dest: "{{ chameleon_resource_discovery_config_dir }}/envvars"
20+
mode: '0600'
21+
owner: 'root'
22+
group: 'root'
23+
24+
- name: Deploy periodic-inspector service unit
25+
become: yes
26+
template:
27+
src: periodic-inspector.service.j2
28+
dest: /etc/systemd/system/periodic-inspector.service
29+
mode: '0644'
30+
31+
- name: Deploy periodic-inspector timer unit
32+
become: yes
33+
template:
34+
src: periodic-inspector.timer.j2
35+
dest: /etc/systemd/system/periodic-inspector.timer
36+
mode: '0644'
37+
38+
- name: Reload systemd
39+
become: yes
40+
systemd:
41+
daemon_reload: yes
42+
43+
- name: Enable and start periodic-inspector.timer
44+
become: yes
45+
systemd:
46+
name: periodic-inspector.timer
47+
enabled: yes
48+
state: started
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
OS_AUTH_URL='{{ keystone_public_url }}'
2+
OS_AUTH_PLUGIN='password'
3+
OS_IDENTITY_API_VERSION='3'
4+
OS_USER_DOMAIN_NAME='Default'
5+
OS_USERNAME='{{ keystone_admin_user }}'
6+
OS_PASSWORD='{{ keystone_admin_password }}'
7+
OS_PROJECT_DOMAIN_NAME='Default'
8+
OS_PROJECT_NAME='{{ keystone_admin_project }}'
9+
OS_REGION_NAME='{{ openstack_region_name }}'
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
[Unit]
2+
Description=Chameleon Periodic Inspector
3+
After=docker.service
4+
Requires=docker.service
5+
6+
[Service]
7+
Type=oneshot
8+
ExecStart=/usr/bin/docker run --rm --net=host \
9+
--env-file {{ chameleon_resource_discovery_config_dir }}/envvars \
10+
{{ chameleon_resource_discovery_docker_image }} \
11+
periodic_inspector \
12+
--parallel {{ chameleon_resource_discovery_parallel }} \
13+
--limit {{ chameleon_resource_discovery_limit }} \
14+
{% if chameleon_resource_discovery_provide_manageable %}--provide-manageable {% endif %}\
15+
{% if chameleon_resource_discovery_reinspect_failed %}--reinspect-failed {% endif %}\
16+
--expire-days {{ chameleon_resource_discovery_expire_days }} \
17+
--cloud {{ cloud }}
18+
19+
[Install]
20+
WantedBy=multi-user.target
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[Unit]
2+
Description=Run Chameleon Periodic Inspector daily
3+
4+
[Timer]
5+
OnCalendar=daily
6+
Persistent=true
7+
8+
[Install]
9+
WantedBy=timers.target

site-config.example/inventory/hosts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -842,6 +842,10 @@ control
842842
[chameleon-image-tools:children]
843843
control
844844

845+
# Periodic Inspector
846+
[chameleon-periodic-inspector:children]
847+
control
848+
845849
# Development, fake baremetal hypervisor host using tenks
846850
[fake-baremetal:children]
847851
ironic

0 commit comments

Comments
 (0)