Skip to content

Commit 783323f

Browse files
committed
Run only selected tasks of examples in check mode
Signed-off-by: Justin Cinkelj <justin.cinkelj@xlab.si>
1 parent 8638187 commit 783323f

File tree

6 files changed

+20
-8
lines changed

6 files changed

+20
-8
lines changed

.github/workflows/integ-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454
- run: apt install -y jq
5555
- run: mkdir -p $WORKDIR
5656
- run: cp -a ./ $WORKDIR
57-
- run: ansible-galaxy collection install community.general
57+
- run: ansible-galaxy collection install community.crypto community.general
5858
- run: |
5959
cd $WORKDIR
6060
echo "${{ vars.CI_CONFIG_HC_IP50 }}" > tests/integration/integration_config.yml
@@ -166,7 +166,7 @@ jobs:
166166
eval export SC_USERNAME=$(cat tests/integration/integration_config.yml | yq '.sc_username')
167167
eval export SC_PASSWORD=$(cat tests/integration/integration_config.yml | yq '.sc_password')
168168
eval export SC_TIMEOUT=$(cat tests/integration/integration_config.yml | yq '.sc_timeout')
169-
ansible-playbook -i localhost, --check examples/${{ matrix.example_name }}
169+
ansible-playbook -i localhost, -e hypercore_example_check_mode=true examples/${{ matrix.example_name }}
170170
171171
integ:
172172
needs:

examples/certificate_signing_example.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
hosts: localhost
44
connection: local
55
gather_facts: false
6+
vars:
7+
hypercore_example_check_mode: "{{ ansible_check_mode }}"
68

79
tasks:
810
# More info about openssl_privatekey module
@@ -40,6 +42,8 @@
4042
private_key: "{{ lookup('file', 'private_key_example.pem') }}"
4143
certificate: "{{ lookup('file', 'certificate_example.crt') }}"
4244
register: certificate_info
45+
# This is problematic, it would restart API server
46+
check_mode: "{{ hypercore_example_check_mode }}"
4347

4448
- name: Show uploaded certificate info
4549
debug:

examples/dns_config.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,14 @@
1515
dns_servers:
1616
- 1.2.3.4
1717
- 5.6.7.8
18-
state: set
18+
state: after # or before
19+
1920
# ------------------------------------------------------
21+
# Configure system with valid DNS resolvers
2022
- name: Modify existing DNS config configurations
2123
scale_computing.hypercore.dns_config:
22-
search_domains:
23-
- example.domain.com
24+
search_domains: []
2425
dns_servers:
25-
- 0.0.0.1
26-
- 0.0.1.0
27-
state: before # or after
26+
- 1.1.1.1
27+
- 1.0.0.1
28+
state: set

examples/email_alert.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
vars:
77
email: example@example.com
88
email_new: new@example.com
9+
hypercore_example_check_mode: "{{ ansible_check_mode }}"
910

1011
tasks:
1112
- name: Create Email alert recipient
@@ -17,6 +18,8 @@
1718
scale_computing.hypercore.email_alert:
1819
email: "{{ email }}"
1920
state: test
21+
# Sending test can fail (invalid email, or invalid SMTP server).
22+
check_mode: "{{ hypercore_example_check_mode }}"
2023

2124
- name: Modify previously created Email alert recipient
2225
scale_computing.hypercore.email_alert:

examples/smtp.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
hosts: localhost
44
connection: local
55
gather_facts: false
6+
# Example is safe to run - if we do not modify from_address
7+
check_mode: true
68
vars:
79
smtp_server: smtp-relay.gmail.com
810
smtp_port: 25

examples/time_server.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
hosts: localhost
44
connection: local
55
gather_facts: false
6+
# NTP is always a bit problemtic for reconfiguration
7+
check_mode: true
68
vars:
79
source: pool.ntp.org
810

0 commit comments

Comments
 (0)