Skip to content
Merged
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
70 changes: 70 additions & 0 deletions .github/workflows/integ-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,75 @@ jobs:
)" >> $GITHUB_OUTPUT
if: "${{ github.event.inputs.integ_tests_include || github.event.schedule }}"

examples-matrix:
runs-on: [ ubuntu-latest ]
container: python:3.10-slim-buster
env:
DEBIAN_FRONTEND: noninteractive
ANSIBLE_COLLECTIONS_PATH: /work-dir
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Checkout
uses: actions/checkout@v3
- run: apt update
- run: apt install -y jq
- run: mkdir -p $WORKDIR
- run: cp -a ./ $WORKDIR
# A few files are not an example playbook:
# hypercore_inventory.yml - inventory example
# cloud-init-user-data-example.yml - cloud-init user-data example
- id: set-matrix
shell: bash
run: |-
echo "matrix=$(
ls -r $WORKDIR/examples |
grep -v -E "^README.md$|^hypercore_inventory.yml$|^cloud-init-user-data-example.yml$" |
jq -R -s -c 'split("\n")[:-1]'
)" >> $GITHUB_OUTPUT
if: "${{ github.event.inputs || github.event.schedule }}"

examples-run:
needs:
- examples-matrix
runs-on: [ self-hosted2 ]
container: python:3.10-slim-buster
env:
DEBIAN_FRONTEND: noninteractive
strategy:
fail-fast: false
matrix:
ansible: [ 2.13.0 ]
example_name: ${{ fromJson(needs.examples-matrix.outputs.matrix) }}
steps:
- name: Checkout
uses: actions/checkout@v3
- run: pip3 install -r sanity.requirements -r test.requirements -r docs.requirements
- run: apt update
- run: apt install -y git make
- run: apt install -y genisoimage qemu-utils jq
- run: pip install yq
- run: pip install ansible-core~=${{ matrix.ansible }}
- run: mkdir -p $WORKDIR
- run: cp -a ./ $WORKDIR
- run: cd $WORKDIR && ansible-galaxy collection install community.crypto community.general
- run: cd $WORKDIR && ansible-galaxy collection list
- run: |
cd $WORKDIR
echo "${{ vars.CI_CONFIG_HC_IP50 }}" > tests/integration/integration_config.yml
cat tests/integration/integration_config.yml
echo "sc_password: ${{ secrets.CI_CONFIG_HC_IP50_SC_PASSWORD }}" >> tests/integration/integration_config.yml
echo "smb_password: ${{ secrets.CI_CONFIG_HC_IP50_SMB_PASSWORD }}" >> tests/integration/integration_config.yml
echo "sc_replication_dest_password: ${{ secrets.CI_CONFIG_HC_IP50_SC_REPLICATION_DEST_PASSWORD }}" >> tests/integration/integration_config.yml
ls -al tests/integration/integration_config.yml
- run: |
cd $WORKDIR
eval export SC_HOST=$(cat tests/integration/integration_config.yml | yq '.sc_host')
eval export SC_USERNAME=$(cat tests/integration/integration_config.yml | yq '.sc_username')
eval export SC_PASSWORD=$(cat tests/integration/integration_config.yml | yq '.sc_password')
eval export SC_TIMEOUT=$(cat tests/integration/integration_config.yml | yq '.sc_timeout')
ansible-playbook --check examples/${{ matrix.example_name }}

integ:
needs:
- integ-matrix
Expand Down Expand Up @@ -139,6 +208,7 @@ jobs:
ls -al tests/integration/integration_config.yml
- run: cd $WORKDIR && ansible-test integration --local ${{ matrix.test_name }}


replica_cleanup:
needs:
- integ
Expand Down
14 changes: 11 additions & 3 deletions examples/time_server.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
---
- name: Modify current NTP Time Server entries (in HyperCore API settings)
scale_computing.hypercore.time_server:
source: pool.ntp.org # must be set if not already present in existing entries
- name: Example time_server module
hosts: localhost
connection: local
gather_facts: false
vars:
source: pool.ntp.org

tasks:
- name: Modify current NTP Time Server entries (in HyperCore API settings)
scale_computing.hypercore.time_server:
source: "{{ source }}" # must be set if not already present in existing entries
16 changes: 11 additions & 5 deletions examples/time_server_info.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
---
- name: List current Time Server entries
scale_computing.hypercore.time_server_info:
register: time_server_info
- ansible.builtin.debug:
msg: "{{ time_server_info }}"
- name: Example time_server_info module
hosts: localhost
connection: local
gather_facts: false

tasks:
- name: List current Time Server entries
scale_computing.hypercore.time_server_info:
register: time_server_info
- ansible.builtin.debug:
msg: "{{ time_server_info }}"
14 changes: 11 additions & 3 deletions examples/time_zone.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
---
- name: Modify current Time Zone entries (in HyperCore API settings)
scale_computing.hypercore.time_zone:
zone: US/Eastern # must be set if not already present in existing entries
- name: Example time_zone module
hosts: localhost
connection: local
gather_facts: false
vars:
zone: US/Eastern

tasks:
- name: Modify current Time Zone entries (in HyperCore API settings)
scale_computing.hypercore.time_zone:
zone: "{{ zone }}" # must be set if not already present in existing entries
16 changes: 11 additions & 5 deletions examples/time_zone_info.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
---
- name: List current Time Zone entries
- scale_computing.hypercore.time_zone_info:
register: time_zone_info
- ansible.builtin.debug:
msg: "{{ time_zone_info }}"
- name: Example time_zone_info module
hosts: localhost
connection: local
gather_facts: false

tasks:
- name: List current Time Zone entries
- scale_computing.hypercore.time_zone_info:
register: time_zone_info
- ansible.builtin.debug:
msg: "{{ time_zone_info }}"