-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Ondra Machacek <omachace@redhat.com>
- Loading branch information
1 parent
ecd108e
commit 8048497
Showing
19 changed files
with
373 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
profile: production | ||
strict: true | ||
|
||
skip_list: | ||
- no-changed-when # Commands should not change things if nothing needs doing. | ||
|
||
exclude_paths: | ||
- tests/integration |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
--- | ||
name: Ansible Integration Test | ||
on: # yamllint disable-line rule:truthy | ||
pull_request: | ||
merge_group: | ||
branches: | ||
- main | ||
push: | ||
branches: | ||
- main | ||
permissions: | ||
contents: read | ||
jobs: | ||
ansible_integration_test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Update pip, git | ||
run: | | ||
set -euxo pipefail | ||
sudo apt-get update | ||
- name: Checkout repo | ||
uses: actions/checkout@v4 | ||
with: | ||
path: ansible_collections/redhat_cop/vmware_ops | ||
|
||
- name: Run | ||
run: | | ||
make integration | ||
working-directory: ansible_collections/redhat_cop/vmware_ops |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
integration: | ||
ansible-test integration --no-temp-workdir security_test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
## How to use execution environment | ||
|
||
### Building | ||
To build the execution environment image: | ||
|
||
```bash | ||
$ export USER=yourdockerusername | ||
$ ansible-builder build -t quay.io/$USER/vmware:mytest | ||
``` | ||
|
||
This will create container image `quay.io/$USER/vmware:mytest`. You can upload it to quay and use from AAP. | ||
|
||
### Local test | ||
To test the image locally using `ansible-runner` execute the image as follows: | ||
|
||
```bash | ||
$ export USER=yourdockerusername | ||
$ ansible-runner run --container-image quay.io/$USER/vmware:mytest runner --inventory localhost, -p redhat_cop.vmware_ops.security | ||
``` | ||
|
||
This will execute the `security.yml` playbook from playbooks directory. You can test with any playbook from this directory. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
[ | ||
{ | ||
"httpRequest": { | ||
"method": "POST", | ||
"path": "/rest/com/vmware/cis/session" | ||
}, | ||
"httpResponse": { | ||
"statusCode": 200, | ||
"body": {"value": "72300ca9ff16c5743fa0a6328c8570ce"} | ||
} | ||
}, | ||
{ | ||
"httpRequest": { | ||
"method": "PUT", | ||
"path": "/api/appliance/access/(consolecli|dcui|shell|ssh)" | ||
}, | ||
"httpResponse": { | ||
"statusCode": 200, | ||
"headers": { | ||
"Content-Type": "application/json" | ||
}, | ||
"body": "{}" | ||
} | ||
}, | ||
{ | ||
"httpRequest": { | ||
"method": "GET", | ||
"path": "/api/appliance/access/(consolecli|dcui|shell|ssh)" | ||
}, | ||
"httpResponse": { | ||
"statusCode": 200, | ||
"headers": { | ||
"Content-Type": "application/json" | ||
}, | ||
"body": "true" | ||
} | ||
}, | ||
{ | ||
"httpRequest": { | ||
"method" : "GET", | ||
"path" : "/api/appliance/networking/firewall/inbound" | ||
}, | ||
"httpResponse": { | ||
"statusCode": 200, | ||
"headers": { | ||
"Content-Type": "application/json" | ||
}, | ||
"body": [{}] | ||
} | ||
}, | ||
{ | ||
"httpRequest": { | ||
"method" : "PUT", | ||
"path" : "/api/appliance/networking/firewall/inbound" | ||
}, | ||
"httpResponse": { | ||
"statusCode": 200, | ||
"headers": { | ||
"Content-Type": "application/json" | ||
}, | ||
"body": "{}" | ||
} | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[testgroup] | ||
testhost ansible_connection="local" ansible_pipelining="yes" ansible_python_interpreter="/usr/bin/python3" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/usr/bin/env bash | ||
# shellcheck disable=SC2155,SC2086 | ||
|
||
BASE_DIR=$(dirname "${BASH_SOURCE[0]}") | ||
export ANSIBLE_ROLES_PATH=${BASE_DIR} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
--- | ||
- name: Install dependencies | ||
ansible.builtin.pip: | ||
name: | ||
- requests | ||
- aiohttp | ||
|
||
- name: Run rest | ||
community.docker.docker_container: | ||
name: vmwarest | ||
image: mockserver/mockserver | ||
state: started | ||
recreate: yes | ||
exposed_ports: | ||
- 1080 | ||
ports: | ||
- 1080:1080 | ||
|
||
- name: Pause | ||
ansible.builtin.pause: | ||
seconds: 10 | ||
|
||
- name: Put data to mockserver | ||
ansible.builtin.command: | ||
cmd: "curl -v -X PUT --data @../{{ mock_file }}/mock.json http://localhost:1080/mockserver/expectation" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
[ | ||
{ | ||
"httpRequest": { | ||
"method": "POST", | ||
"path": "/rest/com/vmware/cis/session" | ||
}, | ||
"httpResponse": { | ||
"statusCode": 200, | ||
"body": {"value": "72300ca9ff16c5743fa0a6328c8570ce"} | ||
} | ||
}, | ||
{ | ||
"httpRequest": { | ||
"method": "PUT", | ||
"path": "/api/appliance/access/(consolecli|dcui|shell|ssh)" | ||
}, | ||
"httpResponse": { | ||
"statusCode": 200, | ||
"headers": { | ||
"Content-Type": "application/json" | ||
}, | ||
"body": "{}" | ||
} | ||
}, | ||
{ | ||
"httpRequest": { | ||
"method": "GET", | ||
"path": "/api/appliance/access/(consolecli|dcui|shell|ssh)" | ||
}, | ||
"httpResponse": { | ||
"statusCode": 200, | ||
"headers": { | ||
"Content-Type": "application/json" | ||
}, | ||
"body": "true" | ||
} | ||
}, | ||
{ | ||
"httpRequest": { | ||
"method" : "GET", | ||
"path" : "/api/appliance/networking/firewall/inbound" | ||
}, | ||
"httpResponse": { | ||
"statusCode": 200, | ||
"headers": { | ||
"Content-Type": "application/json" | ||
}, | ||
"body": [{}] | ||
} | ||
}, | ||
{ | ||
"httpRequest": { | ||
"method" : "PUT", | ||
"path" : "/api/appliance/networking/firewall/inbound" | ||
}, | ||
"httpResponse": { | ||
"statusCode": 200, | ||
"headers": { | ||
"Content-Type": "application/json" | ||
}, | ||
"body": "{}" | ||
} | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
- hosts: localhost | ||
gather_facts: no | ||
collections: | ||
- community.general | ||
vars_files: | ||
- vars.yml | ||
|
||
tasks: | ||
- name: Vcsim | ||
ansible.builtin.import_role: | ||
name: prepare_rest | ||
|
||
- name: Import security role | ||
ansible.builtin.import_role: | ||
name: security_test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/env bash | ||
source ../init.sh | ||
exec ansible-playbook run.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
- name: Security role | ||
ansible.builtin.import_role: | ||
name: redhat_cop.vmware_ops.security |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
mock_file: "security_test" | ||
|
||
security_hostname: "127.0.0.1:1080" | ||
security_username: "user" | ||
security_password: "pass" | ||
security_validate_certs: false | ||
|
||
security_consolecli_enabled: true | ||
security_dcui_enabled: true | ||
security_shell_enabled: true | ||
security_shell_timeout: 100 | ||
security_ssh_enabled: true | ||
security_firewall_rules: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
[ | ||
{ | ||
"httpRequest": { | ||
"method": "POST", | ||
"path": "/rest/com/vmware/cis/session" | ||
}, | ||
"httpResponse": { | ||
"statusCode": 200, | ||
"body": {"value": "72300ca9ff16c5743fa0a6328c8570ce"} | ||
} | ||
}, | ||
{ | ||
"httpRequest": { | ||
"method": "POST", | ||
"path": "/api/appliance/system/storage", | ||
"queryStringParameters": {"action": "resize"} | ||
}, | ||
"httpResponse": { | ||
"statusCode": 200, | ||
"headers": { | ||
"Content-Type": "application/json" | ||
}, | ||
"body": "{}" | ||
} | ||
}, | ||
{ | ||
"httpRequest": { | ||
"method": "POST", | ||
"path": "/api/appliance/ntp", | ||
"queryStringParameters": {"action": "test"} | ||
}, | ||
"httpResponse": { | ||
"statusCode": 200, | ||
"headers": { | ||
"Content-Type": "application/json" | ||
}, | ||
"body": [{"server": "1.2.3.4", "status": "SERVER_UNREACHABLE", "message": "Unreachable"}] | ||
} | ||
}, | ||
{ | ||
"httpRequest": { | ||
"method": "(PUT|GET)", | ||
"path": "/api/appliance/system/(time/timezone|global-fips|storage)" | ||
}, | ||
"httpResponse": { | ||
"statusCode": 200, | ||
"headers": { | ||
"Content-Type": "application/json" | ||
}, | ||
"body": "{}" | ||
} | ||
}, | ||
{ | ||
"httpRequest": { | ||
"method": "PUT", | ||
"path": "/api/appliance/(timesync|ntp)" | ||
}, | ||
"httpResponse": { | ||
"statusCode": 200, | ||
"headers": { | ||
"Content-Type": "application/json" | ||
}, | ||
"body": "{}" | ||
} | ||
}, | ||
{ | ||
"httpRequest": { | ||
"method": "GET", | ||
"path": "/api/appliance/(ntp|timesync)" | ||
}, | ||
"httpResponse": { | ||
"statusCode": 200, | ||
"headers": { | ||
"Content-Type": "application/json" | ||
}, | ||
"body": "true" | ||
} | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
- hosts: localhost | ||
gather_facts: no | ||
collections: | ||
- community.general | ||
vars_files: | ||
- vars.yml | ||
|
||
tasks: | ||
- name: Vcsim | ||
ansible.builtin.import_role: | ||
name: prepare_rest | ||
|
||
- name: Import system_settings role | ||
ansible.builtin.import_role: | ||
name: system_settings_test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/env bash | ||
source ../init.sh | ||
exec ansible-playbook run.yml |
4 changes: 4 additions & 0 deletions
4
tests/integration/targets/system_settings_test/tasks/main.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
- name: System settings role | ||
ansible.builtin.import_role: | ||
name: redhat_cop.vmware_ops.system_settings |
Oops, something went wrong.