Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# Role Name
# trustee_attestation_server

[![ansible-lint.yml](https://github.com/linux-system-roles/trustee_attestation_server/actions/workflows/ansible-lint.yml/badge.svg)](https://github.com/linux-system-roles/trustee_attestation_server/actions/workflows/ansible-lint.yml) [![ansible-test.yml](https://github.com/linux-system-roles/trustee_attestation_server/actions/workflows/ansible-test.yml/badge.svg)](https://github.com/linux-system-roles/trustee_attestation_server/actions/workflows/ansible-test.yml) [![codespell.yml](https://github.com/linux-system-roles/trustee_attestation_server/actions/workflows/codespell.yml/badge.svg)](https://github.com/linux-system-roles/trustee_attestation_server/actions/workflows/codespell.yml) [![markdownlint.yml](https://github.com/linux-system-roles/trustee_attestation_server/actions/workflows/markdownlint.yml/badge.svg)](https://github.com/linux-system-roles/trustee_attestation_server/actions/workflows/markdownlint.yml) [![qemu-kvm-integration-tests.yml](https://github.com/linux-system-roles/trustee_attestation_server/actions/workflows/qemu-kvm-integration-tests.yml/badge.svg)](https://github.com/linux-system-roles/trustee_attestation_server/actions/workflows/qemu-kvm-integration-tests.yml) [![shellcheck.yml](https://github.com/linux-system-roles/trustee_attestation_server/actions/workflows/shellcheck.yml/badge.svg)](https://github.com/linux-system-roles/trustee_attestation_server/actions/workflows/shellcheck.yml) [![tft.yml](https://github.com/linux-system-roles/trustee_attestation_server/actions/workflows/tft.yml/badge.svg)](https://github.com/linux-system-roles/trustee_attestation_server/actions/workflows/tft.yml) [![tft_citest_bad.yml](https://github.com/linux-system-roles/trustee_attestation_server/actions/workflows/tft_citest_bad.yml/badge.svg)](https://github.com/linux-system-roles/trustee_attestation_server/actions/workflows/tft_citest_bad.yml) [![woke.yml](https://github.com/linux-system-roles/trustee_attestation_server/actions/workflows/woke.yml/badge.svg)](https://github.com/linux-system-roles/trustee_attestation_server/actions/workflows/woke.yml)

![template](https://github.com/linux-system-roles/template/workflows/tox/badge.svg)
![trustee_attestation_server](https://github.com/linux-system-roles/trustee_attestation_server/workflows/tox/badge.svg)

A template for an ansible role that configures some GNU/Linux subsystem or
service. A brief description of the role goes here.
An Ansible role that manages trustee attestation servers.

## Requirements

Expand Down
8 changes: 4 additions & 4 deletions examples/simple.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# SPDX-License-Identifier: MIT
---
- name: Example template role invocation
- name: Example trustee_attestation_server role invocation
hosts: all
vars:
template_foo: example variable value
template_bar: false
trustee_attestation_server_foo: example variable value
trustee_attestation_server_bar: false
roles:
- linux-system-roles.template
- linux-system-roles.trustee_attestation_server
4 changes: 2 additions & 2 deletions tests/setup-snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
tasks:
- name: Set platform/version specific variables
include_role:
name: linux-system-roles.template
name: linux-system-roles.trustee_attestation_server
tasks_from: set_vars.yml
public: true

- name: Install test packages
package:
name: "{{ __template_packages }}"
name: "{{ __trustee_attestation_server_packages }}"
state: present
37 changes: 37 additions & 0 deletions tests/tasks/run_role_with_clear_facts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
# Task file: clear_facts, run linux-system-roles.trustee_attestation_server.
# Include this with include_tasks or import_tasks
# Input:
# - __sr_tasks_from: tasks_from to run - same as tasks_from in include_role
# - __sr_public: export private vars from role - same as public in include_role
# - __sr_failed_when: set to false to ignore role errors - same as failed_when in include_role
- name: Clear facts
meta: clear_facts

# note that you can use failed_when with import_role but not with include_role
# so this simulates the __sr_failed_when false case
# Q: Why do we need a separate task to run the role normally? Why not just
# run the role in the block and rethrow the error in the rescue block?
# A: Because you cannot rethrow the error in exactly the same way as the role does.
# It might be possible to exactly reconstruct ansible_failed_result but it's not worth the effort.
- name: Run the role with __sr_failed_when false
when:
- __sr_failed_when is defined
- not __sr_failed_when
block:
- name: Run the role
include_role:
name: linux-system-roles.trustee_attestation_server
tasks_from: "{{ __sr_tasks_from | default('main') }}"
public: "{{ __sr_public | default(false) }}"
rescue:
- name: Ignore the failure when __sr_failed_when is false
debug:
msg: Ignoring failure when __sr_failed_when is false

- name: Run the role normally
include_role:
name: linux-system-roles.trustee_attestation_server
tasks_from: "{{ __sr_tasks_from | default('main') }}"
public: "{{ __sr_public | default(false) }}"
when: __sr_failed_when | d(true)
6 changes: 3 additions & 3 deletions tests/tests_default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
---
- name: Ensure that the role runs with default parameters
hosts: all
gather_facts: false # test that role works in this case
roles:
- linux-system-roles.template
tasks:
- name: Run the role
include_tasks: tasks/run_role_with_clear_facts.yml

- name: Check header for ansible_managed, fingerprint
include_tasks: tasks/check_header.yml
vars:
Expand Down
3 changes: 1 addition & 2 deletions tests/tests_include_vars_from_parent.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---
- name: Test role include variable override
hosts: all
gather_facts: true
tasks:
- name: Create var file in caller that can override the one in called role
delegate_to: localhost
Expand Down Expand Up @@ -44,7 +43,7 @@
import_role:
name: caller
vars:
roletoinclude: linux-system-roles.template
roletoinclude: linux-system-roles.trustee_attestation_server

- name: Cleanup
file:
Expand Down
Loading