<commit_before>// Module included in the following assemblies:
//
// * operators/operator_sdk/osdk-ansible.adoc

[id="osdk-ansible-k8s-module-testing-locally_{context}"]
= Testing the k8s Ansible module locally

Sometimes, it is beneficial for a developer to run the Ansible code from their
local machine as opposed to running and rebuilding the Operator each time.

.Procedure

. Install the `community.kubernetes` collection:

----
$ ansible-galaxy collection install community.kubernetes
----

. Initialize a new Ansible-based Operator project:
+
----
$ operator-sdk new --type ansible --kind Foo --api-version foo.example.com/v1alpha1 foo-operator
Create foo-operator/tmp/init/galaxy-init.sh
Create foo-operator/tmp/build/Dockerfile
Create foo-operator/tmp/build/test-framework/Dockerfile
Create foo-operator/tmp/build/go-test.sh
Rendering Ansible Galaxy role [foo-operator/roles/foo]...
Cleaning up foo-operator/tmp/init
Create foo-operator/watches.yaml
Create foo-operator/deploy/rbac.yaml
Create foo-operator/deploy/crd.yaml<commit_msg>osdocs-1055 final correction<commit_after>// Module included in the following assemblies:
//
// * operators/operator_sdk/osdk-ansible.adoc

[id="osdk-ansible-k8s-module-testing-locally_{context}"]
= Testing the k8s Ansible module locally

Sometimes, it is beneficial for a developer to run the Ansible code from their
local machine as opposed to running and rebuilding the Operator each time.

.Procedure

. Install the `community.kubernetes` collection:
+
----
$ ansible-galaxy collection install community.kubernetes
----

. Initialize a new Ansible-based Operator project:
+
----
$ operator-sdk new --type ansible --kind Foo --api-version foo.example.com/v1alpha1 foo-operator
Create foo-operator/tmp/init/galaxy-init.sh
Create foo-operator/tmp/build/Dockerfile
Create foo-operator/tmp/build/test-framework/Dockerfile
Create foo-operator/tmp/build/go-test.sh
Rendering Ansible Galaxy role [foo-operator/roles/foo]...
Cleaning up foo-operator/tmp/init
Create foo-operator/watches.yaml
Create foo-operator/deploy/rbac.yaml
Create foo-operator/deploy/crd.yaml
{'fraction_non_alphanumeric': 0.10751665080875357, 'fraction_numerical': 0.005708848715509039, 'mean_word_length': 4.392307692307693, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5212080', 'n_tokens_mistral': 660, 'n_tokens_neox': 621, 'n_words': 175}