forked from openstack-k8s-operators/ci-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate_container.yml
More file actions
56 lines (53 loc) · 2.23 KB
/
Copy pathcreate_container.yml
File metadata and controls
56 lines (53 loc) · 2.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
---
# Copyright Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
- name: Install podman and configure session linger
ansible.builtin.import_role:
name: podman
- name: Pull Sushy Emulator container image
register: _sushy_emulator_fetch_img
containers.podman.podman_image:
name: "{{ cifmw_sushy_emulator_image }}"
state: present
retries: 3
delay: 5
until: _sushy_emulator_fetch_img is success
- name: Create and start Sushy Emulator container
vars:
dest_dir: "{{ cifmw_sushy_emulator_resource_directory }}"
containers.podman.podman_container:
image: "{{ cifmw_sushy_emulator_image }}"
name: "{{ cifmw_sushy_emulator_container_name }}"
network: host
state: started
force_restart: true
restart_policy: on-failure
env:
SUSHY_TOOLS_CONFIG: '/etc/sushy-emulator/config.conf'
volumes:
- "{{ dest_dir }}/config.conf:/etc/sushy-emulator/config.conf:ro,Z"
- "{{ dest_dir }}/.htpasswd:/etc/sushy-emulator/.htpasswd:ro,Z"
- "{{ dest_dir }}/known_hosts:/root/.ssh/known_hosts:ro,Z"
- "{{ cifmw_sushy_emulator_sshkey_path }}:/root/.ssh/id_rsa:ro,Z"
- "{{ cifmw_sushy_emulator_sshkey_path }}.pub:/root/.ssh/id_rsa.pub:ro,Z"
healthcheck: >-
python3 -c "import urllib.request, base64;
req = urllib.request.Request('http://localhost:8000/redfish/v1/Systems/{{ _cifmw_sushy_emulator_instances[0] }}');
req.add_header('Authorization', 'Basic ' + base64.b64encode(b'{{ cifmw_sushy_emulator_redfish_username }}:{{ cifmw_sushy_emulator_redfish_password }}').decode());
urllib.request.urlopen(req, timeout=5).read()"
healthcheck_interval: "30s"
healthcheck_timeout: "30s"
healthcheck_retries: 2
healthcheck_failure_action: restart