-
Notifications
You must be signed in to change notification settings - Fork 596
Add ansible-runner v0.3 #1334
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add ansible-runner v0.3 #1334
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hi @sveno1990. Thanks for your PR. I'm waiting for a tektoncd member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
|
/kind feature |
Diff between version 0.2 and 0.3diff --git a/task/ansible-runner/0.2/README.md b/task/ansible-runner/0.3/README.md
index 257bc2d..d9a15f4 100644
--- a/task/ansible-runner/0.2/README.md
+++ b/task/ansible-runner/0.3/README.md
@@ -23,10 +23,12 @@ tkn task ls
* **project-dir**: The ansible-runner private data dir
* **args:**: The array of arguments to pass to the runner command (_default:_ --help)
* **user-home**: Absolute path to the user's home directory. (_default:_ /tekton/home)
+* **workspaces_ssl_ca_file**: file name of ca bundle. (_default:_ ca-bundle.crt)
## Workspaces
* **runner-dir**: A [workspace](https://github.com/tektoncd/pipeline/blob/main/docs/workspaces.md) to hold the `private_data_dir` as described in https://ansible-runner.readthedocs.io/en/latest/intro.html#runner-input-directory-hierarchy[Runner Directory]
+* **ssl-ca-directory**: A optional [workspace](https://github.com/tektoncd/pipeline/blob/main/docs/workspaces.md) to hold the ca_certs for custom certificate authorities.
## Platforms
diff --git a/task/ansible-runner/0.2/ansible-runner.yaml b/task/ansible-runner/0.3/ansible-runner.yaml
index d047c75..fb03def 100644
--- a/task/ansible-runner/0.2/ansible-runner.yaml
+++ b/task/ansible-runner/0.3/ansible-runner.yaml
@@ -4,10 +4,10 @@ kind: Task
metadata:
name: ansible-runner
labels:
- app.kubernetes.io/version: '0.2'
- app.kubernetes.io/ansible-version: '2.12.5'
+ app.kubernetes.io/version: '0.3'
+ app.kubernetes.io/ansible-version: '2.18.2'
annotations:
- tekton.dev/deprecated: "true"
+ tekton.dev/deprecated: "false"
tekton.dev/pipelines.minVersion: '0.12.1'
tekton.dev/categories: CLI
tekton.dev/tags: cli
@@ -20,6 +20,12 @@ spec:
workspaces:
- name: runner-dir
description: The Ansibler runner directory
+ - name: ssl-ca-directory
+ optional: true
+ description: |
+ A Workspace containing CA certificates, this will be used by Ansible and pip to
+ verify the peer with when interacting with remote repositories using
+ HTTPS.
params:
- name: project-dir
description: The project directory under the workspace runner-dir
@@ -34,11 +40,16 @@ spec:
default: /tekton/home
- name: image
description: Ansible runner image.
- default: quay.io/ansible/ansible-runner:stable-2.12-latest #tag: stable-2.12-latest
+ default: ghcr.io/ansible/community-ansible-dev-tools:v25.5.1 #tag: v25.5.1
+ - name: workspaces_ssl_ca_file
+ default: "ca-bundle.crt"
+
stepTemplate:
env:
- name: HOME
value: $(params.user-home)
+ - name: CURL_CA_BUNDLE
+ value: "$(workspaces.ssl-ca-directory.path)/$(workspaces_ssl_ca_file)"
steps:
- name: requirements
image: $(params.image)
@@ -63,9 +74,8 @@ spec:
- name: run-playbook
image: $(params.image)
- command: ['entrypoint']
+ command: ['ansible-runner']
args:
- - ansible-runner
- run
- $(params.args)
- $(params.project-dir)
diff --git a/task/ansible-runner/0.2/tests/pre-apply-task-hook.sh b/task/ansible-runner/0.3/tests/pre-apply-task-hook.sh
old mode 100755
new mode 100644 |
Catlin OutputCatlin script lint Output |
Diff between version 0.2 and 0.3diff --git a/task/ansible-runner/0.2/README.md b/task/ansible-runner/0.3/README.md
index 257bc2d..d9a15f4 100644
--- a/task/ansible-runner/0.2/README.md
+++ b/task/ansible-runner/0.3/README.md
@@ -23,10 +23,12 @@ tkn task ls
* **project-dir**: The ansible-runner private data dir
* **args:**: The array of arguments to pass to the runner command (_default:_ --help)
* **user-home**: Absolute path to the user's home directory. (_default:_ /tekton/home)
+* **workspaces_ssl_ca_file**: file name of ca bundle. (_default:_ ca-bundle.crt)
## Workspaces
* **runner-dir**: A [workspace](https://github.com/tektoncd/pipeline/blob/main/docs/workspaces.md) to hold the `private_data_dir` as described in https://ansible-runner.readthedocs.io/en/latest/intro.html#runner-input-directory-hierarchy[Runner Directory]
+* **ssl-ca-directory**: A optional [workspace](https://github.com/tektoncd/pipeline/blob/main/docs/workspaces.md) to hold the ca_certs for custom certificate authorities.
## Platforms
diff --git a/task/ansible-runner/0.2/ansible-runner.yaml b/task/ansible-runner/0.3/ansible-runner.yaml
index d047c75..d1dd077 100644
--- a/task/ansible-runner/0.2/ansible-runner.yaml
+++ b/task/ansible-runner/0.3/ansible-runner.yaml
@@ -4,10 +4,10 @@ kind: Task
metadata:
name: ansible-runner
labels:
- app.kubernetes.io/version: '0.2'
- app.kubernetes.io/ansible-version: '2.12.5'
+ app.kubernetes.io/version: '0.3'
+ app.kubernetes.io/ansible-version: '2.18.2'
annotations:
- tekton.dev/deprecated: "true"
+ tekton.dev/deprecated: "false"
tekton.dev/pipelines.minVersion: '0.12.1'
tekton.dev/categories: CLI
tekton.dev/tags: cli
@@ -20,6 +20,12 @@ spec:
workspaces:
- name: runner-dir
description: The Ansibler runner directory
+ - name: ssl-ca-directory
+ optional: true
+ description: |
+ A Workspace containing CA certificates, this will be used by Ansible and pip to
+ verify the peer with when interacting with remote repositories using
+ HTTPS.
params:
- name: project-dir
description: The project directory under the workspace runner-dir
@@ -34,11 +40,16 @@ spec:
default: /tekton/home
- name: image
description: Ansible runner image.
- default: quay.io/ansible/ansible-runner:stable-2.12-latest #tag: stable-2.12-latest
+ default: ghcr.io/ansible/community-ansible-dev-tools:v25.5.1 #tag: v25.5.1
+ - name: workspaces_ssl_ca_file
+ default: "ca-bundle.crt"
+
stepTemplate:
env:
- name: HOME
value: $(params.user-home)
+ - name: CURL_CA_BUNDLE
+ value: "$(workspaces.ssl-ca-directory.path)/$(params.workspaces_ssl_ca_file)"
steps:
- name: requirements
image: $(params.image)
@@ -63,9 +74,8 @@ spec:
- name: run-playbook
image: $(params.image)
- command: ['entrypoint']
+ command: ['ansible-runner']
args:
- - ansible-runner
- run
- $(params.args)
- $(params.project-dir)
diff --git a/task/ansible-runner/0.2/tests/pre-apply-task-hook.sh b/task/ansible-runner/0.3/tests/pre-apply-task-hook.sh
old mode 100755
new mode 100644 |
Catlin OutputCatlin script lint Output |
0bbfe9c to
9e4abf6
Compare
Diff between version 0.2 and 0.3diff --git a/task/ansible-runner/0.2/README.md b/task/ansible-runner/0.3/README.md
index 257bc2d..d9a15f4 100644
--- a/task/ansible-runner/0.2/README.md
+++ b/task/ansible-runner/0.3/README.md
@@ -23,10 +23,12 @@ tkn task ls
* **project-dir**: The ansible-runner private data dir
* **args:**: The array of arguments to pass to the runner command (_default:_ --help)
* **user-home**: Absolute path to the user's home directory. (_default:_ /tekton/home)
+* **workspaces_ssl_ca_file**: file name of ca bundle. (_default:_ ca-bundle.crt)
## Workspaces
* **runner-dir**: A [workspace](https://github.com/tektoncd/pipeline/blob/main/docs/workspaces.md) to hold the `private_data_dir` as described in https://ansible-runner.readthedocs.io/en/latest/intro.html#runner-input-directory-hierarchy[Runner Directory]
+* **ssl-ca-directory**: A optional [workspace](https://github.com/tektoncd/pipeline/blob/main/docs/workspaces.md) to hold the ca_certs for custom certificate authorities.
## Platforms
diff --git a/task/ansible-runner/0.2/ansible-runner.yaml b/task/ansible-runner/0.3/ansible-runner.yaml
index d047c75..d1dd077 100644
--- a/task/ansible-runner/0.2/ansible-runner.yaml
+++ b/task/ansible-runner/0.3/ansible-runner.yaml
@@ -4,10 +4,10 @@ kind: Task
metadata:
name: ansible-runner
labels:
- app.kubernetes.io/version: '0.2'
- app.kubernetes.io/ansible-version: '2.12.5'
+ app.kubernetes.io/version: '0.3'
+ app.kubernetes.io/ansible-version: '2.18.2'
annotations:
- tekton.dev/deprecated: "true"
+ tekton.dev/deprecated: "false"
tekton.dev/pipelines.minVersion: '0.12.1'
tekton.dev/categories: CLI
tekton.dev/tags: cli
@@ -20,6 +20,12 @@ spec:
workspaces:
- name: runner-dir
description: The Ansibler runner directory
+ - name: ssl-ca-directory
+ optional: true
+ description: |
+ A Workspace containing CA certificates, this will be used by Ansible and pip to
+ verify the peer with when interacting with remote repositories using
+ HTTPS.
params:
- name: project-dir
description: The project directory under the workspace runner-dir
@@ -34,11 +40,16 @@ spec:
default: /tekton/home
- name: image
description: Ansible runner image.
- default: quay.io/ansible/ansible-runner:stable-2.12-latest #tag: stable-2.12-latest
+ default: ghcr.io/ansible/community-ansible-dev-tools:v25.5.1 #tag: v25.5.1
+ - name: workspaces_ssl_ca_file
+ default: "ca-bundle.crt"
+
stepTemplate:
env:
- name: HOME
value: $(params.user-home)
+ - name: CURL_CA_BUNDLE
+ value: "$(workspaces.ssl-ca-directory.path)/$(params.workspaces_ssl_ca_file)"
steps:
- name: requirements
image: $(params.image)
@@ -63,9 +74,8 @@ spec:
- name: run-playbook
image: $(params.image)
- command: ['entrypoint']
+ command: ['ansible-runner']
args:
- - ansible-runner
- run
- $(params.args)
- $(params.project-dir)
diff --git a/task/ansible-runner/0.2/tests/pre-apply-task-hook.sh b/task/ansible-runner/0.3/tests/pre-apply-task-hook.sh
old mode 100755
new mode 100644 |
Catlin OutputCatlin script lint Output |
vinamra28
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/ok-to-test
Diff between version 0.2 and 0.3diff --git a/task/ansible-runner/0.2/README.md b/task/ansible-runner/0.3/README.md
index 257bc2d..bf96ba0 100644
--- a/task/ansible-runner/0.2/README.md
+++ b/task/ansible-runner/0.3/README.md
@@ -9,7 +9,7 @@ The latest versions of ansible-runner requires [`community.general`](https://git
Create the Task and other resources:
```shell
-kubectl apply --filename https://api.hub.tekton.dev/v1/resource/tekton/task/ansible-runner/0.2/raw
+kubectl apply --filename https://api.hub.tekton.dev/v1/resource/tekton/task/ansible-runner/0.3/raw
```
Verify the created tasks:
@@ -23,10 +23,12 @@ tkn task ls
* **project-dir**: The ansible-runner private data dir
* **args:**: The array of arguments to pass to the runner command (_default:_ --help)
* **user-home**: Absolute path to the user's home directory. (_default:_ /tekton/home)
+* **workspaces_ssl_ca_file**: file name of ca bundle. (_default:_ ca-bundle.crt)
## Workspaces
* **runner-dir**: A [workspace](https://github.com/tektoncd/pipeline/blob/main/docs/workspaces.md) to hold the `private_data_dir` as described in https://ansible-runner.readthedocs.io/en/latest/intro.html#runner-input-directory-hierarchy[Runner Directory]
+* **ssl-ca-directory**: A optional [workspace](https://github.com/tektoncd/pipeline/blob/main/docs/workspaces.md) to hold the ca_certs for custom certificate authorities.
## Platforms
@@ -47,7 +49,7 @@ All the examples will be run in namespace called `funstuff`. Create the namespac
```shell
kubectl apply -f https://api.hub.tekton.dev/v1/resource/tekton/task/git-clone/0.5/raw \
- -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.2/support/playbooks-pvc.yaml
+ -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.3/support/playbooks-pvc.yaml
```
Do the git clone of the examples repository:
@@ -66,7 +68,7 @@ tkn task start git-clone \
As we will do get, list and create on the namespace, lets use a service account that has right RBAC:
```shell
-kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.2/support/ansible-deployer.yaml
+kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.3/support/ansible-deployer.yaml
```
### Run Tasks
diff --git a/task/ansible-runner/0.2/ansible-runner.yaml b/task/ansible-runner/0.3/ansible-runner.yaml
index d047c75..9e5a844 100644
--- a/task/ansible-runner/0.2/ansible-runner.yaml
+++ b/task/ansible-runner/0.3/ansible-runner.yaml
@@ -1,14 +1,14 @@
---
-apiVersion: tekton.dev/v1beta1
+apiVersion: tekton.dev/v1
kind: Task
metadata:
name: ansible-runner
labels:
- app.kubernetes.io/version: '0.2'
- app.kubernetes.io/ansible-version: '2.12.5'
+ app.kubernetes.io/version: '0.3'
+ app.kubernetes.io/ansible-version: '2.18.2'
annotations:
- tekton.dev/deprecated: "true"
- tekton.dev/pipelines.minVersion: '0.12.1'
+ tekton.dev/deprecated: "false"
+ tekton.dev/pipelines.minVersion: '0.19.0'
tekton.dev/categories: CLI
tekton.dev/tags: cli
tekton.dev/displayName: 'Ansible Runner'
@@ -20,6 +20,12 @@ spec:
workspaces:
- name: runner-dir
description: The Ansibler runner directory
+ - name: ssl-ca-directory
+ optional: true
+ description: |
+ A Workspace containing CA certificates, this will be used by Ansible and pip to
+ verify the peer with when interacting with remote repositories using
+ HTTPS.
params:
- name: project-dir
description: The project directory under the workspace runner-dir
@@ -34,11 +40,16 @@ spec:
default: /tekton/home
- name: image
description: Ansible runner image.
- default: quay.io/ansible/ansible-runner:stable-2.12-latest #tag: stable-2.12-latest
+ default: ghcr.io/ansible/community-ansible-dev-tools:v25.5.1 #tag: v25.5.1
+ - name: workspaces_ssl_ca_file
+ default: "ca-bundle.crt"
+
stepTemplate:
env:
- name: HOME
value: $(params.user-home)
+ - name: CURL_CA_BUNDLE
+ value: "$(workspaces.ssl-ca-directory.path)/$(params.workspaces_ssl_ca_file)"
steps:
- name: requirements
image: $(params.image)
@@ -63,9 +74,8 @@ spec:
- name: run-playbook
image: $(params.image)
- command: ['entrypoint']
+ command: ['ansible-runner']
args:
- - ansible-runner
- run
- $(params.args)
- $(params.project-dir)
diff --git a/task/ansible-runner/0.2/tests/pre-apply-task-hook.sh b/task/ansible-runner/0.3/tests/pre-apply-task-hook.sh
old mode 100755
new mode 100644
diff --git a/task/ansible-runner/0.2/tests/resources.yaml b/task/ansible-runner/0.3/tests/resources.yaml
index b8c0a41..e091721 100644
--- a/task/ansible-runner/0.2/tests/resources.yaml
+++ b/task/ansible-runner/0.3/tests/resources.yaml
@@ -14,7 +14,7 @@ apiVersion: v1
kind: ServiceAccount
metadata:
name: ansible-deployer-account
- namespace: ansible-runner-0-2
+ namespace: ansible-runner-0-3
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
@@ -41,7 +41,7 @@ metadata:
subjects:
- kind: ServiceAccount
name: ansible-deployer-account
- namespace: ansible-runner-0-2
+ namespace: ansible-runner-0-3
roleRef:
kind: ClusterRole
name: ansible-deployer
diff --git a/task/ansible-runner/0.2/tests/run.yaml b/task/ansible-runner/0.3/tests/run.yaml
index 3d5c009..677fd06 100644
--- a/task/ansible-runner/0.2/tests/run.yaml
+++ b/task/ansible-runner/0.3/tests/run.yaml
@@ -1,5 +1,5 @@
---
-apiVersion: tekton.dev/v1beta1
+apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: ansibler-runner-pipeline
@@ -37,7 +37,7 @@ spec:
value: ['-p', 'list-pods.yml']
---
-apiVersion: tekton.dev/v1beta1
+apiVersion: tekton.dev/v1
kind: PipelineRun
metadata:
name: ansibler-runner-pipeline-run |
581be0a to
aea047d
Compare
Diff between version 0.2 and 0.3diff --git a/task/ansible-runner/0.2/README.md b/task/ansible-runner/0.3/README.md
index 257bc2d..bf96ba0 100644
--- a/task/ansible-runner/0.2/README.md
+++ b/task/ansible-runner/0.3/README.md
@@ -9,7 +9,7 @@ The latest versions of ansible-runner requires [`community.general`](https://git
Create the Task and other resources:
```shell
-kubectl apply --filename https://api.hub.tekton.dev/v1/resource/tekton/task/ansible-runner/0.2/raw
+kubectl apply --filename https://api.hub.tekton.dev/v1/resource/tekton/task/ansible-runner/0.3/raw
```
Verify the created tasks:
@@ -23,10 +23,12 @@ tkn task ls
* **project-dir**: The ansible-runner private data dir
* **args:**: The array of arguments to pass to the runner command (_default:_ --help)
* **user-home**: Absolute path to the user's home directory. (_default:_ /tekton/home)
+* **workspaces_ssl_ca_file**: file name of ca bundle. (_default:_ ca-bundle.crt)
## Workspaces
* **runner-dir**: A [workspace](https://github.com/tektoncd/pipeline/blob/main/docs/workspaces.md) to hold the `private_data_dir` as described in https://ansible-runner.readthedocs.io/en/latest/intro.html#runner-input-directory-hierarchy[Runner Directory]
+* **ssl-ca-directory**: A optional [workspace](https://github.com/tektoncd/pipeline/blob/main/docs/workspaces.md) to hold the ca_certs for custom certificate authorities.
## Platforms
@@ -47,7 +49,7 @@ All the examples will be run in namespace called `funstuff`. Create the namespac
```shell
kubectl apply -f https://api.hub.tekton.dev/v1/resource/tekton/task/git-clone/0.5/raw \
- -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.2/support/playbooks-pvc.yaml
+ -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.3/support/playbooks-pvc.yaml
```
Do the git clone of the examples repository:
@@ -66,7 +68,7 @@ tkn task start git-clone \
As we will do get, list and create on the namespace, lets use a service account that has right RBAC:
```shell
-kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.2/support/ansible-deployer.yaml
+kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.3/support/ansible-deployer.yaml
```
### Run Tasks
diff --git a/task/ansible-runner/0.2/ansible-runner.yaml b/task/ansible-runner/0.3/ansible-runner.yaml
index d047c75..9e5a844 100644
--- a/task/ansible-runner/0.2/ansible-runner.yaml
+++ b/task/ansible-runner/0.3/ansible-runner.yaml
@@ -1,14 +1,14 @@
---
-apiVersion: tekton.dev/v1beta1
+apiVersion: tekton.dev/v1
kind: Task
metadata:
name: ansible-runner
labels:
- app.kubernetes.io/version: '0.2'
- app.kubernetes.io/ansible-version: '2.12.5'
+ app.kubernetes.io/version: '0.3'
+ app.kubernetes.io/ansible-version: '2.18.2'
annotations:
- tekton.dev/deprecated: "true"
- tekton.dev/pipelines.minVersion: '0.12.1'
+ tekton.dev/deprecated: "false"
+ tekton.dev/pipelines.minVersion: '0.19.0'
tekton.dev/categories: CLI
tekton.dev/tags: cli
tekton.dev/displayName: 'Ansible Runner'
@@ -20,6 +20,12 @@ spec:
workspaces:
- name: runner-dir
description: The Ansibler runner directory
+ - name: ssl-ca-directory
+ optional: true
+ description: |
+ A Workspace containing CA certificates, this will be used by Ansible and pip to
+ verify the peer with when interacting with remote repositories using
+ HTTPS.
params:
- name: project-dir
description: The project directory under the workspace runner-dir
@@ -34,11 +40,16 @@ spec:
default: /tekton/home
- name: image
description: Ansible runner image.
- default: quay.io/ansible/ansible-runner:stable-2.12-latest #tag: stable-2.12-latest
+ default: ghcr.io/ansible/community-ansible-dev-tools:v25.5.1 #tag: v25.5.1
+ - name: workspaces_ssl_ca_file
+ default: "ca-bundle.crt"
+
stepTemplate:
env:
- name: HOME
value: $(params.user-home)
+ - name: CURL_CA_BUNDLE
+ value: "$(workspaces.ssl-ca-directory.path)/$(params.workspaces_ssl_ca_file)"
steps:
- name: requirements
image: $(params.image)
@@ -63,9 +74,8 @@ spec:
- name: run-playbook
image: $(params.image)
- command: ['entrypoint']
+ command: ['ansible-runner']
args:
- - ansible-runner
- run
- $(params.args)
- $(params.project-dir)
diff --git a/task/ansible-runner/0.2/tests/pre-apply-task-hook.sh b/task/ansible-runner/0.3/tests/pre-apply-task-hook.sh
old mode 100755
new mode 100644
diff --git a/task/ansible-runner/0.2/tests/resources.yaml b/task/ansible-runner/0.3/tests/resources.yaml
index b8c0a41..e091721 100644
--- a/task/ansible-runner/0.2/tests/resources.yaml
+++ b/task/ansible-runner/0.3/tests/resources.yaml
@@ -14,7 +14,7 @@ apiVersion: v1
kind: ServiceAccount
metadata:
name: ansible-deployer-account
- namespace: ansible-runner-0-2
+ namespace: ansible-runner-0-3
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
@@ -41,7 +41,7 @@ metadata:
subjects:
- kind: ServiceAccount
name: ansible-deployer-account
- namespace: ansible-runner-0-2
+ namespace: ansible-runner-0-3
roleRef:
kind: ClusterRole
name: ansible-deployer
diff --git a/task/ansible-runner/0.2/tests/run.yaml b/task/ansible-runner/0.3/tests/run.yaml
index 3d5c009..677fd06 100644
--- a/task/ansible-runner/0.2/tests/run.yaml
+++ b/task/ansible-runner/0.3/tests/run.yaml
@@ -1,5 +1,5 @@
---
-apiVersion: tekton.dev/v1beta1
+apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: ansibler-runner-pipeline
@@ -37,7 +37,7 @@ spec:
value: ['-p', 'list-pods.yml']
---
-apiVersion: tekton.dev/v1beta1
+apiVersion: tekton.dev/v1
kind: PipelineRun
metadata:
name: ansibler-runner-pipeline-run |
Diff between version 0.2 and 0.3diff --git a/task/ansible-runner/0.2/README.md b/task/ansible-runner/0.3/README.md
index 257bc2d..bf96ba0 100644
--- a/task/ansible-runner/0.2/README.md
+++ b/task/ansible-runner/0.3/README.md
@@ -9,7 +9,7 @@ The latest versions of ansible-runner requires [`community.general`](https://git
Create the Task and other resources:
```shell
-kubectl apply --filename https://api.hub.tekton.dev/v1/resource/tekton/task/ansible-runner/0.2/raw
+kubectl apply --filename https://api.hub.tekton.dev/v1/resource/tekton/task/ansible-runner/0.3/raw
```
Verify the created tasks:
@@ -23,10 +23,12 @@ tkn task ls
* **project-dir**: The ansible-runner private data dir
* **args:**: The array of arguments to pass to the runner command (_default:_ --help)
* **user-home**: Absolute path to the user's home directory. (_default:_ /tekton/home)
+* **workspaces_ssl_ca_file**: file name of ca bundle. (_default:_ ca-bundle.crt)
## Workspaces
* **runner-dir**: A [workspace](https://github.com/tektoncd/pipeline/blob/main/docs/workspaces.md) to hold the `private_data_dir` as described in https://ansible-runner.readthedocs.io/en/latest/intro.html#runner-input-directory-hierarchy[Runner Directory]
+* **ssl-ca-directory**: A optional [workspace](https://github.com/tektoncd/pipeline/blob/main/docs/workspaces.md) to hold the ca_certs for custom certificate authorities.
## Platforms
@@ -47,7 +49,7 @@ All the examples will be run in namespace called `funstuff`. Create the namespac
```shell
kubectl apply -f https://api.hub.tekton.dev/v1/resource/tekton/task/git-clone/0.5/raw \
- -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.2/support/playbooks-pvc.yaml
+ -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.3/support/playbooks-pvc.yaml
```
Do the git clone of the examples repository:
@@ -66,7 +68,7 @@ tkn task start git-clone \
As we will do get, list and create on the namespace, lets use a service account that has right RBAC:
```shell
-kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.2/support/ansible-deployer.yaml
+kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.3/support/ansible-deployer.yaml
```
### Run Tasks
diff --git a/task/ansible-runner/0.2/ansible-runner.yaml b/task/ansible-runner/0.3/ansible-runner.yaml
index d047c75..9e5a844 100644
--- a/task/ansible-runner/0.2/ansible-runner.yaml
+++ b/task/ansible-runner/0.3/ansible-runner.yaml
@@ -1,14 +1,14 @@
---
-apiVersion: tekton.dev/v1beta1
+apiVersion: tekton.dev/v1
kind: Task
metadata:
name: ansible-runner
labels:
- app.kubernetes.io/version: '0.2'
- app.kubernetes.io/ansible-version: '2.12.5'
+ app.kubernetes.io/version: '0.3'
+ app.kubernetes.io/ansible-version: '2.18.2'
annotations:
- tekton.dev/deprecated: "true"
- tekton.dev/pipelines.minVersion: '0.12.1'
+ tekton.dev/deprecated: "false"
+ tekton.dev/pipelines.minVersion: '0.19.0'
tekton.dev/categories: CLI
tekton.dev/tags: cli
tekton.dev/displayName: 'Ansible Runner'
@@ -20,6 +20,12 @@ spec:
workspaces:
- name: runner-dir
description: The Ansibler runner directory
+ - name: ssl-ca-directory
+ optional: true
+ description: |
+ A Workspace containing CA certificates, this will be used by Ansible and pip to
+ verify the peer with when interacting with remote repositories using
+ HTTPS.
params:
- name: project-dir
description: The project directory under the workspace runner-dir
@@ -34,11 +40,16 @@ spec:
default: /tekton/home
- name: image
description: Ansible runner image.
- default: quay.io/ansible/ansible-runner:stable-2.12-latest #tag: stable-2.12-latest
+ default: ghcr.io/ansible/community-ansible-dev-tools:v25.5.1 #tag: v25.5.1
+ - name: workspaces_ssl_ca_file
+ default: "ca-bundle.crt"
+
stepTemplate:
env:
- name: HOME
value: $(params.user-home)
+ - name: CURL_CA_BUNDLE
+ value: "$(workspaces.ssl-ca-directory.path)/$(params.workspaces_ssl_ca_file)"
steps:
- name: requirements
image: $(params.image)
@@ -63,9 +74,8 @@ spec:
- name: run-playbook
image: $(params.image)
- command: ['entrypoint']
+ command: ['ansible-runner']
args:
- - ansible-runner
- run
- $(params.args)
- $(params.project-dir)
diff --git a/task/ansible-runner/0.2/tests/pre-apply-task-hook.sh b/task/ansible-runner/0.3/tests/pre-apply-task-hook.sh
old mode 100755
new mode 100644
diff --git a/task/ansible-runner/0.2/tests/resources.yaml b/task/ansible-runner/0.3/tests/resources.yaml
index b8c0a41..e091721 100644
--- a/task/ansible-runner/0.2/tests/resources.yaml
+++ b/task/ansible-runner/0.3/tests/resources.yaml
@@ -14,7 +14,7 @@ apiVersion: v1
kind: ServiceAccount
metadata:
name: ansible-deployer-account
- namespace: ansible-runner-0-2
+ namespace: ansible-runner-0-3
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
@@ -41,7 +41,7 @@ metadata:
subjects:
- kind: ServiceAccount
name: ansible-deployer-account
- namespace: ansible-runner-0-2
+ namespace: ansible-runner-0-3
roleRef:
kind: ClusterRole
name: ansible-deployer
diff --git a/task/ansible-runner/0.2/tests/run.yaml b/task/ansible-runner/0.3/tests/run.yaml
index 3d5c009..1c39dbc 100644
--- a/task/ansible-runner/0.2/tests/run.yaml
+++ b/task/ansible-runner/0.3/tests/run.yaml
@@ -1,5 +1,5 @@
---
-apiVersion: tekton.dev/v1beta1
+apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: ansibler-runner-pipeline
@@ -8,6 +8,8 @@ spec:
- name: runner-dir
tasks:
- name: fetch-repository
+ taskRunTemplate:
+ serviceAccountName: sa-1
taskRef:
name: git-clone
workspaces:
@@ -23,6 +25,8 @@ spec:
value: 'true'
# ansible-runner
- name: ansible-runner-run
+ taskRunTemplate:
+ serviceAccountName: sa-1
taskRef:
name: ansible-runner
runAfter:
@@ -37,7 +41,7 @@ spec:
value: ['-p', 'list-pods.yml']
---
-apiVersion: tekton.dev/v1beta1
+apiVersion: tekton.dev/v1
kind: PipelineRun
metadata:
name: ansibler-runner-pipeline-run |
Diff between version 0.2 and 0.3diff --git a/task/ansible-runner/0.2/README.md b/task/ansible-runner/0.3/README.md
index 257bc2d..bf96ba0 100644
--- a/task/ansible-runner/0.2/README.md
+++ b/task/ansible-runner/0.3/README.md
@@ -9,7 +9,7 @@ The latest versions of ansible-runner requires [`community.general`](https://git
Create the Task and other resources:
```shell
-kubectl apply --filename https://api.hub.tekton.dev/v1/resource/tekton/task/ansible-runner/0.2/raw
+kubectl apply --filename https://api.hub.tekton.dev/v1/resource/tekton/task/ansible-runner/0.3/raw
```
Verify the created tasks:
@@ -23,10 +23,12 @@ tkn task ls
* **project-dir**: The ansible-runner private data dir
* **args:**: The array of arguments to pass to the runner command (_default:_ --help)
* **user-home**: Absolute path to the user's home directory. (_default:_ /tekton/home)
+* **workspaces_ssl_ca_file**: file name of ca bundle. (_default:_ ca-bundle.crt)
## Workspaces
* **runner-dir**: A [workspace](https://github.com/tektoncd/pipeline/blob/main/docs/workspaces.md) to hold the `private_data_dir` as described in https://ansible-runner.readthedocs.io/en/latest/intro.html#runner-input-directory-hierarchy[Runner Directory]
+* **ssl-ca-directory**: A optional [workspace](https://github.com/tektoncd/pipeline/blob/main/docs/workspaces.md) to hold the ca_certs for custom certificate authorities.
## Platforms
@@ -47,7 +49,7 @@ All the examples will be run in namespace called `funstuff`. Create the namespac
```shell
kubectl apply -f https://api.hub.tekton.dev/v1/resource/tekton/task/git-clone/0.5/raw \
- -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.2/support/playbooks-pvc.yaml
+ -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.3/support/playbooks-pvc.yaml
```
Do the git clone of the examples repository:
@@ -66,7 +68,7 @@ tkn task start git-clone \
As we will do get, list and create on the namespace, lets use a service account that has right RBAC:
```shell
-kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.2/support/ansible-deployer.yaml
+kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.3/support/ansible-deployer.yaml
```
### Run Tasks
diff --git a/task/ansible-runner/0.2/ansible-runner.yaml b/task/ansible-runner/0.3/ansible-runner.yaml
index d047c75..9e5a844 100644
--- a/task/ansible-runner/0.2/ansible-runner.yaml
+++ b/task/ansible-runner/0.3/ansible-runner.yaml
@@ -1,14 +1,14 @@
---
-apiVersion: tekton.dev/v1beta1
+apiVersion: tekton.dev/v1
kind: Task
metadata:
name: ansible-runner
labels:
- app.kubernetes.io/version: '0.2'
- app.kubernetes.io/ansible-version: '2.12.5'
+ app.kubernetes.io/version: '0.3'
+ app.kubernetes.io/ansible-version: '2.18.2'
annotations:
- tekton.dev/deprecated: "true"
- tekton.dev/pipelines.minVersion: '0.12.1'
+ tekton.dev/deprecated: "false"
+ tekton.dev/pipelines.minVersion: '0.19.0'
tekton.dev/categories: CLI
tekton.dev/tags: cli
tekton.dev/displayName: 'Ansible Runner'
@@ -20,6 +20,12 @@ spec:
workspaces:
- name: runner-dir
description: The Ansibler runner directory
+ - name: ssl-ca-directory
+ optional: true
+ description: |
+ A Workspace containing CA certificates, this will be used by Ansible and pip to
+ verify the peer with when interacting with remote repositories using
+ HTTPS.
params:
- name: project-dir
description: The project directory under the workspace runner-dir
@@ -34,11 +40,16 @@ spec:
default: /tekton/home
- name: image
description: Ansible runner image.
- default: quay.io/ansible/ansible-runner:stable-2.12-latest #tag: stable-2.12-latest
+ default: ghcr.io/ansible/community-ansible-dev-tools:v25.5.1 #tag: v25.5.1
+ - name: workspaces_ssl_ca_file
+ default: "ca-bundle.crt"
+
stepTemplate:
env:
- name: HOME
value: $(params.user-home)
+ - name: CURL_CA_BUNDLE
+ value: "$(workspaces.ssl-ca-directory.path)/$(params.workspaces_ssl_ca_file)"
steps:
- name: requirements
image: $(params.image)
@@ -63,9 +74,8 @@ spec:
- name: run-playbook
image: $(params.image)
- command: ['entrypoint']
+ command: ['ansible-runner']
args:
- - ansible-runner
- run
- $(params.args)
- $(params.project-dir)
diff --git a/task/ansible-runner/0.2/tests/pre-apply-task-hook.sh b/task/ansible-runner/0.3/tests/pre-apply-task-hook.sh
old mode 100755
new mode 100644
diff --git a/task/ansible-runner/0.2/tests/resources.yaml b/task/ansible-runner/0.3/tests/resources.yaml
index b8c0a41..e091721 100644
--- a/task/ansible-runner/0.2/tests/resources.yaml
+++ b/task/ansible-runner/0.3/tests/resources.yaml
@@ -14,7 +14,7 @@ apiVersion: v1
kind: ServiceAccount
metadata:
name: ansible-deployer-account
- namespace: ansible-runner-0-2
+ namespace: ansible-runner-0-3
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
@@ -41,7 +41,7 @@ metadata:
subjects:
- kind: ServiceAccount
name: ansible-deployer-account
- namespace: ansible-runner-0-2
+ namespace: ansible-runner-0-3
roleRef:
kind: ClusterRole
name: ansible-deployer
diff --git a/task/ansible-runner/0.2/tests/run.yaml b/task/ansible-runner/0.3/tests/run.yaml
index 3d5c009..def3440 100644
--- a/task/ansible-runner/0.2/tests/run.yaml
+++ b/task/ansible-runner/0.3/tests/run.yaml
@@ -1,5 +1,5 @@
---
-apiVersion: tekton.dev/v1beta1
+apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: ansibler-runner-pipeline
@@ -8,6 +8,8 @@ spec:
- name: runner-dir
tasks:
- name: fetch-repository
+ taskRunTemplate:
+ serviceAccountName: ansible-deployer-account
taskRef:
name: git-clone
workspaces:
@@ -23,6 +25,8 @@ spec:
value: 'true'
# ansible-runner
- name: ansible-runner-run
+ taskRunTemplate:
+ serviceAccountName: ansible-deployer-account
taskRef:
name: ansible-runner
runAfter:
@@ -37,7 +41,7 @@ spec:
value: ['-p', 'list-pods.yml']
---
-apiVersion: tekton.dev/v1beta1
+apiVersion: tekton.dev/v1
kind: PipelineRun
metadata:
name: ansibler-runner-pipeline-run |
Diff between version 0.2 and 0.3diff --git a/task/ansible-runner/0.2/README.md b/task/ansible-runner/0.3/README.md
index 257bc2d..bf96ba0 100644
--- a/task/ansible-runner/0.2/README.md
+++ b/task/ansible-runner/0.3/README.md
@@ -9,7 +9,7 @@ The latest versions of ansible-runner requires [`community.general`](https://git
Create the Task and other resources:
```shell
-kubectl apply --filename https://api.hub.tekton.dev/v1/resource/tekton/task/ansible-runner/0.2/raw
+kubectl apply --filename https://api.hub.tekton.dev/v1/resource/tekton/task/ansible-runner/0.3/raw
```
Verify the created tasks:
@@ -23,10 +23,12 @@ tkn task ls
* **project-dir**: The ansible-runner private data dir
* **args:**: The array of arguments to pass to the runner command (_default:_ --help)
* **user-home**: Absolute path to the user's home directory. (_default:_ /tekton/home)
+* **workspaces_ssl_ca_file**: file name of ca bundle. (_default:_ ca-bundle.crt)
## Workspaces
* **runner-dir**: A [workspace](https://github.com/tektoncd/pipeline/blob/main/docs/workspaces.md) to hold the `private_data_dir` as described in https://ansible-runner.readthedocs.io/en/latest/intro.html#runner-input-directory-hierarchy[Runner Directory]
+* **ssl-ca-directory**: A optional [workspace](https://github.com/tektoncd/pipeline/blob/main/docs/workspaces.md) to hold the ca_certs for custom certificate authorities.
## Platforms
@@ -47,7 +49,7 @@ All the examples will be run in namespace called `funstuff`. Create the namespac
```shell
kubectl apply -f https://api.hub.tekton.dev/v1/resource/tekton/task/git-clone/0.5/raw \
- -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.2/support/playbooks-pvc.yaml
+ -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.3/support/playbooks-pvc.yaml
```
Do the git clone of the examples repository:
@@ -66,7 +68,7 @@ tkn task start git-clone \
As we will do get, list and create on the namespace, lets use a service account that has right RBAC:
```shell
-kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.2/support/ansible-deployer.yaml
+kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.3/support/ansible-deployer.yaml
```
### Run Tasks
diff --git a/task/ansible-runner/0.2/ansible-runner.yaml b/task/ansible-runner/0.3/ansible-runner.yaml
index d047c75..9e5a844 100644
--- a/task/ansible-runner/0.2/ansible-runner.yaml
+++ b/task/ansible-runner/0.3/ansible-runner.yaml
@@ -1,14 +1,14 @@
---
-apiVersion: tekton.dev/v1beta1
+apiVersion: tekton.dev/v1
kind: Task
metadata:
name: ansible-runner
labels:
- app.kubernetes.io/version: '0.2'
- app.kubernetes.io/ansible-version: '2.12.5'
+ app.kubernetes.io/version: '0.3'
+ app.kubernetes.io/ansible-version: '2.18.2'
annotations:
- tekton.dev/deprecated: "true"
- tekton.dev/pipelines.minVersion: '0.12.1'
+ tekton.dev/deprecated: "false"
+ tekton.dev/pipelines.minVersion: '0.19.0'
tekton.dev/categories: CLI
tekton.dev/tags: cli
tekton.dev/displayName: 'Ansible Runner'
@@ -20,6 +20,12 @@ spec:
workspaces:
- name: runner-dir
description: The Ansibler runner directory
+ - name: ssl-ca-directory
+ optional: true
+ description: |
+ A Workspace containing CA certificates, this will be used by Ansible and pip to
+ verify the peer with when interacting with remote repositories using
+ HTTPS.
params:
- name: project-dir
description: The project directory under the workspace runner-dir
@@ -34,11 +40,16 @@ spec:
default: /tekton/home
- name: image
description: Ansible runner image.
- default: quay.io/ansible/ansible-runner:stable-2.12-latest #tag: stable-2.12-latest
+ default: ghcr.io/ansible/community-ansible-dev-tools:v25.5.1 #tag: v25.5.1
+ - name: workspaces_ssl_ca_file
+ default: "ca-bundle.crt"
+
stepTemplate:
env:
- name: HOME
value: $(params.user-home)
+ - name: CURL_CA_BUNDLE
+ value: "$(workspaces.ssl-ca-directory.path)/$(params.workspaces_ssl_ca_file)"
steps:
- name: requirements
image: $(params.image)
@@ -63,9 +74,8 @@ spec:
- name: run-playbook
image: $(params.image)
- command: ['entrypoint']
+ command: ['ansible-runner']
args:
- - ansible-runner
- run
- $(params.args)
- $(params.project-dir)
diff --git a/task/ansible-runner/0.2/tests/pre-apply-task-hook.sh b/task/ansible-runner/0.3/tests/pre-apply-task-hook.sh
old mode 100755
new mode 100644
diff --git a/task/ansible-runner/0.2/tests/resources.yaml b/task/ansible-runner/0.3/tests/resources.yaml
index b8c0a41..e091721 100644
--- a/task/ansible-runner/0.2/tests/resources.yaml
+++ b/task/ansible-runner/0.3/tests/resources.yaml
@@ -14,7 +14,7 @@ apiVersion: v1
kind: ServiceAccount
metadata:
name: ansible-deployer-account
- namespace: ansible-runner-0-2
+ namespace: ansible-runner-0-3
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
@@ -41,7 +41,7 @@ metadata:
subjects:
- kind: ServiceAccount
name: ansible-deployer-account
- namespace: ansible-runner-0-2
+ namespace: ansible-runner-0-3
roleRef:
kind: ClusterRole
name: ansible-deployer
diff --git a/task/ansible-runner/0.2/tests/run.yaml b/task/ansible-runner/0.3/tests/run.yaml
index 3d5c009..021b90e 100644
--- a/task/ansible-runner/0.2/tests/run.yaml
+++ b/task/ansible-runner/0.3/tests/run.yaml
@@ -1,5 +1,5 @@
---
-apiVersion: tekton.dev/v1beta1
+apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: ansibler-runner-pipeline
@@ -37,12 +37,13 @@ spec:
value: ['-p', 'list-pods.yml']
---
-apiVersion: tekton.dev/v1beta1
+apiVersion: tekton.dev/v1
kind: PipelineRun
metadata:
name: ansibler-runner-pipeline-run
spec:
- serviceAccountName: ansible-deployer-account
+ taskRunTemplate:
+ serviceAccountName: ansible-deployer-account
pipelineRef:
name: ansibler-runner-pipeline
workspaces: |
Diff between version 0.2 and 0.3diff --git a/task/ansible-runner/0.2/README.md b/task/ansible-runner/0.3/README.md
index 257bc2d..bf96ba0 100644
--- a/task/ansible-runner/0.2/README.md
+++ b/task/ansible-runner/0.3/README.md
@@ -9,7 +9,7 @@ The latest versions of ansible-runner requires [`community.general`](https://git
Create the Task and other resources:
```shell
-kubectl apply --filename https://api.hub.tekton.dev/v1/resource/tekton/task/ansible-runner/0.2/raw
+kubectl apply --filename https://api.hub.tekton.dev/v1/resource/tekton/task/ansible-runner/0.3/raw
```
Verify the created tasks:
@@ -23,10 +23,12 @@ tkn task ls
* **project-dir**: The ansible-runner private data dir
* **args:**: The array of arguments to pass to the runner command (_default:_ --help)
* **user-home**: Absolute path to the user's home directory. (_default:_ /tekton/home)
+* **workspaces_ssl_ca_file**: file name of ca bundle. (_default:_ ca-bundle.crt)
## Workspaces
* **runner-dir**: A [workspace](https://github.com/tektoncd/pipeline/blob/main/docs/workspaces.md) to hold the `private_data_dir` as described in https://ansible-runner.readthedocs.io/en/latest/intro.html#runner-input-directory-hierarchy[Runner Directory]
+* **ssl-ca-directory**: A optional [workspace](https://github.com/tektoncd/pipeline/blob/main/docs/workspaces.md) to hold the ca_certs for custom certificate authorities.
## Platforms
@@ -47,7 +49,7 @@ All the examples will be run in namespace called `funstuff`. Create the namespac
```shell
kubectl apply -f https://api.hub.tekton.dev/v1/resource/tekton/task/git-clone/0.5/raw \
- -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.2/support/playbooks-pvc.yaml
+ -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.3/support/playbooks-pvc.yaml
```
Do the git clone of the examples repository:
@@ -66,7 +68,7 @@ tkn task start git-clone \
As we will do get, list and create on the namespace, lets use a service account that has right RBAC:
```shell
-kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.2/support/ansible-deployer.yaml
+kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.3/support/ansible-deployer.yaml
```
### Run Tasks
diff --git a/task/ansible-runner/0.2/ansible-runner.yaml b/task/ansible-runner/0.3/ansible-runner.yaml
index d047c75..a34b141 100644
--- a/task/ansible-runner/0.2/ansible-runner.yaml
+++ b/task/ansible-runner/0.3/ansible-runner.yaml
@@ -1,14 +1,14 @@
---
-apiVersion: tekton.dev/v1beta1
+apiVersion: tekton.dev/v1
kind: Task
metadata:
name: ansible-runner
labels:
- app.kubernetes.io/version: '0.2'
- app.kubernetes.io/ansible-version: '2.12.5'
+ app.kubernetes.io/version: '0.3'
+ app.kubernetes.io/ansible-version: '2.18.2'
annotations:
- tekton.dev/deprecated: "true"
- tekton.dev/pipelines.minVersion: '0.12.1'
+ tekton.dev/deprecated: "false"
+ tekton.dev/pipelines.minVersion: '0.19.0'
tekton.dev/categories: CLI
tekton.dev/tags: cli
tekton.dev/displayName: 'Ansible Runner'
@@ -20,6 +20,12 @@ spec:
workspaces:
- name: runner-dir
description: The Ansibler runner directory
+ - name: ssl-ca-directory
+ optional: true
+ description: |
+ A Workspace containing CA certificates, this will be used by Ansible and pip to
+ verify the peer with when interacting with remote repositories using
+ HTTPS.
params:
- name: project-dir
description: The project directory under the workspace runner-dir
@@ -34,11 +40,16 @@ spec:
default: /tekton/home
- name: image
description: Ansible runner image.
- default: quay.io/ansible/ansible-runner:stable-2.12-latest #tag: stable-2.12-latest
+ default: ghcr.io/ansible/community-ansible-dev-tools:v25.5.1 #tag: v25.5.1
+ - name: workspaces_ssl_ca_file
+ default: ""
+
stepTemplate:
env:
- name: HOME
value: $(params.user-home)
+ - name: CURL_CA_BUNDLE
+ value: "$(workspaces.ssl-ca-directory.path)/$(params.workspaces_ssl_ca_file)"
steps:
- name: requirements
image: $(params.image)
@@ -59,13 +70,12 @@ spec:
ansible-galaxy collection install -vv \
-r requirements.yml
fi
- workingDir: '$(workspaces.runner-dir.path)/$(params.project-dir)'
+ workingDir: '$(workspaces.runner-dir.path)$(params.project-dir)'
- name: run-playbook
image: $(params.image)
- command: ['entrypoint']
+ command: ['ansible-runner']
args:
- - ansible-runner
- run
- $(params.args)
- $(params.project-dir)
diff --git a/task/ansible-runner/0.2/tests/pre-apply-task-hook.sh b/task/ansible-runner/0.3/tests/pre-apply-task-hook.sh
old mode 100755
new mode 100644
diff --git a/task/ansible-runner/0.2/tests/resources.yaml b/task/ansible-runner/0.3/tests/resources.yaml
index b8c0a41..e091721 100644
--- a/task/ansible-runner/0.2/tests/resources.yaml
+++ b/task/ansible-runner/0.3/tests/resources.yaml
@@ -14,7 +14,7 @@ apiVersion: v1
kind: ServiceAccount
metadata:
name: ansible-deployer-account
- namespace: ansible-runner-0-2
+ namespace: ansible-runner-0-3
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
@@ -41,7 +41,7 @@ metadata:
subjects:
- kind: ServiceAccount
name: ansible-deployer-account
- namespace: ansible-runner-0-2
+ namespace: ansible-runner-0-3
roleRef:
kind: ClusterRole
name: ansible-deployer
diff --git a/task/ansible-runner/0.2/tests/run.yaml b/task/ansible-runner/0.3/tests/run.yaml
index 3d5c009..021b90e 100644
--- a/task/ansible-runner/0.2/tests/run.yaml
+++ b/task/ansible-runner/0.3/tests/run.yaml
@@ -1,5 +1,5 @@
---
-apiVersion: tekton.dev/v1beta1
+apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: ansibler-runner-pipeline
@@ -37,12 +37,13 @@ spec:
value: ['-p', 'list-pods.yml']
---
-apiVersion: tekton.dev/v1beta1
+apiVersion: tekton.dev/v1
kind: PipelineRun
metadata:
name: ansibler-runner-pipeline-run
spec:
- serviceAccountName: ansible-deployer-account
+ taskRunTemplate:
+ serviceAccountName: ansible-deployer-account
pipelineRef:
name: ansibler-runner-pipeline
workspaces: |
Diff between version 0.2 and 0.3diff --git a/task/ansible-runner/0.2/README.md b/task/ansible-runner/0.3/README.md
index 257bc2d..bf96ba0 100644
--- a/task/ansible-runner/0.2/README.md
+++ b/task/ansible-runner/0.3/README.md
@@ -9,7 +9,7 @@ The latest versions of ansible-runner requires [`community.general`](https://git
Create the Task and other resources:
```shell
-kubectl apply --filename https://api.hub.tekton.dev/v1/resource/tekton/task/ansible-runner/0.2/raw
+kubectl apply --filename https://api.hub.tekton.dev/v1/resource/tekton/task/ansible-runner/0.3/raw
```
Verify the created tasks:
@@ -23,10 +23,12 @@ tkn task ls
* **project-dir**: The ansible-runner private data dir
* **args:**: The array of arguments to pass to the runner command (_default:_ --help)
* **user-home**: Absolute path to the user's home directory. (_default:_ /tekton/home)
+* **workspaces_ssl_ca_file**: file name of ca bundle. (_default:_ ca-bundle.crt)
## Workspaces
* **runner-dir**: A [workspace](https://github.com/tektoncd/pipeline/blob/main/docs/workspaces.md) to hold the `private_data_dir` as described in https://ansible-runner.readthedocs.io/en/latest/intro.html#runner-input-directory-hierarchy[Runner Directory]
+* **ssl-ca-directory**: A optional [workspace](https://github.com/tektoncd/pipeline/blob/main/docs/workspaces.md) to hold the ca_certs for custom certificate authorities.
## Platforms
@@ -47,7 +49,7 @@ All the examples will be run in namespace called `funstuff`. Create the namespac
```shell
kubectl apply -f https://api.hub.tekton.dev/v1/resource/tekton/task/git-clone/0.5/raw \
- -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.2/support/playbooks-pvc.yaml
+ -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.3/support/playbooks-pvc.yaml
```
Do the git clone of the examples repository:
@@ -66,7 +68,7 @@ tkn task start git-clone \
As we will do get, list and create on the namespace, lets use a service account that has right RBAC:
```shell
-kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.2/support/ansible-deployer.yaml
+kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.3/support/ansible-deployer.yaml
```
### Run Tasks
diff --git a/task/ansible-runner/0.2/ansible-runner.yaml b/task/ansible-runner/0.3/ansible-runner.yaml
index d047c75..e8903c7 100644
--- a/task/ansible-runner/0.2/ansible-runner.yaml
+++ b/task/ansible-runner/0.3/ansible-runner.yaml
@@ -1,14 +1,14 @@
---
-apiVersion: tekton.dev/v1beta1
+apiVersion: tekton.dev/v1
kind: Task
metadata:
name: ansible-runner
labels:
- app.kubernetes.io/version: '0.2'
- app.kubernetes.io/ansible-version: '2.12.5'
+ app.kubernetes.io/version: '0.3'
+ app.kubernetes.io/ansible-version: '2.18.2'
annotations:
- tekton.dev/deprecated: "true"
- tekton.dev/pipelines.minVersion: '0.12.1'
+ tekton.dev/deprecated: "false"
+ tekton.dev/pipelines.minVersion: '0.19.0'
tekton.dev/categories: CLI
tekton.dev/tags: cli
tekton.dev/displayName: 'Ansible Runner'
@@ -20,6 +20,12 @@ spec:
workspaces:
- name: runner-dir
description: The Ansibler runner directory
+ - name: ssl-ca-directory
+ optional: true
+ description: |
+ A Workspace containing CA certificates, this will be used by Ansible and pip to
+ verify the peer with when interacting with remote repositories using
+ HTTPS.
params:
- name: project-dir
description: The project directory under the workspace runner-dir
@@ -34,11 +40,16 @@ spec:
default: /tekton/home
- name: image
description: Ansible runner image.
- default: quay.io/ansible/ansible-runner:stable-2.12-latest #tag: stable-2.12-latest
+ default: ghcr.io/ansible/community-ansible-dev-tools:v25.5.1 #tag: v25.5.1
+ - name: workspaces_ssl_ca_file
+ default: ""
+
stepTemplate:
env:
- name: HOME
value: $(params.user-home)
+ - name: CURL_CA_BUNDLE
+ value: "$(workspaces.ssl-ca-directory.path)$(params.workspaces_ssl_ca_file)"
steps:
- name: requirements
image: $(params.image)
@@ -63,9 +74,8 @@ spec:
- name: run-playbook
image: $(params.image)
- command: ['entrypoint']
+ command: ['ansible-runner']
args:
- - ansible-runner
- run
- $(params.args)
- $(params.project-dir)
diff --git a/task/ansible-runner/0.2/tests/pre-apply-task-hook.sh b/task/ansible-runner/0.3/tests/pre-apply-task-hook.sh
old mode 100755
new mode 100644
diff --git a/task/ansible-runner/0.2/tests/resources.yaml b/task/ansible-runner/0.3/tests/resources.yaml
index b8c0a41..e091721 100644
--- a/task/ansible-runner/0.2/tests/resources.yaml
+++ b/task/ansible-runner/0.3/tests/resources.yaml
@@ -14,7 +14,7 @@ apiVersion: v1
kind: ServiceAccount
metadata:
name: ansible-deployer-account
- namespace: ansible-runner-0-2
+ namespace: ansible-runner-0-3
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
@@ -41,7 +41,7 @@ metadata:
subjects:
- kind: ServiceAccount
name: ansible-deployer-account
- namespace: ansible-runner-0-2
+ namespace: ansible-runner-0-3
roleRef:
kind: ClusterRole
name: ansible-deployer
diff --git a/task/ansible-runner/0.2/tests/run.yaml b/task/ansible-runner/0.3/tests/run.yaml
index 3d5c009..021b90e 100644
--- a/task/ansible-runner/0.2/tests/run.yaml
+++ b/task/ansible-runner/0.3/tests/run.yaml
@@ -1,5 +1,5 @@
---
-apiVersion: tekton.dev/v1beta1
+apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: ansibler-runner-pipeline
@@ -37,12 +37,13 @@ spec:
value: ['-p', 'list-pods.yml']
---
-apiVersion: tekton.dev/v1beta1
+apiVersion: tekton.dev/v1
kind: PipelineRun
metadata:
name: ansibler-runner-pipeline-run
spec:
- serviceAccountName: ansible-deployer-account
+ taskRunTemplate:
+ serviceAccountName: ansible-deployer-account
pipelineRef:
name: ansibler-runner-pipeline
workspaces: |
Diff between version 0.2 and 0.3diff --git a/task/ansible-runner/0.2/README.md b/task/ansible-runner/0.3/README.md
index 257bc2d..bf96ba0 100644
--- a/task/ansible-runner/0.2/README.md
+++ b/task/ansible-runner/0.3/README.md
@@ -9,7 +9,7 @@ The latest versions of ansible-runner requires [`community.general`](https://git
Create the Task and other resources:
```shell
-kubectl apply --filename https://api.hub.tekton.dev/v1/resource/tekton/task/ansible-runner/0.2/raw
+kubectl apply --filename https://api.hub.tekton.dev/v1/resource/tekton/task/ansible-runner/0.3/raw
```
Verify the created tasks:
@@ -23,10 +23,12 @@ tkn task ls
* **project-dir**: The ansible-runner private data dir
* **args:**: The array of arguments to pass to the runner command (_default:_ --help)
* **user-home**: Absolute path to the user's home directory. (_default:_ /tekton/home)
+* **workspaces_ssl_ca_file**: file name of ca bundle. (_default:_ ca-bundle.crt)
## Workspaces
* **runner-dir**: A [workspace](https://github.com/tektoncd/pipeline/blob/main/docs/workspaces.md) to hold the `private_data_dir` as described in https://ansible-runner.readthedocs.io/en/latest/intro.html#runner-input-directory-hierarchy[Runner Directory]
+* **ssl-ca-directory**: A optional [workspace](https://github.com/tektoncd/pipeline/blob/main/docs/workspaces.md) to hold the ca_certs for custom certificate authorities.
## Platforms
@@ -47,7 +49,7 @@ All the examples will be run in namespace called `funstuff`. Create the namespac
```shell
kubectl apply -f https://api.hub.tekton.dev/v1/resource/tekton/task/git-clone/0.5/raw \
- -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.2/support/playbooks-pvc.yaml
+ -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.3/support/playbooks-pvc.yaml
```
Do the git clone of the examples repository:
@@ -66,7 +68,7 @@ tkn task start git-clone \
As we will do get, list and create on the namespace, lets use a service account that has right RBAC:
```shell
-kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.2/support/ansible-deployer.yaml
+kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.3/support/ansible-deployer.yaml
```
### Run Tasks
diff --git a/task/ansible-runner/0.2/ansible-runner.yaml b/task/ansible-runner/0.3/ansible-runner.yaml
index d047c75..e8903c7 100644
--- a/task/ansible-runner/0.2/ansible-runner.yaml
+++ b/task/ansible-runner/0.3/ansible-runner.yaml
@@ -1,14 +1,14 @@
---
-apiVersion: tekton.dev/v1beta1
+apiVersion: tekton.dev/v1
kind: Task
metadata:
name: ansible-runner
labels:
- app.kubernetes.io/version: '0.2'
- app.kubernetes.io/ansible-version: '2.12.5'
+ app.kubernetes.io/version: '0.3'
+ app.kubernetes.io/ansible-version: '2.18.2'
annotations:
- tekton.dev/deprecated: "true"
- tekton.dev/pipelines.minVersion: '0.12.1'
+ tekton.dev/deprecated: "false"
+ tekton.dev/pipelines.minVersion: '0.19.0'
tekton.dev/categories: CLI
tekton.dev/tags: cli
tekton.dev/displayName: 'Ansible Runner'
@@ -20,6 +20,12 @@ spec:
workspaces:
- name: runner-dir
description: The Ansibler runner directory
+ - name: ssl-ca-directory
+ optional: true
+ description: |
+ A Workspace containing CA certificates, this will be used by Ansible and pip to
+ verify the peer with when interacting with remote repositories using
+ HTTPS.
params:
- name: project-dir
description: The project directory under the workspace runner-dir
@@ -34,11 +40,16 @@ spec:
default: /tekton/home
- name: image
description: Ansible runner image.
- default: quay.io/ansible/ansible-runner:stable-2.12-latest #tag: stable-2.12-latest
+ default: ghcr.io/ansible/community-ansible-dev-tools:v25.5.1 #tag: v25.5.1
+ - name: workspaces_ssl_ca_file
+ default: ""
+
stepTemplate:
env:
- name: HOME
value: $(params.user-home)
+ - name: CURL_CA_BUNDLE
+ value: "$(workspaces.ssl-ca-directory.path)$(params.workspaces_ssl_ca_file)"
steps:
- name: requirements
image: $(params.image)
@@ -63,9 +74,8 @@ spec:
- name: run-playbook
image: $(params.image)
- command: ['entrypoint']
+ command: ['ansible-runner']
args:
- - ansible-runner
- run
- $(params.args)
- $(params.project-dir)
diff --git a/task/ansible-runner/0.2/tests/pre-apply-task-hook.sh b/task/ansible-runner/0.3/tests/pre-apply-task-hook.sh
old mode 100755
new mode 100644
diff --git a/task/ansible-runner/0.2/tests/resources.yaml b/task/ansible-runner/0.3/tests/resources.yaml
index b8c0a41..e091721 100644
--- a/task/ansible-runner/0.2/tests/resources.yaml
+++ b/task/ansible-runner/0.3/tests/resources.yaml
@@ -14,7 +14,7 @@ apiVersion: v1
kind: ServiceAccount
metadata:
name: ansible-deployer-account
- namespace: ansible-runner-0-2
+ namespace: ansible-runner-0-3
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
@@ -41,7 +41,7 @@ metadata:
subjects:
- kind: ServiceAccount
name: ansible-deployer-account
- namespace: ansible-runner-0-2
+ namespace: ansible-runner-0-3
roleRef:
kind: ClusterRole
name: ansible-deployer
diff --git a/task/ansible-runner/0.2/tests/run.yaml b/task/ansible-runner/0.3/tests/run.yaml
index 3d5c009..a28fd98 100644
--- a/task/ansible-runner/0.2/tests/run.yaml
+++ b/task/ansible-runner/0.3/tests/run.yaml
@@ -1,5 +1,5 @@
---
-apiVersion: tekton.dev/v1beta1
+apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: ansibler-runner-pipeline
@@ -16,9 +16,11 @@ spec:
params:
- name: url
value: |
- https://github.com/vinamra28/tektoncd-ansible-runner-example
+ https://github.com/sveno1990/catalog/
- name: revision
- value: 'master'
+ value: 'feature/ansible-runner-v0.3'
+ - name: pathInRepo
+ value: task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example
- name: deleteExisting
value: 'true'
# ansible-runner
@@ -37,12 +39,13 @@ spec:
value: ['-p', 'list-pods.yml']
---
-apiVersion: tekton.dev/v1beta1
+apiVersion: tekton.dev/v1
kind: PipelineRun
metadata:
name: ansibler-runner-pipeline-run
spec:
- serviceAccountName: ansible-deployer-account
+ taskRunTemplate:
+ serviceAccountName: ansible-deployer-account
pipelineRef:
name: ansibler-runner-pipeline
workspaces:
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/README.md b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/README.md
new file mode 100644
index 0000000..63e6e35
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/README.md
@@ -0,0 +1,65 @@
+# Tektoncd Ansible Runner Examples
+
+A repo to hold Ansible runner examples for the Tektoncd Task `ansible-runner`
+
+
+## Common Tasks
+
+```shell
+kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/master/task/git-clone/0.1/git-clone.yaml
+kubectl apply -f https://raw.githubusercontent.com/tektoncd-ansible-runner-example/catalog/master/playbooks-pvc.yaml
+```
+
+## Examples
+
+Run the following Task to clone this repository
+
+```shell
+tkn task start git-clone \
+ --workspace=name=output,claimName=ansible-playbooks \
+ --param=url=https://github.com/kameshsampath/tektoncd-ansible-runner-example \
+ --param=revision=master \
+ --param=deleteExisting=true \
+ --showlog
+```
+
+### Service Account
+
+You need proper RBAC in Kubernetes to allow it to perform the example tasks:
+
+```shell
+kubectl apply -f https://raw.githubusercontent.com/tektoncd-ansible-runner-example/master/kubernetes/ansible-deployer.yaml
+```
+
+### Listing pods
+
+```shell
+ tkn task start ansible-runner \
+ --serviceaccount ansible-deployer-account \
+ --param=project-dir=kubernetes \
+ --param=args='-p list-pods.yml' \
+ --workspace=name=runner-dir,claimName=ansible-playbooks \
+ --showlog
+```
+
+### Create Deployment
+
+```shell
+ tkn task start ansible-runner \
+ --serviceaccount ansible-deployer-account \
+ --param=project-dir=kubernetes \
+ --param=args='-p create-deployment.yml' \
+ --workspace=name=runner-dir,claimName=ansible-playbooks \
+ --showlog
+```
+
+### Create Service
+
+```shell
+ tkn task start ansible-runner \
+ --serviceaccount ansible-deployer-account \
+ --param=project-dir=kubernetes \
+ --param=args='-p create-service.yml' \
+ --workspace=name=runner-dir,claimName=ansible-playbooks \
+ --showlog
+```
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/ansible-deployer.yaml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/ansible-deployer.yaml
new file mode 100644
index 0000000..83ad1c0
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/ansible-deployer.yaml
@@ -0,0 +1,36 @@
+apiVersion: v1
+kind: ServiceAccount
+metadata:
+ name: ansible-deployer-account
+ namespace: default
+---
+kind: ClusterRole
+apiVersion: rbac.authorization.k8s.io/v1
+metadata:
+ name: ansible-deployer
+rules:
+ # Core API
+ - apiGroups: ['']
+ resources: ['services', 'pods', 'deployments', 'configmaps', 'secrets']
+ verbs: ['get', 'list', 'create', 'update', 'delete', 'patch', 'watch']
+ # Apps API
+ - apiGroups: ['apps']
+ resources: ['deployments', 'daemonsets', 'jobs']
+ verbs: ['get', 'list', 'create', 'update', 'delete', 'patch', 'watch']
+ # Knative API
+ - apiGroups: ['serving.knative.dev']
+ resources: ['services', 'revisions', 'routes']
+ verbs: ['get', 'list', 'create', 'update', 'delete', 'patch', 'watch']
+---
+apiVersion: rbac.authorization.k8s.io/v1beta1
+kind: ClusterRoleBinding
+metadata:
+ name: ansible-deployer-binding
+subjects:
+ - kind: ServiceAccount
+ name: ansible-deployer-account
+ namespace: default
+roleRef:
+ kind: ClusterRole
+ name: ansible-deployer
+ apiGroup: rbac.authorization.k8s.io
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-deployment.yml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-deployment.yml
new file mode 100644
index 0000000..1ff2d33
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-deployment.yml
@@ -0,0 +1,45 @@
+- hosts: localhost
+ connection: local
+ collections:
+ - community.kubernetes
+ tasks:
+ - name: Create a new deployment
+ k8s:
+ state: present
+ resource_definition: |
+ apiVersion: apps/v1
+ kind: Deployment
+ metadata:
+ name: helloworld
+ namespace: funstuff
+ spec:
+ selector:
+ matchLabels:
+ app: helloworld
+ template:
+ metadata:
+ labels:
+ app: helloworld
+ spec:
+ containers:
+ - name: helloworld
+ image: quay.io/kameshsampath/quarkus-helloworld
+ resources:
+ limits:
+ memory: "150Mi"
+ cpu: "500m"
+ ports:
+ - containerPort: 8080
+ wait: yes
+ register: helloworld_deployment
+ - name: Get the Deployment
+ k8s_info:
+ kind: Deployment
+ namespace: funstuff
+ register: funstuff_deployments_list
+ - name: Log Deployment Details
+ debug:
+ msg: "{{ item | json_query('metadata.name') }}"
+ loop: '{{funstuff_deployments_list.resources}}'
+ loop_control:
+ label: "Deployment (Namespace: {{item | json_query('metadata.namespace')}},Replicas:{{ item | json_query('spec.replicas')}})"
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-service.yml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-service.yml
new file mode 100644
index 0000000..ad8b5ce
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-service.yml
@@ -0,0 +1,33 @@
+- hosts: localhost
+ connection: local
+ collections:
+ - community.kubernetes
+ tasks:
+ - name: Create a new Service
+ k8s:
+ state: present
+ resource_definition: |
+ apiVersion: v1
+ kind: Service
+ metadata:
+ name: helloworld
+ namespace: funstuff
+ spec:
+ selector:
+ app: helloworld
+ ports:
+ - port: 8080
+ targetPort: 8080
+ wait: yes
+ register: helloworld_svc
+ - name: Get the Service
+ k8s_info:
+ kind: Service
+ namespace: funstuff
+ register: funstuff_service_list
+ - name: Log Service Details
+ debug:
+ msg: "{{ item | json_query('metadata.name') }}"
+ loop: '{{funstuff_service_list.resources}}'
+ loop_control:
+ label: "Service (Namespace: {{item | json_query('metadata.namespace')}})"
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/kustomization.yaml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/kustomization.yaml
new file mode 100644
index 0000000..590f43e
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/kustomization.yaml
@@ -0,0 +1,13 @@
+apiVersion: kustomize.config.k8s.io/v1beta1
+kind: Kustomization
+
+namespace: demos
+
+generatorOptions:
+ disableNameSuffixHash: true
+
+commonLabels:
+ tekton.dev/task: ansible-runner
+
+resources:
+ - ansible-deployer.yaml
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/list-pods.yml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/list-pods.yml
new file mode 100644
index 0000000..33d2063
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/list-pods.yml
@@ -0,0 +1,16 @@
+- hosts: localhost
+ connection: local
+ collections:
+ - community.kubernetes
+ tasks:
+ - name: List Pods in namespace
+ k8s_info:
+ kind: Pod
+ namespace: kube-system
+ register: kube_system_pods_list
+ - name: Show the list of pods
+ debug:
+ msg: "{{ item | json_query('metadata.name') }}"
+ loop: '{{kube_system_pods_list.resources}}'
+ loop_control:
+ label: "Pod(Namespace: {{item | json_query('metadata.namespace') }})"
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.txt b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.txt
new file mode 100644
index 0000000..60af612
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.txt
@@ -0,0 +1,3 @@
+kubernetes>=24.2.0
+requests-oauthlib
+jsonpatch
\ No newline at end of file
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.yml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.yml
new file mode 100644
index 0000000..4d8d85c
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.yml
@@ -0,0 +1,6 @@
+---
+collections:
+ - name: community.kubernetes.core
+ version: 2.0.1
+ - name: community.general
+ version: 10.7.0
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/playbooks-pvc.yaml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/playbooks-pvc.yaml
new file mode 100644
index 0000000..5075f19
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/playbooks-pvc.yaml
@@ -0,0 +1,11 @@
+apiVersion: v1
+kind: PersistentVolumeClaim
+metadata:
+ name: ansible-playbooks
+spec:
+ accessModes:
+ - ReadWriteOnce
+ volumeMode: Filesystem
+ resources:
+ requests:
+ storage: 1Gi |
Diff between version 0.2 and 0.3diff --git a/task/ansible-runner/0.2/README.md b/task/ansible-runner/0.3/README.md
index 257bc2d..bf96ba0 100644
--- a/task/ansible-runner/0.2/README.md
+++ b/task/ansible-runner/0.3/README.md
@@ -9,7 +9,7 @@ The latest versions of ansible-runner requires [`community.general`](https://git
Create the Task and other resources:
```shell
-kubectl apply --filename https://api.hub.tekton.dev/v1/resource/tekton/task/ansible-runner/0.2/raw
+kubectl apply --filename https://api.hub.tekton.dev/v1/resource/tekton/task/ansible-runner/0.3/raw
```
Verify the created tasks:
@@ -23,10 +23,12 @@ tkn task ls
* **project-dir**: The ansible-runner private data dir
* **args:**: The array of arguments to pass to the runner command (_default:_ --help)
* **user-home**: Absolute path to the user's home directory. (_default:_ /tekton/home)
+* **workspaces_ssl_ca_file**: file name of ca bundle. (_default:_ ca-bundle.crt)
## Workspaces
* **runner-dir**: A [workspace](https://github.com/tektoncd/pipeline/blob/main/docs/workspaces.md) to hold the `private_data_dir` as described in https://ansible-runner.readthedocs.io/en/latest/intro.html#runner-input-directory-hierarchy[Runner Directory]
+* **ssl-ca-directory**: A optional [workspace](https://github.com/tektoncd/pipeline/blob/main/docs/workspaces.md) to hold the ca_certs for custom certificate authorities.
## Platforms
@@ -47,7 +49,7 @@ All the examples will be run in namespace called `funstuff`. Create the namespac
```shell
kubectl apply -f https://api.hub.tekton.dev/v1/resource/tekton/task/git-clone/0.5/raw \
- -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.2/support/playbooks-pvc.yaml
+ -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.3/support/playbooks-pvc.yaml
```
Do the git clone of the examples repository:
@@ -66,7 +68,7 @@ tkn task start git-clone \
As we will do get, list and create on the namespace, lets use a service account that has right RBAC:
```shell
-kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.2/support/ansible-deployer.yaml
+kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.3/support/ansible-deployer.yaml
```
### Run Tasks
diff --git a/task/ansible-runner/0.2/ansible-runner.yaml b/task/ansible-runner/0.3/ansible-runner.yaml
index d047c75..e8903c7 100644
--- a/task/ansible-runner/0.2/ansible-runner.yaml
+++ b/task/ansible-runner/0.3/ansible-runner.yaml
@@ -1,14 +1,14 @@
---
-apiVersion: tekton.dev/v1beta1
+apiVersion: tekton.dev/v1
kind: Task
metadata:
name: ansible-runner
labels:
- app.kubernetes.io/version: '0.2'
- app.kubernetes.io/ansible-version: '2.12.5'
+ app.kubernetes.io/version: '0.3'
+ app.kubernetes.io/ansible-version: '2.18.2'
annotations:
- tekton.dev/deprecated: "true"
- tekton.dev/pipelines.minVersion: '0.12.1'
+ tekton.dev/deprecated: "false"
+ tekton.dev/pipelines.minVersion: '0.19.0'
tekton.dev/categories: CLI
tekton.dev/tags: cli
tekton.dev/displayName: 'Ansible Runner'
@@ -20,6 +20,12 @@ spec:
workspaces:
- name: runner-dir
description: The Ansibler runner directory
+ - name: ssl-ca-directory
+ optional: true
+ description: |
+ A Workspace containing CA certificates, this will be used by Ansible and pip to
+ verify the peer with when interacting with remote repositories using
+ HTTPS.
params:
- name: project-dir
description: The project directory under the workspace runner-dir
@@ -34,11 +40,16 @@ spec:
default: /tekton/home
- name: image
description: Ansible runner image.
- default: quay.io/ansible/ansible-runner:stable-2.12-latest #tag: stable-2.12-latest
+ default: ghcr.io/ansible/community-ansible-dev-tools:v25.5.1 #tag: v25.5.1
+ - name: workspaces_ssl_ca_file
+ default: ""
+
stepTemplate:
env:
- name: HOME
value: $(params.user-home)
+ - name: CURL_CA_BUNDLE
+ value: "$(workspaces.ssl-ca-directory.path)$(params.workspaces_ssl_ca_file)"
steps:
- name: requirements
image: $(params.image)
@@ -63,9 +74,8 @@ spec:
- name: run-playbook
image: $(params.image)
- command: ['entrypoint']
+ command: ['ansible-runner']
args:
- - ansible-runner
- run
- $(params.args)
- $(params.project-dir)
diff --git a/task/ansible-runner/0.2/tests/pre-apply-task-hook.sh b/task/ansible-runner/0.3/tests/pre-apply-task-hook.sh
old mode 100755
new mode 100644
diff --git a/task/ansible-runner/0.2/tests/resources.yaml b/task/ansible-runner/0.3/tests/resources.yaml
index b8c0a41..e091721 100644
--- a/task/ansible-runner/0.2/tests/resources.yaml
+++ b/task/ansible-runner/0.3/tests/resources.yaml
@@ -14,7 +14,7 @@ apiVersion: v1
kind: ServiceAccount
metadata:
name: ansible-deployer-account
- namespace: ansible-runner-0-2
+ namespace: ansible-runner-0-3
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
@@ -41,7 +41,7 @@ metadata:
subjects:
- kind: ServiceAccount
name: ansible-deployer-account
- namespace: ansible-runner-0-2
+ namespace: ansible-runner-0-3
roleRef:
kind: ClusterRole
name: ansible-deployer
diff --git a/task/ansible-runner/0.2/tests/run.yaml b/task/ansible-runner/0.3/tests/run.yaml
index 3d5c009..a20c85b 100644
--- a/task/ansible-runner/0.2/tests/run.yaml
+++ b/task/ansible-runner/0.3/tests/run.yaml
@@ -1,5 +1,5 @@
---
-apiVersion: tekton.dev/v1beta1
+apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: ansibler-runner-pipeline
@@ -16,13 +16,16 @@ spec:
params:
- name: url
value: |
- https://github.com/vinamra28/tektoncd-ansible-runner-example
+ https://github.com/sveno1990/catalog/
- name: revision
- value: 'master'
+ value: 'feature/ansible-runner-v0.3'
+ - name: pathInRepo
+ value: task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example
- name: deleteExisting
value: 'true'
# ansible-runner
- name: ansible-runner-run
+ runAfter: fetch-repository
taskRef:
name: ansible-runner
runAfter:
@@ -37,12 +40,13 @@ spec:
value: ['-p', 'list-pods.yml']
---
-apiVersion: tekton.dev/v1beta1
+apiVersion: tekton.dev/v1
kind: PipelineRun
metadata:
name: ansibler-runner-pipeline-run
spec:
- serviceAccountName: ansible-deployer-account
+ taskRunTemplate:
+ serviceAccountName: ansible-deployer-account
pipelineRef:
name: ansibler-runner-pipeline
workspaces:
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/README.md b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/README.md
new file mode 100644
index 0000000..63e6e35
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/README.md
@@ -0,0 +1,65 @@
+# Tektoncd Ansible Runner Examples
+
+A repo to hold Ansible runner examples for the Tektoncd Task `ansible-runner`
+
+
+## Common Tasks
+
+```shell
+kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/master/task/git-clone/0.1/git-clone.yaml
+kubectl apply -f https://raw.githubusercontent.com/tektoncd-ansible-runner-example/catalog/master/playbooks-pvc.yaml
+```
+
+## Examples
+
+Run the following Task to clone this repository
+
+```shell
+tkn task start git-clone \
+ --workspace=name=output,claimName=ansible-playbooks \
+ --param=url=https://github.com/kameshsampath/tektoncd-ansible-runner-example \
+ --param=revision=master \
+ --param=deleteExisting=true \
+ --showlog
+```
+
+### Service Account
+
+You need proper RBAC in Kubernetes to allow it to perform the example tasks:
+
+```shell
+kubectl apply -f https://raw.githubusercontent.com/tektoncd-ansible-runner-example/master/kubernetes/ansible-deployer.yaml
+```
+
+### Listing pods
+
+```shell
+ tkn task start ansible-runner \
+ --serviceaccount ansible-deployer-account \
+ --param=project-dir=kubernetes \
+ --param=args='-p list-pods.yml' \
+ --workspace=name=runner-dir,claimName=ansible-playbooks \
+ --showlog
+```
+
+### Create Deployment
+
+```shell
+ tkn task start ansible-runner \
+ --serviceaccount ansible-deployer-account \
+ --param=project-dir=kubernetes \
+ --param=args='-p create-deployment.yml' \
+ --workspace=name=runner-dir,claimName=ansible-playbooks \
+ --showlog
+```
+
+### Create Service
+
+```shell
+ tkn task start ansible-runner \
+ --serviceaccount ansible-deployer-account \
+ --param=project-dir=kubernetes \
+ --param=args='-p create-service.yml' \
+ --workspace=name=runner-dir,claimName=ansible-playbooks \
+ --showlog
+```
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/ansible-deployer.yaml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/ansible-deployer.yaml
new file mode 100644
index 0000000..83ad1c0
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/ansible-deployer.yaml
@@ -0,0 +1,36 @@
+apiVersion: v1
+kind: ServiceAccount
+metadata:
+ name: ansible-deployer-account
+ namespace: default
+---
+kind: ClusterRole
+apiVersion: rbac.authorization.k8s.io/v1
+metadata:
+ name: ansible-deployer
+rules:
+ # Core API
+ - apiGroups: ['']
+ resources: ['services', 'pods', 'deployments', 'configmaps', 'secrets']
+ verbs: ['get', 'list', 'create', 'update', 'delete', 'patch', 'watch']
+ # Apps API
+ - apiGroups: ['apps']
+ resources: ['deployments', 'daemonsets', 'jobs']
+ verbs: ['get', 'list', 'create', 'update', 'delete', 'patch', 'watch']
+ # Knative API
+ - apiGroups: ['serving.knative.dev']
+ resources: ['services', 'revisions', 'routes']
+ verbs: ['get', 'list', 'create', 'update', 'delete', 'patch', 'watch']
+---
+apiVersion: rbac.authorization.k8s.io/v1beta1
+kind: ClusterRoleBinding
+metadata:
+ name: ansible-deployer-binding
+subjects:
+ - kind: ServiceAccount
+ name: ansible-deployer-account
+ namespace: default
+roleRef:
+ kind: ClusterRole
+ name: ansible-deployer
+ apiGroup: rbac.authorization.k8s.io
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-deployment.yml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-deployment.yml
new file mode 100644
index 0000000..1ff2d33
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-deployment.yml
@@ -0,0 +1,45 @@
+- hosts: localhost
+ connection: local
+ collections:
+ - community.kubernetes
+ tasks:
+ - name: Create a new deployment
+ k8s:
+ state: present
+ resource_definition: |
+ apiVersion: apps/v1
+ kind: Deployment
+ metadata:
+ name: helloworld
+ namespace: funstuff
+ spec:
+ selector:
+ matchLabels:
+ app: helloworld
+ template:
+ metadata:
+ labels:
+ app: helloworld
+ spec:
+ containers:
+ - name: helloworld
+ image: quay.io/kameshsampath/quarkus-helloworld
+ resources:
+ limits:
+ memory: "150Mi"
+ cpu: "500m"
+ ports:
+ - containerPort: 8080
+ wait: yes
+ register: helloworld_deployment
+ - name: Get the Deployment
+ k8s_info:
+ kind: Deployment
+ namespace: funstuff
+ register: funstuff_deployments_list
+ - name: Log Deployment Details
+ debug:
+ msg: "{{ item | json_query('metadata.name') }}"
+ loop: '{{funstuff_deployments_list.resources}}'
+ loop_control:
+ label: "Deployment (Namespace: {{item | json_query('metadata.namespace')}},Replicas:{{ item | json_query('spec.replicas')}})"
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-service.yml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-service.yml
new file mode 100644
index 0000000..ad8b5ce
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-service.yml
@@ -0,0 +1,33 @@
+- hosts: localhost
+ connection: local
+ collections:
+ - community.kubernetes
+ tasks:
+ - name: Create a new Service
+ k8s:
+ state: present
+ resource_definition: |
+ apiVersion: v1
+ kind: Service
+ metadata:
+ name: helloworld
+ namespace: funstuff
+ spec:
+ selector:
+ app: helloworld
+ ports:
+ - port: 8080
+ targetPort: 8080
+ wait: yes
+ register: helloworld_svc
+ - name: Get the Service
+ k8s_info:
+ kind: Service
+ namespace: funstuff
+ register: funstuff_service_list
+ - name: Log Service Details
+ debug:
+ msg: "{{ item | json_query('metadata.name') }}"
+ loop: '{{funstuff_service_list.resources}}'
+ loop_control:
+ label: "Service (Namespace: {{item | json_query('metadata.namespace')}})"
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/kustomization.yaml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/kustomization.yaml
new file mode 100644
index 0000000..590f43e
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/kustomization.yaml
@@ -0,0 +1,13 @@
+apiVersion: kustomize.config.k8s.io/v1beta1
+kind: Kustomization
+
+namespace: demos
+
+generatorOptions:
+ disableNameSuffixHash: true
+
+commonLabels:
+ tekton.dev/task: ansible-runner
+
+resources:
+ - ansible-deployer.yaml
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/list-pods.yml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/list-pods.yml
new file mode 100644
index 0000000..33d2063
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/list-pods.yml
@@ -0,0 +1,16 @@
+- hosts: localhost
+ connection: local
+ collections:
+ - community.kubernetes
+ tasks:
+ - name: List Pods in namespace
+ k8s_info:
+ kind: Pod
+ namespace: kube-system
+ register: kube_system_pods_list
+ - name: Show the list of pods
+ debug:
+ msg: "{{ item | json_query('metadata.name') }}"
+ loop: '{{kube_system_pods_list.resources}}'
+ loop_control:
+ label: "Pod(Namespace: {{item | json_query('metadata.namespace') }})"
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.txt b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.txt
new file mode 100644
index 0000000..60af612
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.txt
@@ -0,0 +1,3 @@
+kubernetes>=24.2.0
+requests-oauthlib
+jsonpatch
\ No newline at end of file
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.yml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.yml
new file mode 100644
index 0000000..4d8d85c
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.yml
@@ -0,0 +1,6 @@
+---
+collections:
+ - name: community.kubernetes.core
+ version: 2.0.1
+ - name: community.general
+ version: 10.7.0
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/playbooks-pvc.yaml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/playbooks-pvc.yaml
new file mode 100644
index 0000000..5075f19
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/playbooks-pvc.yaml
@@ -0,0 +1,11 @@
+apiVersion: v1
+kind: PersistentVolumeClaim
+metadata:
+ name: ansible-playbooks
+spec:
+ accessModes:
+ - ReadWriteOnce
+ volumeMode: Filesystem
+ resources:
+ requests:
+ storage: 1Gi |
Diff between version 0.2 and 0.3diff --git a/task/ansible-runner/0.2/README.md b/task/ansible-runner/0.3/README.md
index 257bc2d..bf96ba0 100644
--- a/task/ansible-runner/0.2/README.md
+++ b/task/ansible-runner/0.3/README.md
@@ -9,7 +9,7 @@ The latest versions of ansible-runner requires [`community.general`](https://git
Create the Task and other resources:
```shell
-kubectl apply --filename https://api.hub.tekton.dev/v1/resource/tekton/task/ansible-runner/0.2/raw
+kubectl apply --filename https://api.hub.tekton.dev/v1/resource/tekton/task/ansible-runner/0.3/raw
```
Verify the created tasks:
@@ -23,10 +23,12 @@ tkn task ls
* **project-dir**: The ansible-runner private data dir
* **args:**: The array of arguments to pass to the runner command (_default:_ --help)
* **user-home**: Absolute path to the user's home directory. (_default:_ /tekton/home)
+* **workspaces_ssl_ca_file**: file name of ca bundle. (_default:_ ca-bundle.crt)
## Workspaces
* **runner-dir**: A [workspace](https://github.com/tektoncd/pipeline/blob/main/docs/workspaces.md) to hold the `private_data_dir` as described in https://ansible-runner.readthedocs.io/en/latest/intro.html#runner-input-directory-hierarchy[Runner Directory]
+* **ssl-ca-directory**: A optional [workspace](https://github.com/tektoncd/pipeline/blob/main/docs/workspaces.md) to hold the ca_certs for custom certificate authorities.
## Platforms
@@ -47,7 +49,7 @@ All the examples will be run in namespace called `funstuff`. Create the namespac
```shell
kubectl apply -f https://api.hub.tekton.dev/v1/resource/tekton/task/git-clone/0.5/raw \
- -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.2/support/playbooks-pvc.yaml
+ -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.3/support/playbooks-pvc.yaml
```
Do the git clone of the examples repository:
@@ -66,7 +68,7 @@ tkn task start git-clone \
As we will do get, list and create on the namespace, lets use a service account that has right RBAC:
```shell
-kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.2/support/ansible-deployer.yaml
+kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.3/support/ansible-deployer.yaml
```
### Run Tasks
diff --git a/task/ansible-runner/0.2/ansible-runner.yaml b/task/ansible-runner/0.3/ansible-runner.yaml
index d047c75..c60f0eb 100644
--- a/task/ansible-runner/0.2/ansible-runner.yaml
+++ b/task/ansible-runner/0.3/ansible-runner.yaml
@@ -1,14 +1,14 @@
---
-apiVersion: tekton.dev/v1beta1
+apiVersion: tekton.dev/v1
kind: Task
metadata:
name: ansible-runner
labels:
- app.kubernetes.io/version: '0.2'
- app.kubernetes.io/ansible-version: '2.12.5'
+ app.kubernetes.io/version: '0.3'
+ app.kubernetes.io/ansible-version: '2.18.2'
annotations:
- tekton.dev/deprecated: "true"
- tekton.dev/pipelines.minVersion: '0.12.1'
+ tekton.dev/deprecated: "false"
+ tekton.dev/pipelines.minVersion: '0.19.0'
tekton.dev/categories: CLI
tekton.dev/tags: cli
tekton.dev/displayName: 'Ansible Runner'
@@ -20,10 +20,13 @@ spec:
workspaces:
- name: runner-dir
description: The Ansibler runner directory
+ - name: ssl-ca-directory
+ optional: true
+ description: |
+ A Workspace containing CA certificates, this will be used by Ansible and pip to
+ verify the peer with when interacting with remote repositories using
+ HTTPS.
params:
- - name: project-dir
- description: The project directory under the workspace runner-dir
- default: 'project'
- name: args
description: The arguments to pass ansible-runner
type: array
@@ -34,11 +37,16 @@ spec:
default: /tekton/home
- name: image
description: Ansible runner image.
- default: quay.io/ansible/ansible-runner:stable-2.12-latest #tag: stable-2.12-latest
+ default: ghcr.io/ansible/community-ansible-dev-tools:v25.5.1 #tag: v25.5.1
+ - name: workspaces_ssl_ca_file
+ default: ""
+
stepTemplate:
env:
- name: HOME
value: $(params.user-home)
+ - name: CURL_CA_BUNDLE
+ value: "$(workspaces.ssl-ca-directory.path)$(params.workspaces_ssl_ca_file)"
steps:
- name: requirements
image: $(params.image)
@@ -59,14 +67,12 @@ spec:
ansible-galaxy collection install -vv \
-r requirements.yml
fi
- workingDir: '$(workspaces.runner-dir.path)/$(params.project-dir)'
+ workingDir: '$(workspaces.runner-dir.path)'
- name: run-playbook
image: $(params.image)
- command: ['entrypoint']
+ command: ['ansible-runner']
args:
- - ansible-runner
- run
- $(params.args)
- - $(params.project-dir)
workingDir: '$(workspaces.runner-dir.path)'
diff --git a/task/ansible-runner/0.2/tests/pre-apply-task-hook.sh b/task/ansible-runner/0.3/tests/pre-apply-task-hook.sh
old mode 100755
new mode 100644
diff --git a/task/ansible-runner/0.2/tests/resources.yaml b/task/ansible-runner/0.3/tests/resources.yaml
index b8c0a41..e091721 100644
--- a/task/ansible-runner/0.2/tests/resources.yaml
+++ b/task/ansible-runner/0.3/tests/resources.yaml
@@ -14,7 +14,7 @@ apiVersion: v1
kind: ServiceAccount
metadata:
name: ansible-deployer-account
- namespace: ansible-runner-0-2
+ namespace: ansible-runner-0-3
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
@@ -41,7 +41,7 @@ metadata:
subjects:
- kind: ServiceAccount
name: ansible-deployer-account
- namespace: ansible-runner-0-2
+ namespace: ansible-runner-0-3
roleRef:
kind: ClusterRole
name: ansible-deployer
diff --git a/task/ansible-runner/0.2/tests/run.yaml b/task/ansible-runner/0.3/tests/run.yaml
index 3d5c009..a28fd98 100644
--- a/task/ansible-runner/0.2/tests/run.yaml
+++ b/task/ansible-runner/0.3/tests/run.yaml
@@ -1,5 +1,5 @@
---
-apiVersion: tekton.dev/v1beta1
+apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: ansibler-runner-pipeline
@@ -16,9 +16,11 @@ spec:
params:
- name: url
value: |
- https://github.com/vinamra28/tektoncd-ansible-runner-example
+ https://github.com/sveno1990/catalog/
- name: revision
- value: 'master'
+ value: 'feature/ansible-runner-v0.3'
+ - name: pathInRepo
+ value: task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example
- name: deleteExisting
value: 'true'
# ansible-runner
@@ -37,12 +39,13 @@ spec:
value: ['-p', 'list-pods.yml']
---
-apiVersion: tekton.dev/v1beta1
+apiVersion: tekton.dev/v1
kind: PipelineRun
metadata:
name: ansibler-runner-pipeline-run
spec:
- serviceAccountName: ansible-deployer-account
+ taskRunTemplate:
+ serviceAccountName: ansible-deployer-account
pipelineRef:
name: ansibler-runner-pipeline
workspaces:
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/README.md b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/README.md
new file mode 100644
index 0000000..63e6e35
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/README.md
@@ -0,0 +1,65 @@
+# Tektoncd Ansible Runner Examples
+
+A repo to hold Ansible runner examples for the Tektoncd Task `ansible-runner`
+
+
+## Common Tasks
+
+```shell
+kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/master/task/git-clone/0.1/git-clone.yaml
+kubectl apply -f https://raw.githubusercontent.com/tektoncd-ansible-runner-example/catalog/master/playbooks-pvc.yaml
+```
+
+## Examples
+
+Run the following Task to clone this repository
+
+```shell
+tkn task start git-clone \
+ --workspace=name=output,claimName=ansible-playbooks \
+ --param=url=https://github.com/kameshsampath/tektoncd-ansible-runner-example \
+ --param=revision=master \
+ --param=deleteExisting=true \
+ --showlog
+```
+
+### Service Account
+
+You need proper RBAC in Kubernetes to allow it to perform the example tasks:
+
+```shell
+kubectl apply -f https://raw.githubusercontent.com/tektoncd-ansible-runner-example/master/kubernetes/ansible-deployer.yaml
+```
+
+### Listing pods
+
+```shell
+ tkn task start ansible-runner \
+ --serviceaccount ansible-deployer-account \
+ --param=project-dir=kubernetes \
+ --param=args='-p list-pods.yml' \
+ --workspace=name=runner-dir,claimName=ansible-playbooks \
+ --showlog
+```
+
+### Create Deployment
+
+```shell
+ tkn task start ansible-runner \
+ --serviceaccount ansible-deployer-account \
+ --param=project-dir=kubernetes \
+ --param=args='-p create-deployment.yml' \
+ --workspace=name=runner-dir,claimName=ansible-playbooks \
+ --showlog
+```
+
+### Create Service
+
+```shell
+ tkn task start ansible-runner \
+ --serviceaccount ansible-deployer-account \
+ --param=project-dir=kubernetes \
+ --param=args='-p create-service.yml' \
+ --workspace=name=runner-dir,claimName=ansible-playbooks \
+ --showlog
+```
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/ansible-deployer.yaml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/ansible-deployer.yaml
new file mode 100644
index 0000000..83ad1c0
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/ansible-deployer.yaml
@@ -0,0 +1,36 @@
+apiVersion: v1
+kind: ServiceAccount
+metadata:
+ name: ansible-deployer-account
+ namespace: default
+---
+kind: ClusterRole
+apiVersion: rbac.authorization.k8s.io/v1
+metadata:
+ name: ansible-deployer
+rules:
+ # Core API
+ - apiGroups: ['']
+ resources: ['services', 'pods', 'deployments', 'configmaps', 'secrets']
+ verbs: ['get', 'list', 'create', 'update', 'delete', 'patch', 'watch']
+ # Apps API
+ - apiGroups: ['apps']
+ resources: ['deployments', 'daemonsets', 'jobs']
+ verbs: ['get', 'list', 'create', 'update', 'delete', 'patch', 'watch']
+ # Knative API
+ - apiGroups: ['serving.knative.dev']
+ resources: ['services', 'revisions', 'routes']
+ verbs: ['get', 'list', 'create', 'update', 'delete', 'patch', 'watch']
+---
+apiVersion: rbac.authorization.k8s.io/v1beta1
+kind: ClusterRoleBinding
+metadata:
+ name: ansible-deployer-binding
+subjects:
+ - kind: ServiceAccount
+ name: ansible-deployer-account
+ namespace: default
+roleRef:
+ kind: ClusterRole
+ name: ansible-deployer
+ apiGroup: rbac.authorization.k8s.io
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-deployment.yml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-deployment.yml
new file mode 100644
index 0000000..1ff2d33
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-deployment.yml
@@ -0,0 +1,45 @@
+- hosts: localhost
+ connection: local
+ collections:
+ - community.kubernetes
+ tasks:
+ - name: Create a new deployment
+ k8s:
+ state: present
+ resource_definition: |
+ apiVersion: apps/v1
+ kind: Deployment
+ metadata:
+ name: helloworld
+ namespace: funstuff
+ spec:
+ selector:
+ matchLabels:
+ app: helloworld
+ template:
+ metadata:
+ labels:
+ app: helloworld
+ spec:
+ containers:
+ - name: helloworld
+ image: quay.io/kameshsampath/quarkus-helloworld
+ resources:
+ limits:
+ memory: "150Mi"
+ cpu: "500m"
+ ports:
+ - containerPort: 8080
+ wait: yes
+ register: helloworld_deployment
+ - name: Get the Deployment
+ k8s_info:
+ kind: Deployment
+ namespace: funstuff
+ register: funstuff_deployments_list
+ - name: Log Deployment Details
+ debug:
+ msg: "{{ item | json_query('metadata.name') }}"
+ loop: '{{funstuff_deployments_list.resources}}'
+ loop_control:
+ label: "Deployment (Namespace: {{item | json_query('metadata.namespace')}},Replicas:{{ item | json_query('spec.replicas')}})"
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-service.yml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-service.yml
new file mode 100644
index 0000000..ad8b5ce
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-service.yml
@@ -0,0 +1,33 @@
+- hosts: localhost
+ connection: local
+ collections:
+ - community.kubernetes
+ tasks:
+ - name: Create a new Service
+ k8s:
+ state: present
+ resource_definition: |
+ apiVersion: v1
+ kind: Service
+ metadata:
+ name: helloworld
+ namespace: funstuff
+ spec:
+ selector:
+ app: helloworld
+ ports:
+ - port: 8080
+ targetPort: 8080
+ wait: yes
+ register: helloworld_svc
+ - name: Get the Service
+ k8s_info:
+ kind: Service
+ namespace: funstuff
+ register: funstuff_service_list
+ - name: Log Service Details
+ debug:
+ msg: "{{ item | json_query('metadata.name') }}"
+ loop: '{{funstuff_service_list.resources}}'
+ loop_control:
+ label: "Service (Namespace: {{item | json_query('metadata.namespace')}})"
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/kustomization.yaml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/kustomization.yaml
new file mode 100644
index 0000000..590f43e
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/kustomization.yaml
@@ -0,0 +1,13 @@
+apiVersion: kustomize.config.k8s.io/v1beta1
+kind: Kustomization
+
+namespace: demos
+
+generatorOptions:
+ disableNameSuffixHash: true
+
+commonLabels:
+ tekton.dev/task: ansible-runner
+
+resources:
+ - ansible-deployer.yaml
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/list-pods.yml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/list-pods.yml
new file mode 100644
index 0000000..33d2063
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/list-pods.yml
@@ -0,0 +1,16 @@
+- hosts: localhost
+ connection: local
+ collections:
+ - community.kubernetes
+ tasks:
+ - name: List Pods in namespace
+ k8s_info:
+ kind: Pod
+ namespace: kube-system
+ register: kube_system_pods_list
+ - name: Show the list of pods
+ debug:
+ msg: "{{ item | json_query('metadata.name') }}"
+ loop: '{{kube_system_pods_list.resources}}'
+ loop_control:
+ label: "Pod(Namespace: {{item | json_query('metadata.namespace') }})"
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.txt b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.txt
new file mode 100644
index 0000000..60af612
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.txt
@@ -0,0 +1,3 @@
+kubernetes>=24.2.0
+requests-oauthlib
+jsonpatch
\ No newline at end of file
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.yml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.yml
new file mode 100644
index 0000000..4d8d85c
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.yml
@@ -0,0 +1,6 @@
+---
+collections:
+ - name: community.kubernetes.core
+ version: 2.0.1
+ - name: community.general
+ version: 10.7.0
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/playbooks-pvc.yaml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/playbooks-pvc.yaml
new file mode 100644
index 0000000..5075f19
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/playbooks-pvc.yaml
@@ -0,0 +1,11 @@
+apiVersion: v1
+kind: PersistentVolumeClaim
+metadata:
+ name: ansible-playbooks
+spec:
+ accessModes:
+ - ReadWriteOnce
+ volumeMode: Filesystem
+ resources:
+ requests:
+ storage: 1Gi |
Diff between version 0.2 and 0.3diff --git a/task/ansible-runner/0.2/README.md b/task/ansible-runner/0.3/README.md
index 257bc2d..bf96ba0 100644
--- a/task/ansible-runner/0.2/README.md
+++ b/task/ansible-runner/0.3/README.md
@@ -9,7 +9,7 @@ The latest versions of ansible-runner requires [`community.general`](https://git
Create the Task and other resources:
```shell
-kubectl apply --filename https://api.hub.tekton.dev/v1/resource/tekton/task/ansible-runner/0.2/raw
+kubectl apply --filename https://api.hub.tekton.dev/v1/resource/tekton/task/ansible-runner/0.3/raw
```
Verify the created tasks:
@@ -23,10 +23,12 @@ tkn task ls
* **project-dir**: The ansible-runner private data dir
* **args:**: The array of arguments to pass to the runner command (_default:_ --help)
* **user-home**: Absolute path to the user's home directory. (_default:_ /tekton/home)
+* **workspaces_ssl_ca_file**: file name of ca bundle. (_default:_ ca-bundle.crt)
## Workspaces
* **runner-dir**: A [workspace](https://github.com/tektoncd/pipeline/blob/main/docs/workspaces.md) to hold the `private_data_dir` as described in https://ansible-runner.readthedocs.io/en/latest/intro.html#runner-input-directory-hierarchy[Runner Directory]
+* **ssl-ca-directory**: A optional [workspace](https://github.com/tektoncd/pipeline/blob/main/docs/workspaces.md) to hold the ca_certs for custom certificate authorities.
## Platforms
@@ -47,7 +49,7 @@ All the examples will be run in namespace called `funstuff`. Create the namespac
```shell
kubectl apply -f https://api.hub.tekton.dev/v1/resource/tekton/task/git-clone/0.5/raw \
- -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.2/support/playbooks-pvc.yaml
+ -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.3/support/playbooks-pvc.yaml
```
Do the git clone of the examples repository:
@@ -66,7 +68,7 @@ tkn task start git-clone \
As we will do get, list and create on the namespace, lets use a service account that has right RBAC:
```shell
-kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.2/support/ansible-deployer.yaml
+kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.3/support/ansible-deployer.yaml
```
### Run Tasks
diff --git a/task/ansible-runner/0.2/ansible-runner.yaml b/task/ansible-runner/0.3/ansible-runner.yaml
index d047c75..195bf7f 100644
--- a/task/ansible-runner/0.2/ansible-runner.yaml
+++ b/task/ansible-runner/0.3/ansible-runner.yaml
@@ -1,14 +1,14 @@
---
-apiVersion: tekton.dev/v1beta1
+apiVersion: tekton.dev/v1
kind: Task
metadata:
name: ansible-runner
labels:
- app.kubernetes.io/version: '0.2'
- app.kubernetes.io/ansible-version: '2.12.5'
+ app.kubernetes.io/version: '0.3'
+ app.kubernetes.io/ansible-version: '2.18.2'
annotations:
- tekton.dev/deprecated: "true"
- tekton.dev/pipelines.minVersion: '0.12.1'
+ tekton.dev/deprecated: "false"
+ tekton.dev/pipelines.minVersion: '0.19.0'
tekton.dev/categories: CLI
tekton.dev/tags: cli
tekton.dev/displayName: 'Ansible Runner'
@@ -20,10 +20,16 @@ spec:
workspaces:
- name: runner-dir
description: The Ansibler runner directory
+ - name: ssl-ca-directory
+ optional: true
+ description: |
+ A Workspace containing CA certificates, this will be used by Ansible and pip to
+ verify the peer with when interacting with remote repositories using
+ HTTPS.
params:
- name: project-dir
description: The project directory under the workspace runner-dir
- default: 'project'
+ default: '.'
- name: args
description: The arguments to pass ansible-runner
type: array
@@ -34,11 +40,16 @@ spec:
default: /tekton/home
- name: image
description: Ansible runner image.
- default: quay.io/ansible/ansible-runner:stable-2.12-latest #tag: stable-2.12-latest
+ default: ghcr.io/ansible/community-ansible-dev-tools:v25.5.1 #tag: v25.5.1
+ - name: workspaces_ssl_ca_file
+ default: ""
+
stepTemplate:
env:
- name: HOME
value: $(params.user-home)
+ - name: CURL_CA_BUNDLE
+ value: "$(workspaces.ssl-ca-directory.path)$(params.workspaces_ssl_ca_file)"
steps:
- name: requirements
image: $(params.image)
@@ -59,13 +70,12 @@ spec:
ansible-galaxy collection install -vv \
-r requirements.yml
fi
- workingDir: '$(workspaces.runner-dir.path)/$(params.project-dir)'
+ workingDir: '$(workspaces.runner-dir.path)'
- name: run-playbook
image: $(params.image)
- command: ['entrypoint']
+ command: ['ansible-runner']
args:
- - ansible-runner
- run
- $(params.args)
- $(params.project-dir)
diff --git a/task/ansible-runner/0.2/tests/pre-apply-task-hook.sh b/task/ansible-runner/0.3/tests/pre-apply-task-hook.sh
old mode 100755
new mode 100644
diff --git a/task/ansible-runner/0.2/tests/resources.yaml b/task/ansible-runner/0.3/tests/resources.yaml
index b8c0a41..e091721 100644
--- a/task/ansible-runner/0.2/tests/resources.yaml
+++ b/task/ansible-runner/0.3/tests/resources.yaml
@@ -14,7 +14,7 @@ apiVersion: v1
kind: ServiceAccount
metadata:
name: ansible-deployer-account
- namespace: ansible-runner-0-2
+ namespace: ansible-runner-0-3
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
@@ -41,7 +41,7 @@ metadata:
subjects:
- kind: ServiceAccount
name: ansible-deployer-account
- namespace: ansible-runner-0-2
+ namespace: ansible-runner-0-3
roleRef:
kind: ClusterRole
name: ansible-deployer
diff --git a/task/ansible-runner/0.2/tests/run.yaml b/task/ansible-runner/0.3/tests/run.yaml
index 3d5c009..a28fd98 100644
--- a/task/ansible-runner/0.2/tests/run.yaml
+++ b/task/ansible-runner/0.3/tests/run.yaml
@@ -1,5 +1,5 @@
---
-apiVersion: tekton.dev/v1beta1
+apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: ansibler-runner-pipeline
@@ -16,9 +16,11 @@ spec:
params:
- name: url
value: |
- https://github.com/vinamra28/tektoncd-ansible-runner-example
+ https://github.com/sveno1990/catalog/
- name: revision
- value: 'master'
+ value: 'feature/ansible-runner-v0.3'
+ - name: pathInRepo
+ value: task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example
- name: deleteExisting
value: 'true'
# ansible-runner
@@ -37,12 +39,13 @@ spec:
value: ['-p', 'list-pods.yml']
---
-apiVersion: tekton.dev/v1beta1
+apiVersion: tekton.dev/v1
kind: PipelineRun
metadata:
name: ansibler-runner-pipeline-run
spec:
- serviceAccountName: ansible-deployer-account
+ taskRunTemplate:
+ serviceAccountName: ansible-deployer-account
pipelineRef:
name: ansibler-runner-pipeline
workspaces:
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/README.md b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/README.md
new file mode 100644
index 0000000..63e6e35
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/README.md
@@ -0,0 +1,65 @@
+# Tektoncd Ansible Runner Examples
+
+A repo to hold Ansible runner examples for the Tektoncd Task `ansible-runner`
+
+
+## Common Tasks
+
+```shell
+kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/master/task/git-clone/0.1/git-clone.yaml
+kubectl apply -f https://raw.githubusercontent.com/tektoncd-ansible-runner-example/catalog/master/playbooks-pvc.yaml
+```
+
+## Examples
+
+Run the following Task to clone this repository
+
+```shell
+tkn task start git-clone \
+ --workspace=name=output,claimName=ansible-playbooks \
+ --param=url=https://github.com/kameshsampath/tektoncd-ansible-runner-example \
+ --param=revision=master \
+ --param=deleteExisting=true \
+ --showlog
+```
+
+### Service Account
+
+You need proper RBAC in Kubernetes to allow it to perform the example tasks:
+
+```shell
+kubectl apply -f https://raw.githubusercontent.com/tektoncd-ansible-runner-example/master/kubernetes/ansible-deployer.yaml
+```
+
+### Listing pods
+
+```shell
+ tkn task start ansible-runner \
+ --serviceaccount ansible-deployer-account \
+ --param=project-dir=kubernetes \
+ --param=args='-p list-pods.yml' \
+ --workspace=name=runner-dir,claimName=ansible-playbooks \
+ --showlog
+```
+
+### Create Deployment
+
+```shell
+ tkn task start ansible-runner \
+ --serviceaccount ansible-deployer-account \
+ --param=project-dir=kubernetes \
+ --param=args='-p create-deployment.yml' \
+ --workspace=name=runner-dir,claimName=ansible-playbooks \
+ --showlog
+```
+
+### Create Service
+
+```shell
+ tkn task start ansible-runner \
+ --serviceaccount ansible-deployer-account \
+ --param=project-dir=kubernetes \
+ --param=args='-p create-service.yml' \
+ --workspace=name=runner-dir,claimName=ansible-playbooks \
+ --showlog
+```
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/ansible-deployer.yaml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/ansible-deployer.yaml
new file mode 100644
index 0000000..83ad1c0
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/ansible-deployer.yaml
@@ -0,0 +1,36 @@
+apiVersion: v1
+kind: ServiceAccount
+metadata:
+ name: ansible-deployer-account
+ namespace: default
+---
+kind: ClusterRole
+apiVersion: rbac.authorization.k8s.io/v1
+metadata:
+ name: ansible-deployer
+rules:
+ # Core API
+ - apiGroups: ['']
+ resources: ['services', 'pods', 'deployments', 'configmaps', 'secrets']
+ verbs: ['get', 'list', 'create', 'update', 'delete', 'patch', 'watch']
+ # Apps API
+ - apiGroups: ['apps']
+ resources: ['deployments', 'daemonsets', 'jobs']
+ verbs: ['get', 'list', 'create', 'update', 'delete', 'patch', 'watch']
+ # Knative API
+ - apiGroups: ['serving.knative.dev']
+ resources: ['services', 'revisions', 'routes']
+ verbs: ['get', 'list', 'create', 'update', 'delete', 'patch', 'watch']
+---
+apiVersion: rbac.authorization.k8s.io/v1beta1
+kind: ClusterRoleBinding
+metadata:
+ name: ansible-deployer-binding
+subjects:
+ - kind: ServiceAccount
+ name: ansible-deployer-account
+ namespace: default
+roleRef:
+ kind: ClusterRole
+ name: ansible-deployer
+ apiGroup: rbac.authorization.k8s.io
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-deployment.yml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-deployment.yml
new file mode 100644
index 0000000..1ff2d33
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-deployment.yml
@@ -0,0 +1,45 @@
+- hosts: localhost
+ connection: local
+ collections:
+ - community.kubernetes
+ tasks:
+ - name: Create a new deployment
+ k8s:
+ state: present
+ resource_definition: |
+ apiVersion: apps/v1
+ kind: Deployment
+ metadata:
+ name: helloworld
+ namespace: funstuff
+ spec:
+ selector:
+ matchLabels:
+ app: helloworld
+ template:
+ metadata:
+ labels:
+ app: helloworld
+ spec:
+ containers:
+ - name: helloworld
+ image: quay.io/kameshsampath/quarkus-helloworld
+ resources:
+ limits:
+ memory: "150Mi"
+ cpu: "500m"
+ ports:
+ - containerPort: 8080
+ wait: yes
+ register: helloworld_deployment
+ - name: Get the Deployment
+ k8s_info:
+ kind: Deployment
+ namespace: funstuff
+ register: funstuff_deployments_list
+ - name: Log Deployment Details
+ debug:
+ msg: "{{ item | json_query('metadata.name') }}"
+ loop: '{{funstuff_deployments_list.resources}}'
+ loop_control:
+ label: "Deployment (Namespace: {{item | json_query('metadata.namespace')}},Replicas:{{ item | json_query('spec.replicas')}})"
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-service.yml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-service.yml
new file mode 100644
index 0000000..ad8b5ce
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-service.yml
@@ -0,0 +1,33 @@
+- hosts: localhost
+ connection: local
+ collections:
+ - community.kubernetes
+ tasks:
+ - name: Create a new Service
+ k8s:
+ state: present
+ resource_definition: |
+ apiVersion: v1
+ kind: Service
+ metadata:
+ name: helloworld
+ namespace: funstuff
+ spec:
+ selector:
+ app: helloworld
+ ports:
+ - port: 8080
+ targetPort: 8080
+ wait: yes
+ register: helloworld_svc
+ - name: Get the Service
+ k8s_info:
+ kind: Service
+ namespace: funstuff
+ register: funstuff_service_list
+ - name: Log Service Details
+ debug:
+ msg: "{{ item | json_query('metadata.name') }}"
+ loop: '{{funstuff_service_list.resources}}'
+ loop_control:
+ label: "Service (Namespace: {{item | json_query('metadata.namespace')}})"
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/kustomization.yaml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/kustomization.yaml
new file mode 100644
index 0000000..590f43e
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/kustomization.yaml
@@ -0,0 +1,13 @@
+apiVersion: kustomize.config.k8s.io/v1beta1
+kind: Kustomization
+
+namespace: demos
+
+generatorOptions:
+ disableNameSuffixHash: true
+
+commonLabels:
+ tekton.dev/task: ansible-runner
+
+resources:
+ - ansible-deployer.yaml
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/list-pods.yml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/list-pods.yml
new file mode 100644
index 0000000..33d2063
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/list-pods.yml
@@ -0,0 +1,16 @@
+- hosts: localhost
+ connection: local
+ collections:
+ - community.kubernetes
+ tasks:
+ - name: List Pods in namespace
+ k8s_info:
+ kind: Pod
+ namespace: kube-system
+ register: kube_system_pods_list
+ - name: Show the list of pods
+ debug:
+ msg: "{{ item | json_query('metadata.name') }}"
+ loop: '{{kube_system_pods_list.resources}}'
+ loop_control:
+ label: "Pod(Namespace: {{item | json_query('metadata.namespace') }})"
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.txt b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.txt
new file mode 100644
index 0000000..60af612
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.txt
@@ -0,0 +1,3 @@
+kubernetes>=24.2.0
+requests-oauthlib
+jsonpatch
\ No newline at end of file
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.yml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.yml
new file mode 100644
index 0000000..4d8d85c
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.yml
@@ -0,0 +1,6 @@
+---
+collections:
+ - name: community.kubernetes.core
+ version: 2.0.1
+ - name: community.general
+ version: 10.7.0
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/playbooks-pvc.yaml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/playbooks-pvc.yaml
new file mode 100644
index 0000000..5075f19
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/playbooks-pvc.yaml
@@ -0,0 +1,11 @@
+apiVersion: v1
+kind: PersistentVolumeClaim
+metadata:
+ name: ansible-playbooks
+spec:
+ accessModes:
+ - ReadWriteOnce
+ volumeMode: Filesystem
+ resources:
+ requests:
+ storage: 1Gi |
4c22350 to
652f6db
Compare
Diff between version 0.2 and 0.3diff --git a/task/ansible-runner/0.2/README.md b/task/ansible-runner/0.3/README.md
index 257bc2d..bf96ba0 100644
--- a/task/ansible-runner/0.2/README.md
+++ b/task/ansible-runner/0.3/README.md
@@ -9,7 +9,7 @@ The latest versions of ansible-runner requires [`community.general`](https://git
Create the Task and other resources:
```shell
-kubectl apply --filename https://api.hub.tekton.dev/v1/resource/tekton/task/ansible-runner/0.2/raw
+kubectl apply --filename https://api.hub.tekton.dev/v1/resource/tekton/task/ansible-runner/0.3/raw
```
Verify the created tasks:
@@ -23,10 +23,12 @@ tkn task ls
* **project-dir**: The ansible-runner private data dir
* **args:**: The array of arguments to pass to the runner command (_default:_ --help)
* **user-home**: Absolute path to the user's home directory. (_default:_ /tekton/home)
+* **workspaces_ssl_ca_file**: file name of ca bundle. (_default:_ ca-bundle.crt)
## Workspaces
* **runner-dir**: A [workspace](https://github.com/tektoncd/pipeline/blob/main/docs/workspaces.md) to hold the `private_data_dir` as described in https://ansible-runner.readthedocs.io/en/latest/intro.html#runner-input-directory-hierarchy[Runner Directory]
+* **ssl-ca-directory**: A optional [workspace](https://github.com/tektoncd/pipeline/blob/main/docs/workspaces.md) to hold the ca_certs for custom certificate authorities.
## Platforms
@@ -47,7 +49,7 @@ All the examples will be run in namespace called `funstuff`. Create the namespac
```shell
kubectl apply -f https://api.hub.tekton.dev/v1/resource/tekton/task/git-clone/0.5/raw \
- -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.2/support/playbooks-pvc.yaml
+ -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.3/support/playbooks-pvc.yaml
```
Do the git clone of the examples repository:
@@ -66,7 +68,7 @@ tkn task start git-clone \
As we will do get, list and create on the namespace, lets use a service account that has right RBAC:
```shell
-kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.2/support/ansible-deployer.yaml
+kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.3/support/ansible-deployer.yaml
```
### Run Tasks
diff --git a/task/ansible-runner/0.2/ansible-runner.yaml b/task/ansible-runner/0.3/ansible-runner.yaml
index d047c75..195bf7f 100644
--- a/task/ansible-runner/0.2/ansible-runner.yaml
+++ b/task/ansible-runner/0.3/ansible-runner.yaml
@@ -1,14 +1,14 @@
---
-apiVersion: tekton.dev/v1beta1
+apiVersion: tekton.dev/v1
kind: Task
metadata:
name: ansible-runner
labels:
- app.kubernetes.io/version: '0.2'
- app.kubernetes.io/ansible-version: '2.12.5'
+ app.kubernetes.io/version: '0.3'
+ app.kubernetes.io/ansible-version: '2.18.2'
annotations:
- tekton.dev/deprecated: "true"
- tekton.dev/pipelines.minVersion: '0.12.1'
+ tekton.dev/deprecated: "false"
+ tekton.dev/pipelines.minVersion: '0.19.0'
tekton.dev/categories: CLI
tekton.dev/tags: cli
tekton.dev/displayName: 'Ansible Runner'
@@ -20,10 +20,16 @@ spec:
workspaces:
- name: runner-dir
description: The Ansibler runner directory
+ - name: ssl-ca-directory
+ optional: true
+ description: |
+ A Workspace containing CA certificates, this will be used by Ansible and pip to
+ verify the peer with when interacting with remote repositories using
+ HTTPS.
params:
- name: project-dir
description: The project directory under the workspace runner-dir
- default: 'project'
+ default: '.'
- name: args
description: The arguments to pass ansible-runner
type: array
@@ -34,11 +40,16 @@ spec:
default: /tekton/home
- name: image
description: Ansible runner image.
- default: quay.io/ansible/ansible-runner:stable-2.12-latest #tag: stable-2.12-latest
+ default: ghcr.io/ansible/community-ansible-dev-tools:v25.5.1 #tag: v25.5.1
+ - name: workspaces_ssl_ca_file
+ default: ""
+
stepTemplate:
env:
- name: HOME
value: $(params.user-home)
+ - name: CURL_CA_BUNDLE
+ value: "$(workspaces.ssl-ca-directory.path)$(params.workspaces_ssl_ca_file)"
steps:
- name: requirements
image: $(params.image)
@@ -59,13 +70,12 @@ spec:
ansible-galaxy collection install -vv \
-r requirements.yml
fi
- workingDir: '$(workspaces.runner-dir.path)/$(params.project-dir)'
+ workingDir: '$(workspaces.runner-dir.path)'
- name: run-playbook
image: $(params.image)
- command: ['entrypoint']
+ command: ['ansible-runner']
args:
- - ansible-runner
- run
- $(params.args)
- $(params.project-dir)
diff --git a/task/ansible-runner/0.2/tests/pre-apply-task-hook.sh b/task/ansible-runner/0.3/tests/pre-apply-task-hook.sh
old mode 100755
new mode 100644
diff --git a/task/ansible-runner/0.2/tests/resources.yaml b/task/ansible-runner/0.3/tests/resources.yaml
index b8c0a41..e091721 100644
--- a/task/ansible-runner/0.2/tests/resources.yaml
+++ b/task/ansible-runner/0.3/tests/resources.yaml
@@ -14,7 +14,7 @@ apiVersion: v1
kind: ServiceAccount
metadata:
name: ansible-deployer-account
- namespace: ansible-runner-0-2
+ namespace: ansible-runner-0-3
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
@@ -41,7 +41,7 @@ metadata:
subjects:
- kind: ServiceAccount
name: ansible-deployer-account
- namespace: ansible-runner-0-2
+ namespace: ansible-runner-0-3
roleRef:
kind: ClusterRole
name: ansible-deployer
diff --git a/task/ansible-runner/0.2/tests/run.yaml b/task/ansible-runner/0.3/tests/run.yaml
index 3d5c009..a28fd98 100644
--- a/task/ansible-runner/0.2/tests/run.yaml
+++ b/task/ansible-runner/0.3/tests/run.yaml
@@ -1,5 +1,5 @@
---
-apiVersion: tekton.dev/v1beta1
+apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: ansibler-runner-pipeline
@@ -16,9 +16,11 @@ spec:
params:
- name: url
value: |
- https://github.com/vinamra28/tektoncd-ansible-runner-example
+ https://github.com/sveno1990/catalog/
- name: revision
- value: 'master'
+ value: 'feature/ansible-runner-v0.3'
+ - name: pathInRepo
+ value: task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example
- name: deleteExisting
value: 'true'
# ansible-runner
@@ -37,12 +39,13 @@ spec:
value: ['-p', 'list-pods.yml']
---
-apiVersion: tekton.dev/v1beta1
+apiVersion: tekton.dev/v1
kind: PipelineRun
metadata:
name: ansibler-runner-pipeline-run
spec:
- serviceAccountName: ansible-deployer-account
+ taskRunTemplate:
+ serviceAccountName: ansible-deployer-account
pipelineRef:
name: ansibler-runner-pipeline
workspaces:
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/README.md b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/README.md
new file mode 100644
index 0000000..63e6e35
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/README.md
@@ -0,0 +1,65 @@
+# Tektoncd Ansible Runner Examples
+
+A repo to hold Ansible runner examples for the Tektoncd Task `ansible-runner`
+
+
+## Common Tasks
+
+```shell
+kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/master/task/git-clone/0.1/git-clone.yaml
+kubectl apply -f https://raw.githubusercontent.com/tektoncd-ansible-runner-example/catalog/master/playbooks-pvc.yaml
+```
+
+## Examples
+
+Run the following Task to clone this repository
+
+```shell
+tkn task start git-clone \
+ --workspace=name=output,claimName=ansible-playbooks \
+ --param=url=https://github.com/kameshsampath/tektoncd-ansible-runner-example \
+ --param=revision=master \
+ --param=deleteExisting=true \
+ --showlog
+```
+
+### Service Account
+
+You need proper RBAC in Kubernetes to allow it to perform the example tasks:
+
+```shell
+kubectl apply -f https://raw.githubusercontent.com/tektoncd-ansible-runner-example/master/kubernetes/ansible-deployer.yaml
+```
+
+### Listing pods
+
+```shell
+ tkn task start ansible-runner \
+ --serviceaccount ansible-deployer-account \
+ --param=project-dir=kubernetes \
+ --param=args='-p list-pods.yml' \
+ --workspace=name=runner-dir,claimName=ansible-playbooks \
+ --showlog
+```
+
+### Create Deployment
+
+```shell
+ tkn task start ansible-runner \
+ --serviceaccount ansible-deployer-account \
+ --param=project-dir=kubernetes \
+ --param=args='-p create-deployment.yml' \
+ --workspace=name=runner-dir,claimName=ansible-playbooks \
+ --showlog
+```
+
+### Create Service
+
+```shell
+ tkn task start ansible-runner \
+ --serviceaccount ansible-deployer-account \
+ --param=project-dir=kubernetes \
+ --param=args='-p create-service.yml' \
+ --workspace=name=runner-dir,claimName=ansible-playbooks \
+ --showlog
+```
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/ansible-deployer.yaml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/ansible-deployer.yaml
new file mode 100644
index 0000000..83ad1c0
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/ansible-deployer.yaml
@@ -0,0 +1,36 @@
+apiVersion: v1
+kind: ServiceAccount
+metadata:
+ name: ansible-deployer-account
+ namespace: default
+---
+kind: ClusterRole
+apiVersion: rbac.authorization.k8s.io/v1
+metadata:
+ name: ansible-deployer
+rules:
+ # Core API
+ - apiGroups: ['']
+ resources: ['services', 'pods', 'deployments', 'configmaps', 'secrets']
+ verbs: ['get', 'list', 'create', 'update', 'delete', 'patch', 'watch']
+ # Apps API
+ - apiGroups: ['apps']
+ resources: ['deployments', 'daemonsets', 'jobs']
+ verbs: ['get', 'list', 'create', 'update', 'delete', 'patch', 'watch']
+ # Knative API
+ - apiGroups: ['serving.knative.dev']
+ resources: ['services', 'revisions', 'routes']
+ verbs: ['get', 'list', 'create', 'update', 'delete', 'patch', 'watch']
+---
+apiVersion: rbac.authorization.k8s.io/v1beta1
+kind: ClusterRoleBinding
+metadata:
+ name: ansible-deployer-binding
+subjects:
+ - kind: ServiceAccount
+ name: ansible-deployer-account
+ namespace: default
+roleRef:
+ kind: ClusterRole
+ name: ansible-deployer
+ apiGroup: rbac.authorization.k8s.io
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-deployment.yml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-deployment.yml
new file mode 100644
index 0000000..1ff2d33
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-deployment.yml
@@ -0,0 +1,45 @@
+- hosts: localhost
+ connection: local
+ collections:
+ - community.kubernetes
+ tasks:
+ - name: Create a new deployment
+ k8s:
+ state: present
+ resource_definition: |
+ apiVersion: apps/v1
+ kind: Deployment
+ metadata:
+ name: helloworld
+ namespace: funstuff
+ spec:
+ selector:
+ matchLabels:
+ app: helloworld
+ template:
+ metadata:
+ labels:
+ app: helloworld
+ spec:
+ containers:
+ - name: helloworld
+ image: quay.io/kameshsampath/quarkus-helloworld
+ resources:
+ limits:
+ memory: "150Mi"
+ cpu: "500m"
+ ports:
+ - containerPort: 8080
+ wait: yes
+ register: helloworld_deployment
+ - name: Get the Deployment
+ k8s_info:
+ kind: Deployment
+ namespace: funstuff
+ register: funstuff_deployments_list
+ - name: Log Deployment Details
+ debug:
+ msg: "{{ item | json_query('metadata.name') }}"
+ loop: '{{funstuff_deployments_list.resources}}'
+ loop_control:
+ label: "Deployment (Namespace: {{item | json_query('metadata.namespace')}},Replicas:{{ item | json_query('spec.replicas')}})"
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-service.yml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-service.yml
new file mode 100644
index 0000000..ad8b5ce
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-service.yml
@@ -0,0 +1,33 @@
+- hosts: localhost
+ connection: local
+ collections:
+ - community.kubernetes
+ tasks:
+ - name: Create a new Service
+ k8s:
+ state: present
+ resource_definition: |
+ apiVersion: v1
+ kind: Service
+ metadata:
+ name: helloworld
+ namespace: funstuff
+ spec:
+ selector:
+ app: helloworld
+ ports:
+ - port: 8080
+ targetPort: 8080
+ wait: yes
+ register: helloworld_svc
+ - name: Get the Service
+ k8s_info:
+ kind: Service
+ namespace: funstuff
+ register: funstuff_service_list
+ - name: Log Service Details
+ debug:
+ msg: "{{ item | json_query('metadata.name') }}"
+ loop: '{{funstuff_service_list.resources}}'
+ loop_control:
+ label: "Service (Namespace: {{item | json_query('metadata.namespace')}})"
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/kustomization.yaml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/kustomization.yaml
new file mode 100644
index 0000000..590f43e
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/kustomization.yaml
@@ -0,0 +1,13 @@
+apiVersion: kustomize.config.k8s.io/v1beta1
+kind: Kustomization
+
+namespace: demos
+
+generatorOptions:
+ disableNameSuffixHash: true
+
+commonLabels:
+ tekton.dev/task: ansible-runner
+
+resources:
+ - ansible-deployer.yaml
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/list-pods.yml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/list-pods.yml
new file mode 100644
index 0000000..33d2063
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/list-pods.yml
@@ -0,0 +1,16 @@
+- hosts: localhost
+ connection: local
+ collections:
+ - community.kubernetes
+ tasks:
+ - name: List Pods in namespace
+ k8s_info:
+ kind: Pod
+ namespace: kube-system
+ register: kube_system_pods_list
+ - name: Show the list of pods
+ debug:
+ msg: "{{ item | json_query('metadata.name') }}"
+ loop: '{{kube_system_pods_list.resources}}'
+ loop_control:
+ label: "Pod(Namespace: {{item | json_query('metadata.namespace') }})"
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.txt b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.txt
new file mode 100644
index 0000000..60af612
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.txt
@@ -0,0 +1,3 @@
+kubernetes>=24.2.0
+requests-oauthlib
+jsonpatch
\ No newline at end of file
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.yml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.yml
new file mode 100644
index 0000000..4d8d85c
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.yml
@@ -0,0 +1,6 @@
+---
+collections:
+ - name: community.kubernetes.core
+ version: 2.0.1
+ - name: community.general
+ version: 10.7.0
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/playbooks-pvc.yaml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/playbooks-pvc.yaml
new file mode 100644
index 0000000..5075f19
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/playbooks-pvc.yaml
@@ -0,0 +1,11 @@
+apiVersion: v1
+kind: PersistentVolumeClaim
+metadata:
+ name: ansible-playbooks
+spec:
+ accessModes:
+ - ReadWriteOnce
+ volumeMode: Filesystem
+ resources:
+ requests:
+ storage: 1Gi |
|
/retest |
1 similar comment
|
/retest |
Diff between version 0.2 and 0.3diff --git a/task/ansible-runner/0.2/README.md b/task/ansible-runner/0.3/README.md
index 257bc2d..bf96ba0 100644
--- a/task/ansible-runner/0.2/README.md
+++ b/task/ansible-runner/0.3/README.md
@@ -9,7 +9,7 @@ The latest versions of ansible-runner requires [`community.general`](https://git
Create the Task and other resources:
```shell
-kubectl apply --filename https://api.hub.tekton.dev/v1/resource/tekton/task/ansible-runner/0.2/raw
+kubectl apply --filename https://api.hub.tekton.dev/v1/resource/tekton/task/ansible-runner/0.3/raw
```
Verify the created tasks:
@@ -23,10 +23,12 @@ tkn task ls
* **project-dir**: The ansible-runner private data dir
* **args:**: The array of arguments to pass to the runner command (_default:_ --help)
* **user-home**: Absolute path to the user's home directory. (_default:_ /tekton/home)
+* **workspaces_ssl_ca_file**: file name of ca bundle. (_default:_ ca-bundle.crt)
## Workspaces
* **runner-dir**: A [workspace](https://github.com/tektoncd/pipeline/blob/main/docs/workspaces.md) to hold the `private_data_dir` as described in https://ansible-runner.readthedocs.io/en/latest/intro.html#runner-input-directory-hierarchy[Runner Directory]
+* **ssl-ca-directory**: A optional [workspace](https://github.com/tektoncd/pipeline/blob/main/docs/workspaces.md) to hold the ca_certs for custom certificate authorities.
## Platforms
@@ -47,7 +49,7 @@ All the examples will be run in namespace called `funstuff`. Create the namespac
```shell
kubectl apply -f https://api.hub.tekton.dev/v1/resource/tekton/task/git-clone/0.5/raw \
- -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.2/support/playbooks-pvc.yaml
+ -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.3/support/playbooks-pvc.yaml
```
Do the git clone of the examples repository:
@@ -66,7 +68,7 @@ tkn task start git-clone \
As we will do get, list and create on the namespace, lets use a service account that has right RBAC:
```shell
-kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.2/support/ansible-deployer.yaml
+kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.3/support/ansible-deployer.yaml
```
### Run Tasks
diff --git a/task/ansible-runner/0.2/ansible-runner.yaml b/task/ansible-runner/0.3/ansible-runner.yaml
index d047c75..195bf7f 100644
--- a/task/ansible-runner/0.2/ansible-runner.yaml
+++ b/task/ansible-runner/0.3/ansible-runner.yaml
@@ -1,14 +1,14 @@
---
-apiVersion: tekton.dev/v1beta1
+apiVersion: tekton.dev/v1
kind: Task
metadata:
name: ansible-runner
labels:
- app.kubernetes.io/version: '0.2'
- app.kubernetes.io/ansible-version: '2.12.5'
+ app.kubernetes.io/version: '0.3'
+ app.kubernetes.io/ansible-version: '2.18.2'
annotations:
- tekton.dev/deprecated: "true"
- tekton.dev/pipelines.minVersion: '0.12.1'
+ tekton.dev/deprecated: "false"
+ tekton.dev/pipelines.minVersion: '0.19.0'
tekton.dev/categories: CLI
tekton.dev/tags: cli
tekton.dev/displayName: 'Ansible Runner'
@@ -20,10 +20,16 @@ spec:
workspaces:
- name: runner-dir
description: The Ansibler runner directory
+ - name: ssl-ca-directory
+ optional: true
+ description: |
+ A Workspace containing CA certificates, this will be used by Ansible and pip to
+ verify the peer with when interacting with remote repositories using
+ HTTPS.
params:
- name: project-dir
description: The project directory under the workspace runner-dir
- default: 'project'
+ default: '.'
- name: args
description: The arguments to pass ansible-runner
type: array
@@ -34,11 +40,16 @@ spec:
default: /tekton/home
- name: image
description: Ansible runner image.
- default: quay.io/ansible/ansible-runner:stable-2.12-latest #tag: stable-2.12-latest
+ default: ghcr.io/ansible/community-ansible-dev-tools:v25.5.1 #tag: v25.5.1
+ - name: workspaces_ssl_ca_file
+ default: ""
+
stepTemplate:
env:
- name: HOME
value: $(params.user-home)
+ - name: CURL_CA_BUNDLE
+ value: "$(workspaces.ssl-ca-directory.path)$(params.workspaces_ssl_ca_file)"
steps:
- name: requirements
image: $(params.image)
@@ -59,13 +70,12 @@ spec:
ansible-galaxy collection install -vv \
-r requirements.yml
fi
- workingDir: '$(workspaces.runner-dir.path)/$(params.project-dir)'
+ workingDir: '$(workspaces.runner-dir.path)'
- name: run-playbook
image: $(params.image)
- command: ['entrypoint']
+ command: ['ansible-runner']
args:
- - ansible-runner
- run
- $(params.args)
- $(params.project-dir)
diff --git a/task/ansible-runner/0.2/tests/pre-apply-task-hook.sh b/task/ansible-runner/0.3/tests/pre-apply-task-hook.sh
old mode 100755
new mode 100644
diff --git a/task/ansible-runner/0.2/tests/resources.yaml b/task/ansible-runner/0.3/tests/resources.yaml
index b8c0a41..e091721 100644
--- a/task/ansible-runner/0.2/tests/resources.yaml
+++ b/task/ansible-runner/0.3/tests/resources.yaml
@@ -14,7 +14,7 @@ apiVersion: v1
kind: ServiceAccount
metadata:
name: ansible-deployer-account
- namespace: ansible-runner-0-2
+ namespace: ansible-runner-0-3
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
@@ -41,7 +41,7 @@ metadata:
subjects:
- kind: ServiceAccount
name: ansible-deployer-account
- namespace: ansible-runner-0-2
+ namespace: ansible-runner-0-3
roleRef:
kind: ClusterRole
name: ansible-deployer
diff --git a/task/ansible-runner/0.2/tests/run.yaml b/task/ansible-runner/0.3/tests/run.yaml
index 3d5c009..b3cf74a 100644
--- a/task/ansible-runner/0.2/tests/run.yaml
+++ b/task/ansible-runner/0.3/tests/run.yaml
@@ -1,5 +1,5 @@
---
-apiVersion: tekton.dev/v1beta1
+apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: ansibler-runner-pipeline
@@ -16,9 +16,10 @@ spec:
params:
- name: url
value: |
- https://github.com/vinamra28/tektoncd-ansible-runner-example
+ https://github.com/sveno1990/catalog/
- name: revision
- value: 'master'
+ value: 'feature/ansible-runner-v0.3'
+
- name: deleteExisting
value: 'true'
# ansible-runner
@@ -32,17 +33,18 @@ spec:
workspace: runner-dir
params:
- name: project-dir
- value: 'kubernetes'
+ value: 'task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes'
- name: args
value: ['-p', 'list-pods.yml']
---
-apiVersion: tekton.dev/v1beta1
+apiVersion: tekton.dev/v1
kind: PipelineRun
metadata:
name: ansibler-runner-pipeline-run
spec:
- serviceAccountName: ansible-deployer-account
+ taskRunTemplate:
+ serviceAccountName: ansible-deployer-account
pipelineRef:
name: ansibler-runner-pipeline
workspaces:
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/README.md b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/README.md
new file mode 100644
index 0000000..63e6e35
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/README.md
@@ -0,0 +1,65 @@
+# Tektoncd Ansible Runner Examples
+
+A repo to hold Ansible runner examples for the Tektoncd Task `ansible-runner`
+
+
+## Common Tasks
+
+```shell
+kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/master/task/git-clone/0.1/git-clone.yaml
+kubectl apply -f https://raw.githubusercontent.com/tektoncd-ansible-runner-example/catalog/master/playbooks-pvc.yaml
+```
+
+## Examples
+
+Run the following Task to clone this repository
+
+```shell
+tkn task start git-clone \
+ --workspace=name=output,claimName=ansible-playbooks \
+ --param=url=https://github.com/kameshsampath/tektoncd-ansible-runner-example \
+ --param=revision=master \
+ --param=deleteExisting=true \
+ --showlog
+```
+
+### Service Account
+
+You need proper RBAC in Kubernetes to allow it to perform the example tasks:
+
+```shell
+kubectl apply -f https://raw.githubusercontent.com/tektoncd-ansible-runner-example/master/kubernetes/ansible-deployer.yaml
+```
+
+### Listing pods
+
+```shell
+ tkn task start ansible-runner \
+ --serviceaccount ansible-deployer-account \
+ --param=project-dir=kubernetes \
+ --param=args='-p list-pods.yml' \
+ --workspace=name=runner-dir,claimName=ansible-playbooks \
+ --showlog
+```
+
+### Create Deployment
+
+```shell
+ tkn task start ansible-runner \
+ --serviceaccount ansible-deployer-account \
+ --param=project-dir=kubernetes \
+ --param=args='-p create-deployment.yml' \
+ --workspace=name=runner-dir,claimName=ansible-playbooks \
+ --showlog
+```
+
+### Create Service
+
+```shell
+ tkn task start ansible-runner \
+ --serviceaccount ansible-deployer-account \
+ --param=project-dir=kubernetes \
+ --param=args='-p create-service.yml' \
+ --workspace=name=runner-dir,claimName=ansible-playbooks \
+ --showlog
+```
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/ansible-deployer.yaml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/ansible-deployer.yaml
new file mode 100644
index 0000000..83ad1c0
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/ansible-deployer.yaml
@@ -0,0 +1,36 @@
+apiVersion: v1
+kind: ServiceAccount
+metadata:
+ name: ansible-deployer-account
+ namespace: default
+---
+kind: ClusterRole
+apiVersion: rbac.authorization.k8s.io/v1
+metadata:
+ name: ansible-deployer
+rules:
+ # Core API
+ - apiGroups: ['']
+ resources: ['services', 'pods', 'deployments', 'configmaps', 'secrets']
+ verbs: ['get', 'list', 'create', 'update', 'delete', 'patch', 'watch']
+ # Apps API
+ - apiGroups: ['apps']
+ resources: ['deployments', 'daemonsets', 'jobs']
+ verbs: ['get', 'list', 'create', 'update', 'delete', 'patch', 'watch']
+ # Knative API
+ - apiGroups: ['serving.knative.dev']
+ resources: ['services', 'revisions', 'routes']
+ verbs: ['get', 'list', 'create', 'update', 'delete', 'patch', 'watch']
+---
+apiVersion: rbac.authorization.k8s.io/v1beta1
+kind: ClusterRoleBinding
+metadata:
+ name: ansible-deployer-binding
+subjects:
+ - kind: ServiceAccount
+ name: ansible-deployer-account
+ namespace: default
+roleRef:
+ kind: ClusterRole
+ name: ansible-deployer
+ apiGroup: rbac.authorization.k8s.io
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-deployment.yml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-deployment.yml
new file mode 100644
index 0000000..1ff2d33
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-deployment.yml
@@ -0,0 +1,45 @@
+- hosts: localhost
+ connection: local
+ collections:
+ - community.kubernetes
+ tasks:
+ - name: Create a new deployment
+ k8s:
+ state: present
+ resource_definition: |
+ apiVersion: apps/v1
+ kind: Deployment
+ metadata:
+ name: helloworld
+ namespace: funstuff
+ spec:
+ selector:
+ matchLabels:
+ app: helloworld
+ template:
+ metadata:
+ labels:
+ app: helloworld
+ spec:
+ containers:
+ - name: helloworld
+ image: quay.io/kameshsampath/quarkus-helloworld
+ resources:
+ limits:
+ memory: "150Mi"
+ cpu: "500m"
+ ports:
+ - containerPort: 8080
+ wait: yes
+ register: helloworld_deployment
+ - name: Get the Deployment
+ k8s_info:
+ kind: Deployment
+ namespace: funstuff
+ register: funstuff_deployments_list
+ - name: Log Deployment Details
+ debug:
+ msg: "{{ item | json_query('metadata.name') }}"
+ loop: '{{funstuff_deployments_list.resources}}'
+ loop_control:
+ label: "Deployment (Namespace: {{item | json_query('metadata.namespace')}},Replicas:{{ item | json_query('spec.replicas')}})"
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-service.yml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-service.yml
new file mode 100644
index 0000000..ad8b5ce
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-service.yml
@@ -0,0 +1,33 @@
+- hosts: localhost
+ connection: local
+ collections:
+ - community.kubernetes
+ tasks:
+ - name: Create a new Service
+ k8s:
+ state: present
+ resource_definition: |
+ apiVersion: v1
+ kind: Service
+ metadata:
+ name: helloworld
+ namespace: funstuff
+ spec:
+ selector:
+ app: helloworld
+ ports:
+ - port: 8080
+ targetPort: 8080
+ wait: yes
+ register: helloworld_svc
+ - name: Get the Service
+ k8s_info:
+ kind: Service
+ namespace: funstuff
+ register: funstuff_service_list
+ - name: Log Service Details
+ debug:
+ msg: "{{ item | json_query('metadata.name') }}"
+ loop: '{{funstuff_service_list.resources}}'
+ loop_control:
+ label: "Service (Namespace: {{item | json_query('metadata.namespace')}})"
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/kustomization.yaml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/kustomization.yaml
new file mode 100644
index 0000000..590f43e
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/kustomization.yaml
@@ -0,0 +1,13 @@
+apiVersion: kustomize.config.k8s.io/v1beta1
+kind: Kustomization
+
+namespace: demos
+
+generatorOptions:
+ disableNameSuffixHash: true
+
+commonLabels:
+ tekton.dev/task: ansible-runner
+
+resources:
+ - ansible-deployer.yaml
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/list-pods.yml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/list-pods.yml
new file mode 100644
index 0000000..33d2063
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/list-pods.yml
@@ -0,0 +1,16 @@
+- hosts: localhost
+ connection: local
+ collections:
+ - community.kubernetes
+ tasks:
+ - name: List Pods in namespace
+ k8s_info:
+ kind: Pod
+ namespace: kube-system
+ register: kube_system_pods_list
+ - name: Show the list of pods
+ debug:
+ msg: "{{ item | json_query('metadata.name') }}"
+ loop: '{{kube_system_pods_list.resources}}'
+ loop_control:
+ label: "Pod(Namespace: {{item | json_query('metadata.namespace') }})"
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.txt b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.txt
new file mode 100644
index 0000000..60af612
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.txt
@@ -0,0 +1,3 @@
+kubernetes>=24.2.0
+requests-oauthlib
+jsonpatch
\ No newline at end of file
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.yml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.yml
new file mode 100644
index 0000000..4d8d85c
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.yml
@@ -0,0 +1,6 @@
+---
+collections:
+ - name: community.kubernetes.core
+ version: 2.0.1
+ - name: community.general
+ version: 10.7.0
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/playbooks-pvc.yaml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/playbooks-pvc.yaml
new file mode 100644
index 0000000..5075f19
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/playbooks-pvc.yaml
@@ -0,0 +1,11 @@
+apiVersion: v1
+kind: PersistentVolumeClaim
+metadata:
+ name: ansible-playbooks
+spec:
+ accessModes:
+ - ReadWriteOnce
+ volumeMode: Filesystem
+ resources:
+ requests:
+ storage: 1Gi |
Diff between version 0.2 and 0.3diff --git a/task/ansible-runner/0.2/README.md b/task/ansible-runner/0.3/README.md
index 257bc2d..bf96ba0 100644
--- a/task/ansible-runner/0.2/README.md
+++ b/task/ansible-runner/0.3/README.md
@@ -9,7 +9,7 @@ The latest versions of ansible-runner requires [`community.general`](https://git
Create the Task and other resources:
```shell
-kubectl apply --filename https://api.hub.tekton.dev/v1/resource/tekton/task/ansible-runner/0.2/raw
+kubectl apply --filename https://api.hub.tekton.dev/v1/resource/tekton/task/ansible-runner/0.3/raw
```
Verify the created tasks:
@@ -23,10 +23,12 @@ tkn task ls
* **project-dir**: The ansible-runner private data dir
* **args:**: The array of arguments to pass to the runner command (_default:_ --help)
* **user-home**: Absolute path to the user's home directory. (_default:_ /tekton/home)
+* **workspaces_ssl_ca_file**: file name of ca bundle. (_default:_ ca-bundle.crt)
## Workspaces
* **runner-dir**: A [workspace](https://github.com/tektoncd/pipeline/blob/main/docs/workspaces.md) to hold the `private_data_dir` as described in https://ansible-runner.readthedocs.io/en/latest/intro.html#runner-input-directory-hierarchy[Runner Directory]
+* **ssl-ca-directory**: A optional [workspace](https://github.com/tektoncd/pipeline/blob/main/docs/workspaces.md) to hold the ca_certs for custom certificate authorities.
## Platforms
@@ -47,7 +49,7 @@ All the examples will be run in namespace called `funstuff`. Create the namespac
```shell
kubectl apply -f https://api.hub.tekton.dev/v1/resource/tekton/task/git-clone/0.5/raw \
- -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.2/support/playbooks-pvc.yaml
+ -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.3/support/playbooks-pvc.yaml
```
Do the git clone of the examples repository:
@@ -66,7 +68,7 @@ tkn task start git-clone \
As we will do get, list and create on the namespace, lets use a service account that has right RBAC:
```shell
-kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.2/support/ansible-deployer.yaml
+kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.3/support/ansible-deployer.yaml
```
### Run Tasks
diff --git a/task/ansible-runner/0.2/ansible-runner.yaml b/task/ansible-runner/0.3/ansible-runner.yaml
index d047c75..195bf7f 100644
--- a/task/ansible-runner/0.2/ansible-runner.yaml
+++ b/task/ansible-runner/0.3/ansible-runner.yaml
@@ -1,14 +1,14 @@
---
-apiVersion: tekton.dev/v1beta1
+apiVersion: tekton.dev/v1
kind: Task
metadata:
name: ansible-runner
labels:
- app.kubernetes.io/version: '0.2'
- app.kubernetes.io/ansible-version: '2.12.5'
+ app.kubernetes.io/version: '0.3'
+ app.kubernetes.io/ansible-version: '2.18.2'
annotations:
- tekton.dev/deprecated: "true"
- tekton.dev/pipelines.minVersion: '0.12.1'
+ tekton.dev/deprecated: "false"
+ tekton.dev/pipelines.minVersion: '0.19.0'
tekton.dev/categories: CLI
tekton.dev/tags: cli
tekton.dev/displayName: 'Ansible Runner'
@@ -20,10 +20,16 @@ spec:
workspaces:
- name: runner-dir
description: The Ansibler runner directory
+ - name: ssl-ca-directory
+ optional: true
+ description: |
+ A Workspace containing CA certificates, this will be used by Ansible and pip to
+ verify the peer with when interacting with remote repositories using
+ HTTPS.
params:
- name: project-dir
description: The project directory under the workspace runner-dir
- default: 'project'
+ default: '.'
- name: args
description: The arguments to pass ansible-runner
type: array
@@ -34,11 +40,16 @@ spec:
default: /tekton/home
- name: image
description: Ansible runner image.
- default: quay.io/ansible/ansible-runner:stable-2.12-latest #tag: stable-2.12-latest
+ default: ghcr.io/ansible/community-ansible-dev-tools:v25.5.1 #tag: v25.5.1
+ - name: workspaces_ssl_ca_file
+ default: ""
+
stepTemplate:
env:
- name: HOME
value: $(params.user-home)
+ - name: CURL_CA_BUNDLE
+ value: "$(workspaces.ssl-ca-directory.path)$(params.workspaces_ssl_ca_file)"
steps:
- name: requirements
image: $(params.image)
@@ -59,13 +70,12 @@ spec:
ansible-galaxy collection install -vv \
-r requirements.yml
fi
- workingDir: '$(workspaces.runner-dir.path)/$(params.project-dir)'
+ workingDir: '$(workspaces.runner-dir.path)'
- name: run-playbook
image: $(params.image)
- command: ['entrypoint']
+ command: ['ansible-runner']
args:
- - ansible-runner
- run
- $(params.args)
- $(params.project-dir)
diff --git a/task/ansible-runner/0.2/tests/pre-apply-task-hook.sh b/task/ansible-runner/0.3/tests/pre-apply-task-hook.sh
old mode 100755
new mode 100644
diff --git a/task/ansible-runner/0.2/tests/resources.yaml b/task/ansible-runner/0.3/tests/resources.yaml
index b8c0a41..e091721 100644
--- a/task/ansible-runner/0.2/tests/resources.yaml
+++ b/task/ansible-runner/0.3/tests/resources.yaml
@@ -14,7 +14,7 @@ apiVersion: v1
kind: ServiceAccount
metadata:
name: ansible-deployer-account
- namespace: ansible-runner-0-2
+ namespace: ansible-runner-0-3
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
@@ -41,7 +41,7 @@ metadata:
subjects:
- kind: ServiceAccount
name: ansible-deployer-account
- namespace: ansible-runner-0-2
+ namespace: ansible-runner-0-3
roleRef:
kind: ClusterRole
name: ansible-deployer
diff --git a/task/ansible-runner/0.2/tests/run.yaml b/task/ansible-runner/0.3/tests/run.yaml
index 3d5c009..b3cf74a 100644
--- a/task/ansible-runner/0.2/tests/run.yaml
+++ b/task/ansible-runner/0.3/tests/run.yaml
@@ -1,5 +1,5 @@
---
-apiVersion: tekton.dev/v1beta1
+apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: ansibler-runner-pipeline
@@ -16,9 +16,10 @@ spec:
params:
- name: url
value: |
- https://github.com/vinamra28/tektoncd-ansible-runner-example
+ https://github.com/sveno1990/catalog/
- name: revision
- value: 'master'
+ value: 'feature/ansible-runner-v0.3'
+
- name: deleteExisting
value: 'true'
# ansible-runner
@@ -32,17 +33,18 @@ spec:
workspace: runner-dir
params:
- name: project-dir
- value: 'kubernetes'
+ value: 'task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes'
- name: args
value: ['-p', 'list-pods.yml']
---
-apiVersion: tekton.dev/v1beta1
+apiVersion: tekton.dev/v1
kind: PipelineRun
metadata:
name: ansibler-runner-pipeline-run
spec:
- serviceAccountName: ansible-deployer-account
+ taskRunTemplate:
+ serviceAccountName: ansible-deployer-account
pipelineRef:
name: ansibler-runner-pipeline
workspaces:
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/README.md b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/README.md
new file mode 100644
index 0000000..63e6e35
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/README.md
@@ -0,0 +1,65 @@
+# Tektoncd Ansible Runner Examples
+
+A repo to hold Ansible runner examples for the Tektoncd Task `ansible-runner`
+
+
+## Common Tasks
+
+```shell
+kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/master/task/git-clone/0.1/git-clone.yaml
+kubectl apply -f https://raw.githubusercontent.com/tektoncd-ansible-runner-example/catalog/master/playbooks-pvc.yaml
+```
+
+## Examples
+
+Run the following Task to clone this repository
+
+```shell
+tkn task start git-clone \
+ --workspace=name=output,claimName=ansible-playbooks \
+ --param=url=https://github.com/kameshsampath/tektoncd-ansible-runner-example \
+ --param=revision=master \
+ --param=deleteExisting=true \
+ --showlog
+```
+
+### Service Account
+
+You need proper RBAC in Kubernetes to allow it to perform the example tasks:
+
+```shell
+kubectl apply -f https://raw.githubusercontent.com/tektoncd-ansible-runner-example/master/kubernetes/ansible-deployer.yaml
+```
+
+### Listing pods
+
+```shell
+ tkn task start ansible-runner \
+ --serviceaccount ansible-deployer-account \
+ --param=project-dir=kubernetes \
+ --param=args='-p list-pods.yml' \
+ --workspace=name=runner-dir,claimName=ansible-playbooks \
+ --showlog
+```
+
+### Create Deployment
+
+```shell
+ tkn task start ansible-runner \
+ --serviceaccount ansible-deployer-account \
+ --param=project-dir=kubernetes \
+ --param=args='-p create-deployment.yml' \
+ --workspace=name=runner-dir,claimName=ansible-playbooks \
+ --showlog
+```
+
+### Create Service
+
+```shell
+ tkn task start ansible-runner \
+ --serviceaccount ansible-deployer-account \
+ --param=project-dir=kubernetes \
+ --param=args='-p create-service.yml' \
+ --workspace=name=runner-dir,claimName=ansible-playbooks \
+ --showlog
+```
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/ansible-deployer.yaml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/ansible-deployer.yaml
new file mode 100644
index 0000000..83ad1c0
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/ansible-deployer.yaml
@@ -0,0 +1,36 @@
+apiVersion: v1
+kind: ServiceAccount
+metadata:
+ name: ansible-deployer-account
+ namespace: default
+---
+kind: ClusterRole
+apiVersion: rbac.authorization.k8s.io/v1
+metadata:
+ name: ansible-deployer
+rules:
+ # Core API
+ - apiGroups: ['']
+ resources: ['services', 'pods', 'deployments', 'configmaps', 'secrets']
+ verbs: ['get', 'list', 'create', 'update', 'delete', 'patch', 'watch']
+ # Apps API
+ - apiGroups: ['apps']
+ resources: ['deployments', 'daemonsets', 'jobs']
+ verbs: ['get', 'list', 'create', 'update', 'delete', 'patch', 'watch']
+ # Knative API
+ - apiGroups: ['serving.knative.dev']
+ resources: ['services', 'revisions', 'routes']
+ verbs: ['get', 'list', 'create', 'update', 'delete', 'patch', 'watch']
+---
+apiVersion: rbac.authorization.k8s.io/v1beta1
+kind: ClusterRoleBinding
+metadata:
+ name: ansible-deployer-binding
+subjects:
+ - kind: ServiceAccount
+ name: ansible-deployer-account
+ namespace: default
+roleRef:
+ kind: ClusterRole
+ name: ansible-deployer
+ apiGroup: rbac.authorization.k8s.io
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-deployment.yml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-deployment.yml
new file mode 100644
index 0000000..1ff2d33
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-deployment.yml
@@ -0,0 +1,45 @@
+- hosts: localhost
+ connection: local
+ collections:
+ - community.kubernetes
+ tasks:
+ - name: Create a new deployment
+ k8s:
+ state: present
+ resource_definition: |
+ apiVersion: apps/v1
+ kind: Deployment
+ metadata:
+ name: helloworld
+ namespace: funstuff
+ spec:
+ selector:
+ matchLabels:
+ app: helloworld
+ template:
+ metadata:
+ labels:
+ app: helloworld
+ spec:
+ containers:
+ - name: helloworld
+ image: quay.io/kameshsampath/quarkus-helloworld
+ resources:
+ limits:
+ memory: "150Mi"
+ cpu: "500m"
+ ports:
+ - containerPort: 8080
+ wait: yes
+ register: helloworld_deployment
+ - name: Get the Deployment
+ k8s_info:
+ kind: Deployment
+ namespace: funstuff
+ register: funstuff_deployments_list
+ - name: Log Deployment Details
+ debug:
+ msg: "{{ item | json_query('metadata.name') }}"
+ loop: '{{funstuff_deployments_list.resources}}'
+ loop_control:
+ label: "Deployment (Namespace: {{item | json_query('metadata.namespace')}},Replicas:{{ item | json_query('spec.replicas')}})"
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-service.yml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-service.yml
new file mode 100644
index 0000000..ad8b5ce
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-service.yml
@@ -0,0 +1,33 @@
+- hosts: localhost
+ connection: local
+ collections:
+ - community.kubernetes
+ tasks:
+ - name: Create a new Service
+ k8s:
+ state: present
+ resource_definition: |
+ apiVersion: v1
+ kind: Service
+ metadata:
+ name: helloworld
+ namespace: funstuff
+ spec:
+ selector:
+ app: helloworld
+ ports:
+ - port: 8080
+ targetPort: 8080
+ wait: yes
+ register: helloworld_svc
+ - name: Get the Service
+ k8s_info:
+ kind: Service
+ namespace: funstuff
+ register: funstuff_service_list
+ - name: Log Service Details
+ debug:
+ msg: "{{ item | json_query('metadata.name') }}"
+ loop: '{{funstuff_service_list.resources}}'
+ loop_control:
+ label: "Service (Namespace: {{item | json_query('metadata.namespace')}})"
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/kustomization.yaml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/kustomization.yaml
new file mode 100644
index 0000000..590f43e
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/kustomization.yaml
@@ -0,0 +1,13 @@
+apiVersion: kustomize.config.k8s.io/v1beta1
+kind: Kustomization
+
+namespace: demos
+
+generatorOptions:
+ disableNameSuffixHash: true
+
+commonLabels:
+ tekton.dev/task: ansible-runner
+
+resources:
+ - ansible-deployer.yaml
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/list-pods.yml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/list-pods.yml
new file mode 100644
index 0000000..a0210b2
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/list-pods.yml
@@ -0,0 +1,16 @@
+- hosts: localhost
+ connection: local
+ collections:
+ - community.kubernetes.core
+ tasks:
+ - name: List Pods in namespace
+ kubernetes.core.k8s_info:
+ kind: Pod
+ namespace: kube-system
+ register: kube_system_pods_list
+ - name: Show the list of pods
+ debug:
+ msg: "{{ item | json_query('metadata.name') }}"
+ loop: '{{kube_system_pods_list.resources}}'
+ loop_control:
+ label: "Pod(Namespace: {{item | json_query('metadata.namespace') }})"
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.txt b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.txt
new file mode 100644
index 0000000..60af612
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.txt
@@ -0,0 +1,3 @@
+kubernetes>=24.2.0
+requests-oauthlib
+jsonpatch
\ No newline at end of file
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.yml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.yml
new file mode 100644
index 0000000..4d8d85c
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.yml
@@ -0,0 +1,6 @@
+---
+collections:
+ - name: community.kubernetes.core
+ version: 2.0.1
+ - name: community.general
+ version: 10.7.0
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/playbooks-pvc.yaml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/playbooks-pvc.yaml
new file mode 100644
index 0000000..5075f19
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/playbooks-pvc.yaml
@@ -0,0 +1,11 @@
+apiVersion: v1
+kind: PersistentVolumeClaim
+metadata:
+ name: ansible-playbooks
+spec:
+ accessModes:
+ - ReadWriteOnce
+ volumeMode: Filesystem
+ resources:
+ requests:
+ storage: 1Gi |
Diff between version 0.2 and 0.3diff --git a/task/ansible-runner/0.2/README.md b/task/ansible-runner/0.3/README.md
index 257bc2d..bf96ba0 100644
--- a/task/ansible-runner/0.2/README.md
+++ b/task/ansible-runner/0.3/README.md
@@ -9,7 +9,7 @@ The latest versions of ansible-runner requires [`community.general`](https://git
Create the Task and other resources:
```shell
-kubectl apply --filename https://api.hub.tekton.dev/v1/resource/tekton/task/ansible-runner/0.2/raw
+kubectl apply --filename https://api.hub.tekton.dev/v1/resource/tekton/task/ansible-runner/0.3/raw
```
Verify the created tasks:
@@ -23,10 +23,12 @@ tkn task ls
* **project-dir**: The ansible-runner private data dir
* **args:**: The array of arguments to pass to the runner command (_default:_ --help)
* **user-home**: Absolute path to the user's home directory. (_default:_ /tekton/home)
+* **workspaces_ssl_ca_file**: file name of ca bundle. (_default:_ ca-bundle.crt)
## Workspaces
* **runner-dir**: A [workspace](https://github.com/tektoncd/pipeline/blob/main/docs/workspaces.md) to hold the `private_data_dir` as described in https://ansible-runner.readthedocs.io/en/latest/intro.html#runner-input-directory-hierarchy[Runner Directory]
+* **ssl-ca-directory**: A optional [workspace](https://github.com/tektoncd/pipeline/blob/main/docs/workspaces.md) to hold the ca_certs for custom certificate authorities.
## Platforms
@@ -47,7 +49,7 @@ All the examples will be run in namespace called `funstuff`. Create the namespac
```shell
kubectl apply -f https://api.hub.tekton.dev/v1/resource/tekton/task/git-clone/0.5/raw \
- -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.2/support/playbooks-pvc.yaml
+ -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.3/support/playbooks-pvc.yaml
```
Do the git clone of the examples repository:
@@ -66,7 +68,7 @@ tkn task start git-clone \
As we will do get, list and create on the namespace, lets use a service account that has right RBAC:
```shell
-kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.2/support/ansible-deployer.yaml
+kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.3/support/ansible-deployer.yaml
```
### Run Tasks
diff --git a/task/ansible-runner/0.2/ansible-runner.yaml b/task/ansible-runner/0.3/ansible-runner.yaml
index d047c75..f0c6b04 100644
--- a/task/ansible-runner/0.2/ansible-runner.yaml
+++ b/task/ansible-runner/0.3/ansible-runner.yaml
@@ -1,14 +1,14 @@
---
-apiVersion: tekton.dev/v1beta1
+apiVersion: tekton.dev/v1
kind: Task
metadata:
name: ansible-runner
labels:
- app.kubernetes.io/version: '0.2'
- app.kubernetes.io/ansible-version: '2.12.5'
+ app.kubernetes.io/version: '0.3'
+ app.kubernetes.io/ansible-version: '2.18.2'
annotations:
- tekton.dev/deprecated: "true"
- tekton.dev/pipelines.minVersion: '0.12.1'
+ tekton.dev/deprecated: "false"
+ tekton.dev/pipelines.minVersion: '0.19.0'
tekton.dev/categories: CLI
tekton.dev/tags: cli
tekton.dev/displayName: 'Ansible Runner'
@@ -20,10 +20,16 @@ spec:
workspaces:
- name: runner-dir
description: The Ansibler runner directory
+ - name: ssl-ca-directory
+ optional: true
+ description: |
+ A Workspace containing CA certificates, this will be used by Ansible and pip to
+ verify the peer with when interacting with remote repositories using
+ HTTPS.
params:
- name: project-dir
description: The project directory under the workspace runner-dir
- default: 'project'
+ default: '.'
- name: args
description: The arguments to pass ansible-runner
type: array
@@ -34,11 +40,16 @@ spec:
default: /tekton/home
- name: image
description: Ansible runner image.
- default: quay.io/ansible/ansible-runner:stable-2.12-latest #tag: stable-2.12-latest
+ default: ghcr.io/ansible/community-ansible-dev-tools:v25.5.1 #tag: v25.5.1
+ - name: workspaces_ssl_ca_file
+ default: ""
+
stepTemplate:
env:
- name: HOME
value: $(params.user-home)
+ - name: CURL_CA_BUNDLE
+ value: "$(workspaces.ssl-ca-directory.path)$(params.workspaces_ssl_ca_file)"
steps:
- name: requirements
image: $(params.image)
@@ -63,9 +74,8 @@ spec:
- name: run-playbook
image: $(params.image)
- command: ['entrypoint']
+ command: ['ansible-runner']
args:
- - ansible-runner
- run
- $(params.args)
- $(params.project-dir)
diff --git a/task/ansible-runner/0.2/tests/pre-apply-task-hook.sh b/task/ansible-runner/0.3/tests/pre-apply-task-hook.sh
old mode 100755
new mode 100644
diff --git a/task/ansible-runner/0.2/tests/resources.yaml b/task/ansible-runner/0.3/tests/resources.yaml
index b8c0a41..e091721 100644
--- a/task/ansible-runner/0.2/tests/resources.yaml
+++ b/task/ansible-runner/0.3/tests/resources.yaml
@@ -14,7 +14,7 @@ apiVersion: v1
kind: ServiceAccount
metadata:
name: ansible-deployer-account
- namespace: ansible-runner-0-2
+ namespace: ansible-runner-0-3
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
@@ -41,7 +41,7 @@ metadata:
subjects:
- kind: ServiceAccount
name: ansible-deployer-account
- namespace: ansible-runner-0-2
+ namespace: ansible-runner-0-3
roleRef:
kind: ClusterRole
name: ansible-deployer
diff --git a/task/ansible-runner/0.2/tests/run.yaml b/task/ansible-runner/0.3/tests/run.yaml
index 3d5c009..b3cf74a 100644
--- a/task/ansible-runner/0.2/tests/run.yaml
+++ b/task/ansible-runner/0.3/tests/run.yaml
@@ -1,5 +1,5 @@
---
-apiVersion: tekton.dev/v1beta1
+apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: ansibler-runner-pipeline
@@ -16,9 +16,10 @@ spec:
params:
- name: url
value: |
- https://github.com/vinamra28/tektoncd-ansible-runner-example
+ https://github.com/sveno1990/catalog/
- name: revision
- value: 'master'
+ value: 'feature/ansible-runner-v0.3'
+
- name: deleteExisting
value: 'true'
# ansible-runner
@@ -32,17 +33,18 @@ spec:
workspace: runner-dir
params:
- name: project-dir
- value: 'kubernetes'
+ value: 'task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes'
- name: args
value: ['-p', 'list-pods.yml']
---
-apiVersion: tekton.dev/v1beta1
+apiVersion: tekton.dev/v1
kind: PipelineRun
metadata:
name: ansibler-runner-pipeline-run
spec:
- serviceAccountName: ansible-deployer-account
+ taskRunTemplate:
+ serviceAccountName: ansible-deployer-account
pipelineRef:
name: ansibler-runner-pipeline
workspaces:
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/README.md b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/README.md
new file mode 100644
index 0000000..63e6e35
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/README.md
@@ -0,0 +1,65 @@
+# Tektoncd Ansible Runner Examples
+
+A repo to hold Ansible runner examples for the Tektoncd Task `ansible-runner`
+
+
+## Common Tasks
+
+```shell
+kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/master/task/git-clone/0.1/git-clone.yaml
+kubectl apply -f https://raw.githubusercontent.com/tektoncd-ansible-runner-example/catalog/master/playbooks-pvc.yaml
+```
+
+## Examples
+
+Run the following Task to clone this repository
+
+```shell
+tkn task start git-clone \
+ --workspace=name=output,claimName=ansible-playbooks \
+ --param=url=https://github.com/kameshsampath/tektoncd-ansible-runner-example \
+ --param=revision=master \
+ --param=deleteExisting=true \
+ --showlog
+```
+
+### Service Account
+
+You need proper RBAC in Kubernetes to allow it to perform the example tasks:
+
+```shell
+kubectl apply -f https://raw.githubusercontent.com/tektoncd-ansible-runner-example/master/kubernetes/ansible-deployer.yaml
+```
+
+### Listing pods
+
+```shell
+ tkn task start ansible-runner \
+ --serviceaccount ansible-deployer-account \
+ --param=project-dir=kubernetes \
+ --param=args='-p list-pods.yml' \
+ --workspace=name=runner-dir,claimName=ansible-playbooks \
+ --showlog
+```
+
+### Create Deployment
+
+```shell
+ tkn task start ansible-runner \
+ --serviceaccount ansible-deployer-account \
+ --param=project-dir=kubernetes \
+ --param=args='-p create-deployment.yml' \
+ --workspace=name=runner-dir,claimName=ansible-playbooks \
+ --showlog
+```
+
+### Create Service
+
+```shell
+ tkn task start ansible-runner \
+ --serviceaccount ansible-deployer-account \
+ --param=project-dir=kubernetes \
+ --param=args='-p create-service.yml' \
+ --workspace=name=runner-dir,claimName=ansible-playbooks \
+ --showlog
+```
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/ansible-deployer.yaml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/ansible-deployer.yaml
new file mode 100644
index 0000000..83ad1c0
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/ansible-deployer.yaml
@@ -0,0 +1,36 @@
+apiVersion: v1
+kind: ServiceAccount
+metadata:
+ name: ansible-deployer-account
+ namespace: default
+---
+kind: ClusterRole
+apiVersion: rbac.authorization.k8s.io/v1
+metadata:
+ name: ansible-deployer
+rules:
+ # Core API
+ - apiGroups: ['']
+ resources: ['services', 'pods', 'deployments', 'configmaps', 'secrets']
+ verbs: ['get', 'list', 'create', 'update', 'delete', 'patch', 'watch']
+ # Apps API
+ - apiGroups: ['apps']
+ resources: ['deployments', 'daemonsets', 'jobs']
+ verbs: ['get', 'list', 'create', 'update', 'delete', 'patch', 'watch']
+ # Knative API
+ - apiGroups: ['serving.knative.dev']
+ resources: ['services', 'revisions', 'routes']
+ verbs: ['get', 'list', 'create', 'update', 'delete', 'patch', 'watch']
+---
+apiVersion: rbac.authorization.k8s.io/v1beta1
+kind: ClusterRoleBinding
+metadata:
+ name: ansible-deployer-binding
+subjects:
+ - kind: ServiceAccount
+ name: ansible-deployer-account
+ namespace: default
+roleRef:
+ kind: ClusterRole
+ name: ansible-deployer
+ apiGroup: rbac.authorization.k8s.io
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-deployment.yml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-deployment.yml
new file mode 100644
index 0000000..1ff2d33
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-deployment.yml
@@ -0,0 +1,45 @@
+- hosts: localhost
+ connection: local
+ collections:
+ - community.kubernetes
+ tasks:
+ - name: Create a new deployment
+ k8s:
+ state: present
+ resource_definition: |
+ apiVersion: apps/v1
+ kind: Deployment
+ metadata:
+ name: helloworld
+ namespace: funstuff
+ spec:
+ selector:
+ matchLabels:
+ app: helloworld
+ template:
+ metadata:
+ labels:
+ app: helloworld
+ spec:
+ containers:
+ - name: helloworld
+ image: quay.io/kameshsampath/quarkus-helloworld
+ resources:
+ limits:
+ memory: "150Mi"
+ cpu: "500m"
+ ports:
+ - containerPort: 8080
+ wait: yes
+ register: helloworld_deployment
+ - name: Get the Deployment
+ k8s_info:
+ kind: Deployment
+ namespace: funstuff
+ register: funstuff_deployments_list
+ - name: Log Deployment Details
+ debug:
+ msg: "{{ item | json_query('metadata.name') }}"
+ loop: '{{funstuff_deployments_list.resources}}'
+ loop_control:
+ label: "Deployment (Namespace: {{item | json_query('metadata.namespace')}},Replicas:{{ item | json_query('spec.replicas')}})"
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-service.yml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-service.yml
new file mode 100644
index 0000000..ad8b5ce
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-service.yml
@@ -0,0 +1,33 @@
+- hosts: localhost
+ connection: local
+ collections:
+ - community.kubernetes
+ tasks:
+ - name: Create a new Service
+ k8s:
+ state: present
+ resource_definition: |
+ apiVersion: v1
+ kind: Service
+ metadata:
+ name: helloworld
+ namespace: funstuff
+ spec:
+ selector:
+ app: helloworld
+ ports:
+ - port: 8080
+ targetPort: 8080
+ wait: yes
+ register: helloworld_svc
+ - name: Get the Service
+ k8s_info:
+ kind: Service
+ namespace: funstuff
+ register: funstuff_service_list
+ - name: Log Service Details
+ debug:
+ msg: "{{ item | json_query('metadata.name') }}"
+ loop: '{{funstuff_service_list.resources}}'
+ loop_control:
+ label: "Service (Namespace: {{item | json_query('metadata.namespace')}})"
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/kustomization.yaml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/kustomization.yaml
new file mode 100644
index 0000000..590f43e
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/kustomization.yaml
@@ -0,0 +1,13 @@
+apiVersion: kustomize.config.k8s.io/v1beta1
+kind: Kustomization
+
+namespace: demos
+
+generatorOptions:
+ disableNameSuffixHash: true
+
+commonLabels:
+ tekton.dev/task: ansible-runner
+
+resources:
+ - ansible-deployer.yaml
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/list-pods.yml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/list-pods.yml
new file mode 100644
index 0000000..a0210b2
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/list-pods.yml
@@ -0,0 +1,16 @@
+- hosts: localhost
+ connection: local
+ collections:
+ - community.kubernetes.core
+ tasks:
+ - name: List Pods in namespace
+ kubernetes.core.k8s_info:
+ kind: Pod
+ namespace: kube-system
+ register: kube_system_pods_list
+ - name: Show the list of pods
+ debug:
+ msg: "{{ item | json_query('metadata.name') }}"
+ loop: '{{kube_system_pods_list.resources}}'
+ loop_control:
+ label: "Pod(Namespace: {{item | json_query('metadata.namespace') }})"
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.txt b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.txt
new file mode 100644
index 0000000..60af612
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.txt
@@ -0,0 +1,3 @@
+kubernetes>=24.2.0
+requests-oauthlib
+jsonpatch
\ No newline at end of file
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.yml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.yml
new file mode 100644
index 0000000..4d8d85c
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.yml
@@ -0,0 +1,6 @@
+---
+collections:
+ - name: community.kubernetes.core
+ version: 2.0.1
+ - name: community.general
+ version: 10.7.0
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/playbooks-pvc.yaml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/playbooks-pvc.yaml
new file mode 100644
index 0000000..5075f19
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/playbooks-pvc.yaml
@@ -0,0 +1,11 @@
+apiVersion: v1
+kind: PersistentVolumeClaim
+metadata:
+ name: ansible-playbooks
+spec:
+ accessModes:
+ - ReadWriteOnce
+ volumeMode: Filesystem
+ resources:
+ requests:
+ storage: 1Gi |
Diff between version 0.2 and 0.3diff --git a/task/ansible-runner/0.2/README.md b/task/ansible-runner/0.3/README.md
index 257bc2d..bf96ba0 100644
--- a/task/ansible-runner/0.2/README.md
+++ b/task/ansible-runner/0.3/README.md
@@ -9,7 +9,7 @@ The latest versions of ansible-runner requires [`community.general`](https://git
Create the Task and other resources:
```shell
-kubectl apply --filename https://api.hub.tekton.dev/v1/resource/tekton/task/ansible-runner/0.2/raw
+kubectl apply --filename https://api.hub.tekton.dev/v1/resource/tekton/task/ansible-runner/0.3/raw
```
Verify the created tasks:
@@ -23,10 +23,12 @@ tkn task ls
* **project-dir**: The ansible-runner private data dir
* **args:**: The array of arguments to pass to the runner command (_default:_ --help)
* **user-home**: Absolute path to the user's home directory. (_default:_ /tekton/home)
+* **workspaces_ssl_ca_file**: file name of ca bundle. (_default:_ ca-bundle.crt)
## Workspaces
* **runner-dir**: A [workspace](https://github.com/tektoncd/pipeline/blob/main/docs/workspaces.md) to hold the `private_data_dir` as described in https://ansible-runner.readthedocs.io/en/latest/intro.html#runner-input-directory-hierarchy[Runner Directory]
+* **ssl-ca-directory**: A optional [workspace](https://github.com/tektoncd/pipeline/blob/main/docs/workspaces.md) to hold the ca_certs for custom certificate authorities.
## Platforms
@@ -47,7 +49,7 @@ All the examples will be run in namespace called `funstuff`. Create the namespac
```shell
kubectl apply -f https://api.hub.tekton.dev/v1/resource/tekton/task/git-clone/0.5/raw \
- -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.2/support/playbooks-pvc.yaml
+ -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.3/support/playbooks-pvc.yaml
```
Do the git clone of the examples repository:
@@ -66,7 +68,7 @@ tkn task start git-clone \
As we will do get, list and create on the namespace, lets use a service account that has right RBAC:
```shell
-kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.2/support/ansible-deployer.yaml
+kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.3/support/ansible-deployer.yaml
```
### Run Tasks
diff --git a/task/ansible-runner/0.2/ansible-runner.yaml b/task/ansible-runner/0.3/ansible-runner.yaml
index d047c75..f0c6b04 100644
--- a/task/ansible-runner/0.2/ansible-runner.yaml
+++ b/task/ansible-runner/0.3/ansible-runner.yaml
@@ -1,14 +1,14 @@
---
-apiVersion: tekton.dev/v1beta1
+apiVersion: tekton.dev/v1
kind: Task
metadata:
name: ansible-runner
labels:
- app.kubernetes.io/version: '0.2'
- app.kubernetes.io/ansible-version: '2.12.5'
+ app.kubernetes.io/version: '0.3'
+ app.kubernetes.io/ansible-version: '2.18.2'
annotations:
- tekton.dev/deprecated: "true"
- tekton.dev/pipelines.minVersion: '0.12.1'
+ tekton.dev/deprecated: "false"
+ tekton.dev/pipelines.minVersion: '0.19.0'
tekton.dev/categories: CLI
tekton.dev/tags: cli
tekton.dev/displayName: 'Ansible Runner'
@@ -20,10 +20,16 @@ spec:
workspaces:
- name: runner-dir
description: The Ansibler runner directory
+ - name: ssl-ca-directory
+ optional: true
+ description: |
+ A Workspace containing CA certificates, this will be used by Ansible and pip to
+ verify the peer with when interacting with remote repositories using
+ HTTPS.
params:
- name: project-dir
description: The project directory under the workspace runner-dir
- default: 'project'
+ default: '.'
- name: args
description: The arguments to pass ansible-runner
type: array
@@ -34,11 +40,16 @@ spec:
default: /tekton/home
- name: image
description: Ansible runner image.
- default: quay.io/ansible/ansible-runner:stable-2.12-latest #tag: stable-2.12-latest
+ default: ghcr.io/ansible/community-ansible-dev-tools:v25.5.1 #tag: v25.5.1
+ - name: workspaces_ssl_ca_file
+ default: ""
+
stepTemplate:
env:
- name: HOME
value: $(params.user-home)
+ - name: CURL_CA_BUNDLE
+ value: "$(workspaces.ssl-ca-directory.path)$(params.workspaces_ssl_ca_file)"
steps:
- name: requirements
image: $(params.image)
@@ -63,9 +74,8 @@ spec:
- name: run-playbook
image: $(params.image)
- command: ['entrypoint']
+ command: ['ansible-runner']
args:
- - ansible-runner
- run
- $(params.args)
- $(params.project-dir)
diff --git a/task/ansible-runner/0.2/tests/pre-apply-task-hook.sh b/task/ansible-runner/0.3/tests/pre-apply-task-hook.sh
old mode 100755
new mode 100644
diff --git a/task/ansible-runner/0.2/tests/resources.yaml b/task/ansible-runner/0.3/tests/resources.yaml
index b8c0a41..e091721 100644
--- a/task/ansible-runner/0.2/tests/resources.yaml
+++ b/task/ansible-runner/0.3/tests/resources.yaml
@@ -14,7 +14,7 @@ apiVersion: v1
kind: ServiceAccount
metadata:
name: ansible-deployer-account
- namespace: ansible-runner-0-2
+ namespace: ansible-runner-0-3
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
@@ -41,7 +41,7 @@ metadata:
subjects:
- kind: ServiceAccount
name: ansible-deployer-account
- namespace: ansible-runner-0-2
+ namespace: ansible-runner-0-3
roleRef:
kind: ClusterRole
name: ansible-deployer
diff --git a/task/ansible-runner/0.2/tests/run.yaml b/task/ansible-runner/0.3/tests/run.yaml
index 3d5c009..b3cf74a 100644
--- a/task/ansible-runner/0.2/tests/run.yaml
+++ b/task/ansible-runner/0.3/tests/run.yaml
@@ -1,5 +1,5 @@
---
-apiVersion: tekton.dev/v1beta1
+apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: ansibler-runner-pipeline
@@ -16,9 +16,10 @@ spec:
params:
- name: url
value: |
- https://github.com/vinamra28/tektoncd-ansible-runner-example
+ https://github.com/sveno1990/catalog/
- name: revision
- value: 'master'
+ value: 'feature/ansible-runner-v0.3'
+
- name: deleteExisting
value: 'true'
# ansible-runner
@@ -32,17 +33,18 @@ spec:
workspace: runner-dir
params:
- name: project-dir
- value: 'kubernetes'
+ value: 'task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes'
- name: args
value: ['-p', 'list-pods.yml']
---
-apiVersion: tekton.dev/v1beta1
+apiVersion: tekton.dev/v1
kind: PipelineRun
metadata:
name: ansibler-runner-pipeline-run
spec:
- serviceAccountName: ansible-deployer-account
+ taskRunTemplate:
+ serviceAccountName: ansible-deployer-account
pipelineRef:
name: ansibler-runner-pipeline
workspaces:
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/README.md b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/README.md
new file mode 100644
index 0000000..63e6e35
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/README.md
@@ -0,0 +1,65 @@
+# Tektoncd Ansible Runner Examples
+
+A repo to hold Ansible runner examples for the Tektoncd Task `ansible-runner`
+
+
+## Common Tasks
+
+```shell
+kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/master/task/git-clone/0.1/git-clone.yaml
+kubectl apply -f https://raw.githubusercontent.com/tektoncd-ansible-runner-example/catalog/master/playbooks-pvc.yaml
+```
+
+## Examples
+
+Run the following Task to clone this repository
+
+```shell
+tkn task start git-clone \
+ --workspace=name=output,claimName=ansible-playbooks \
+ --param=url=https://github.com/kameshsampath/tektoncd-ansible-runner-example \
+ --param=revision=master \
+ --param=deleteExisting=true \
+ --showlog
+```
+
+### Service Account
+
+You need proper RBAC in Kubernetes to allow it to perform the example tasks:
+
+```shell
+kubectl apply -f https://raw.githubusercontent.com/tektoncd-ansible-runner-example/master/kubernetes/ansible-deployer.yaml
+```
+
+### Listing pods
+
+```shell
+ tkn task start ansible-runner \
+ --serviceaccount ansible-deployer-account \
+ --param=project-dir=kubernetes \
+ --param=args='-p list-pods.yml' \
+ --workspace=name=runner-dir,claimName=ansible-playbooks \
+ --showlog
+```
+
+### Create Deployment
+
+```shell
+ tkn task start ansible-runner \
+ --serviceaccount ansible-deployer-account \
+ --param=project-dir=kubernetes \
+ --param=args='-p create-deployment.yml' \
+ --workspace=name=runner-dir,claimName=ansible-playbooks \
+ --showlog
+```
+
+### Create Service
+
+```shell
+ tkn task start ansible-runner \
+ --serviceaccount ansible-deployer-account \
+ --param=project-dir=kubernetes \
+ --param=args='-p create-service.yml' \
+ --workspace=name=runner-dir,claimName=ansible-playbooks \
+ --showlog
+```
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/ansible-deployer.yaml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/ansible-deployer.yaml
new file mode 100644
index 0000000..83ad1c0
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/ansible-deployer.yaml
@@ -0,0 +1,36 @@
+apiVersion: v1
+kind: ServiceAccount
+metadata:
+ name: ansible-deployer-account
+ namespace: default
+---
+kind: ClusterRole
+apiVersion: rbac.authorization.k8s.io/v1
+metadata:
+ name: ansible-deployer
+rules:
+ # Core API
+ - apiGroups: ['']
+ resources: ['services', 'pods', 'deployments', 'configmaps', 'secrets']
+ verbs: ['get', 'list', 'create', 'update', 'delete', 'patch', 'watch']
+ # Apps API
+ - apiGroups: ['apps']
+ resources: ['deployments', 'daemonsets', 'jobs']
+ verbs: ['get', 'list', 'create', 'update', 'delete', 'patch', 'watch']
+ # Knative API
+ - apiGroups: ['serving.knative.dev']
+ resources: ['services', 'revisions', 'routes']
+ verbs: ['get', 'list', 'create', 'update', 'delete', 'patch', 'watch']
+---
+apiVersion: rbac.authorization.k8s.io/v1beta1
+kind: ClusterRoleBinding
+metadata:
+ name: ansible-deployer-binding
+subjects:
+ - kind: ServiceAccount
+ name: ansible-deployer-account
+ namespace: default
+roleRef:
+ kind: ClusterRole
+ name: ansible-deployer
+ apiGroup: rbac.authorization.k8s.io
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-deployment.yml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-deployment.yml
new file mode 100644
index 0000000..1ff2d33
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-deployment.yml
@@ -0,0 +1,45 @@
+- hosts: localhost
+ connection: local
+ collections:
+ - community.kubernetes
+ tasks:
+ - name: Create a new deployment
+ k8s:
+ state: present
+ resource_definition: |
+ apiVersion: apps/v1
+ kind: Deployment
+ metadata:
+ name: helloworld
+ namespace: funstuff
+ spec:
+ selector:
+ matchLabels:
+ app: helloworld
+ template:
+ metadata:
+ labels:
+ app: helloworld
+ spec:
+ containers:
+ - name: helloworld
+ image: quay.io/kameshsampath/quarkus-helloworld
+ resources:
+ limits:
+ memory: "150Mi"
+ cpu: "500m"
+ ports:
+ - containerPort: 8080
+ wait: yes
+ register: helloworld_deployment
+ - name: Get the Deployment
+ k8s_info:
+ kind: Deployment
+ namespace: funstuff
+ register: funstuff_deployments_list
+ - name: Log Deployment Details
+ debug:
+ msg: "{{ item | json_query('metadata.name') }}"
+ loop: '{{funstuff_deployments_list.resources}}'
+ loop_control:
+ label: "Deployment (Namespace: {{item | json_query('metadata.namespace')}},Replicas:{{ item | json_query('spec.replicas')}})"
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-service.yml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-service.yml
new file mode 100644
index 0000000..ad8b5ce
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-service.yml
@@ -0,0 +1,33 @@
+- hosts: localhost
+ connection: local
+ collections:
+ - community.kubernetes
+ tasks:
+ - name: Create a new Service
+ k8s:
+ state: present
+ resource_definition: |
+ apiVersion: v1
+ kind: Service
+ metadata:
+ name: helloworld
+ namespace: funstuff
+ spec:
+ selector:
+ app: helloworld
+ ports:
+ - port: 8080
+ targetPort: 8080
+ wait: yes
+ register: helloworld_svc
+ - name: Get the Service
+ k8s_info:
+ kind: Service
+ namespace: funstuff
+ register: funstuff_service_list
+ - name: Log Service Details
+ debug:
+ msg: "{{ item | json_query('metadata.name') }}"
+ loop: '{{funstuff_service_list.resources}}'
+ loop_control:
+ label: "Service (Namespace: {{item | json_query('metadata.namespace')}})"
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/kustomization.yaml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/kustomization.yaml
new file mode 100644
index 0000000..590f43e
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/kustomization.yaml
@@ -0,0 +1,13 @@
+apiVersion: kustomize.config.k8s.io/v1beta1
+kind: Kustomization
+
+namespace: demos
+
+generatorOptions:
+ disableNameSuffixHash: true
+
+commonLabels:
+ tekton.dev/task: ansible-runner
+
+resources:
+ - ansible-deployer.yaml
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/list-pods.yml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/list-pods.yml
new file mode 100644
index 0000000..b207131
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/list-pods.yml
@@ -0,0 +1,16 @@
+- hosts: localhost
+ connection: local
+ collections:
+ - kubernetes.core
+ tasks:
+ - name: List Pods in namespace
+ kubernetes.core.k8s_info:
+ kind: Pod
+ namespace: kube-system
+ register: kube_system_pods_list
+ - name: Show the list of pods
+ debug:
+ msg: "{{ item | json_query('metadata.name') }}"
+ loop: '{{kube_system_pods_list.resources}}'
+ loop_control:
+ label: "Pod(Namespace: {{item | json_query('metadata.namespace') }})"
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.txt b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.txt
new file mode 100644
index 0000000..60af612
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.txt
@@ -0,0 +1,3 @@
+kubernetes>=24.2.0
+requests-oauthlib
+jsonpatch
\ No newline at end of file
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.yml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.yml
new file mode 100644
index 0000000..cf4f64c
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.yml
@@ -0,0 +1,6 @@
+---
+collections:
+ - name: kubernetes.core
+ version: 2.0.1
+ - name: community.general
+ version: 10.7.0
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/playbooks-pvc.yaml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/playbooks-pvc.yaml
new file mode 100644
index 0000000..5075f19
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/playbooks-pvc.yaml
@@ -0,0 +1,11 @@
+apiVersion: v1
+kind: PersistentVolumeClaim
+metadata:
+ name: ansible-playbooks
+spec:
+ accessModes:
+ - ReadWriteOnce
+ volumeMode: Filesystem
+ resources:
+ requests:
+ storage: 1Gi |
Diff between version 0.2 and 0.3diff --git a/task/ansible-runner/0.2/README.md b/task/ansible-runner/0.3/README.md
index 257bc2d..bf96ba0 100644
--- a/task/ansible-runner/0.2/README.md
+++ b/task/ansible-runner/0.3/README.md
@@ -9,7 +9,7 @@ The latest versions of ansible-runner requires [`community.general`](https://git
Create the Task and other resources:
```shell
-kubectl apply --filename https://api.hub.tekton.dev/v1/resource/tekton/task/ansible-runner/0.2/raw
+kubectl apply --filename https://api.hub.tekton.dev/v1/resource/tekton/task/ansible-runner/0.3/raw
```
Verify the created tasks:
@@ -23,10 +23,12 @@ tkn task ls
* **project-dir**: The ansible-runner private data dir
* **args:**: The array of arguments to pass to the runner command (_default:_ --help)
* **user-home**: Absolute path to the user's home directory. (_default:_ /tekton/home)
+* **workspaces_ssl_ca_file**: file name of ca bundle. (_default:_ ca-bundle.crt)
## Workspaces
* **runner-dir**: A [workspace](https://github.com/tektoncd/pipeline/blob/main/docs/workspaces.md) to hold the `private_data_dir` as described in https://ansible-runner.readthedocs.io/en/latest/intro.html#runner-input-directory-hierarchy[Runner Directory]
+* **ssl-ca-directory**: A optional [workspace](https://github.com/tektoncd/pipeline/blob/main/docs/workspaces.md) to hold the ca_certs for custom certificate authorities.
## Platforms
@@ -47,7 +49,7 @@ All the examples will be run in namespace called `funstuff`. Create the namespac
```shell
kubectl apply -f https://api.hub.tekton.dev/v1/resource/tekton/task/git-clone/0.5/raw \
- -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.2/support/playbooks-pvc.yaml
+ -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.3/support/playbooks-pvc.yaml
```
Do the git clone of the examples repository:
@@ -66,7 +68,7 @@ tkn task start git-clone \
As we will do get, list and create on the namespace, lets use a service account that has right RBAC:
```shell
-kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.2/support/ansible-deployer.yaml
+kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.3/support/ansible-deployer.yaml
```
### Run Tasks
diff --git a/task/ansible-runner/0.2/ansible-runner.yaml b/task/ansible-runner/0.3/ansible-runner.yaml
index d047c75..f0c6b04 100644
--- a/task/ansible-runner/0.2/ansible-runner.yaml
+++ b/task/ansible-runner/0.3/ansible-runner.yaml
@@ -1,14 +1,14 @@
---
-apiVersion: tekton.dev/v1beta1
+apiVersion: tekton.dev/v1
kind: Task
metadata:
name: ansible-runner
labels:
- app.kubernetes.io/version: '0.2'
- app.kubernetes.io/ansible-version: '2.12.5'
+ app.kubernetes.io/version: '0.3'
+ app.kubernetes.io/ansible-version: '2.18.2'
annotations:
- tekton.dev/deprecated: "true"
- tekton.dev/pipelines.minVersion: '0.12.1'
+ tekton.dev/deprecated: "false"
+ tekton.dev/pipelines.minVersion: '0.19.0'
tekton.dev/categories: CLI
tekton.dev/tags: cli
tekton.dev/displayName: 'Ansible Runner'
@@ -20,10 +20,16 @@ spec:
workspaces:
- name: runner-dir
description: The Ansibler runner directory
+ - name: ssl-ca-directory
+ optional: true
+ description: |
+ A Workspace containing CA certificates, this will be used by Ansible and pip to
+ verify the peer with when interacting with remote repositories using
+ HTTPS.
params:
- name: project-dir
description: The project directory under the workspace runner-dir
- default: 'project'
+ default: '.'
- name: args
description: The arguments to pass ansible-runner
type: array
@@ -34,11 +40,16 @@ spec:
default: /tekton/home
- name: image
description: Ansible runner image.
- default: quay.io/ansible/ansible-runner:stable-2.12-latest #tag: stable-2.12-latest
+ default: ghcr.io/ansible/community-ansible-dev-tools:v25.5.1 #tag: v25.5.1
+ - name: workspaces_ssl_ca_file
+ default: ""
+
stepTemplate:
env:
- name: HOME
value: $(params.user-home)
+ - name: CURL_CA_BUNDLE
+ value: "$(workspaces.ssl-ca-directory.path)$(params.workspaces_ssl_ca_file)"
steps:
- name: requirements
image: $(params.image)
@@ -63,9 +74,8 @@ spec:
- name: run-playbook
image: $(params.image)
- command: ['entrypoint']
+ command: ['ansible-runner']
args:
- - ansible-runner
- run
- $(params.args)
- $(params.project-dir)
diff --git a/task/ansible-runner/0.2/tests/pre-apply-task-hook.sh b/task/ansible-runner/0.3/tests/pre-apply-task-hook.sh
old mode 100755
new mode 100644
diff --git a/task/ansible-runner/0.2/tests/resources.yaml b/task/ansible-runner/0.3/tests/resources.yaml
index b8c0a41..e091721 100644
--- a/task/ansible-runner/0.2/tests/resources.yaml
+++ b/task/ansible-runner/0.3/tests/resources.yaml
@@ -14,7 +14,7 @@ apiVersion: v1
kind: ServiceAccount
metadata:
name: ansible-deployer-account
- namespace: ansible-runner-0-2
+ namespace: ansible-runner-0-3
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
@@ -41,7 +41,7 @@ metadata:
subjects:
- kind: ServiceAccount
name: ansible-deployer-account
- namespace: ansible-runner-0-2
+ namespace: ansible-runner-0-3
roleRef:
kind: ClusterRole
name: ansible-deployer
diff --git a/task/ansible-runner/0.2/tests/run.yaml b/task/ansible-runner/0.3/tests/run.yaml
index 3d5c009..b3cf74a 100644
--- a/task/ansible-runner/0.2/tests/run.yaml
+++ b/task/ansible-runner/0.3/tests/run.yaml
@@ -1,5 +1,5 @@
---
-apiVersion: tekton.dev/v1beta1
+apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: ansibler-runner-pipeline
@@ -16,9 +16,10 @@ spec:
params:
- name: url
value: |
- https://github.com/vinamra28/tektoncd-ansible-runner-example
+ https://github.com/sveno1990/catalog/
- name: revision
- value: 'master'
+ value: 'feature/ansible-runner-v0.3'
+
- name: deleteExisting
value: 'true'
# ansible-runner
@@ -32,17 +33,18 @@ spec:
workspace: runner-dir
params:
- name: project-dir
- value: 'kubernetes'
+ value: 'task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes'
- name: args
value: ['-p', 'list-pods.yml']
---
-apiVersion: tekton.dev/v1beta1
+apiVersion: tekton.dev/v1
kind: PipelineRun
metadata:
name: ansibler-runner-pipeline-run
spec:
- serviceAccountName: ansible-deployer-account
+ taskRunTemplate:
+ serviceAccountName: ansible-deployer-account
pipelineRef:
name: ansibler-runner-pipeline
workspaces:
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/README.md b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/README.md
new file mode 100644
index 0000000..63e6e35
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/README.md
@@ -0,0 +1,65 @@
+# Tektoncd Ansible Runner Examples
+
+A repo to hold Ansible runner examples for the Tektoncd Task `ansible-runner`
+
+
+## Common Tasks
+
+```shell
+kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/master/task/git-clone/0.1/git-clone.yaml
+kubectl apply -f https://raw.githubusercontent.com/tektoncd-ansible-runner-example/catalog/master/playbooks-pvc.yaml
+```
+
+## Examples
+
+Run the following Task to clone this repository
+
+```shell
+tkn task start git-clone \
+ --workspace=name=output,claimName=ansible-playbooks \
+ --param=url=https://github.com/kameshsampath/tektoncd-ansible-runner-example \
+ --param=revision=master \
+ --param=deleteExisting=true \
+ --showlog
+```
+
+### Service Account
+
+You need proper RBAC in Kubernetes to allow it to perform the example tasks:
+
+```shell
+kubectl apply -f https://raw.githubusercontent.com/tektoncd-ansible-runner-example/master/kubernetes/ansible-deployer.yaml
+```
+
+### Listing pods
+
+```shell
+ tkn task start ansible-runner \
+ --serviceaccount ansible-deployer-account \
+ --param=project-dir=kubernetes \
+ --param=args='-p list-pods.yml' \
+ --workspace=name=runner-dir,claimName=ansible-playbooks \
+ --showlog
+```
+
+### Create Deployment
+
+```shell
+ tkn task start ansible-runner \
+ --serviceaccount ansible-deployer-account \
+ --param=project-dir=kubernetes \
+ --param=args='-p create-deployment.yml' \
+ --workspace=name=runner-dir,claimName=ansible-playbooks \
+ --showlog
+```
+
+### Create Service
+
+```shell
+ tkn task start ansible-runner \
+ --serviceaccount ansible-deployer-account \
+ --param=project-dir=kubernetes \
+ --param=args='-p create-service.yml' \
+ --workspace=name=runner-dir,claimName=ansible-playbooks \
+ --showlog
+```
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/ansible-deployer.yaml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/ansible-deployer.yaml
new file mode 100644
index 0000000..83ad1c0
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/ansible-deployer.yaml
@@ -0,0 +1,36 @@
+apiVersion: v1
+kind: ServiceAccount
+metadata:
+ name: ansible-deployer-account
+ namespace: default
+---
+kind: ClusterRole
+apiVersion: rbac.authorization.k8s.io/v1
+metadata:
+ name: ansible-deployer
+rules:
+ # Core API
+ - apiGroups: ['']
+ resources: ['services', 'pods', 'deployments', 'configmaps', 'secrets']
+ verbs: ['get', 'list', 'create', 'update', 'delete', 'patch', 'watch']
+ # Apps API
+ - apiGroups: ['apps']
+ resources: ['deployments', 'daemonsets', 'jobs']
+ verbs: ['get', 'list', 'create', 'update', 'delete', 'patch', 'watch']
+ # Knative API
+ - apiGroups: ['serving.knative.dev']
+ resources: ['services', 'revisions', 'routes']
+ verbs: ['get', 'list', 'create', 'update', 'delete', 'patch', 'watch']
+---
+apiVersion: rbac.authorization.k8s.io/v1beta1
+kind: ClusterRoleBinding
+metadata:
+ name: ansible-deployer-binding
+subjects:
+ - kind: ServiceAccount
+ name: ansible-deployer-account
+ namespace: default
+roleRef:
+ kind: ClusterRole
+ name: ansible-deployer
+ apiGroup: rbac.authorization.k8s.io
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-deployment.yml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-deployment.yml
new file mode 100644
index 0000000..1ff2d33
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-deployment.yml
@@ -0,0 +1,45 @@
+- hosts: localhost
+ connection: local
+ collections:
+ - community.kubernetes
+ tasks:
+ - name: Create a new deployment
+ k8s:
+ state: present
+ resource_definition: |
+ apiVersion: apps/v1
+ kind: Deployment
+ metadata:
+ name: helloworld
+ namespace: funstuff
+ spec:
+ selector:
+ matchLabels:
+ app: helloworld
+ template:
+ metadata:
+ labels:
+ app: helloworld
+ spec:
+ containers:
+ - name: helloworld
+ image: quay.io/kameshsampath/quarkus-helloworld
+ resources:
+ limits:
+ memory: "150Mi"
+ cpu: "500m"
+ ports:
+ - containerPort: 8080
+ wait: yes
+ register: helloworld_deployment
+ - name: Get the Deployment
+ k8s_info:
+ kind: Deployment
+ namespace: funstuff
+ register: funstuff_deployments_list
+ - name: Log Deployment Details
+ debug:
+ msg: "{{ item | json_query('metadata.name') }}"
+ loop: '{{funstuff_deployments_list.resources}}'
+ loop_control:
+ label: "Deployment (Namespace: {{item | json_query('metadata.namespace')}},Replicas:{{ item | json_query('spec.replicas')}})"
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-service.yml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-service.yml
new file mode 100644
index 0000000..ad8b5ce
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-service.yml
@@ -0,0 +1,33 @@
+- hosts: localhost
+ connection: local
+ collections:
+ - community.kubernetes
+ tasks:
+ - name: Create a new Service
+ k8s:
+ state: present
+ resource_definition: |
+ apiVersion: v1
+ kind: Service
+ metadata:
+ name: helloworld
+ namespace: funstuff
+ spec:
+ selector:
+ app: helloworld
+ ports:
+ - port: 8080
+ targetPort: 8080
+ wait: yes
+ register: helloworld_svc
+ - name: Get the Service
+ k8s_info:
+ kind: Service
+ namespace: funstuff
+ register: funstuff_service_list
+ - name: Log Service Details
+ debug:
+ msg: "{{ item | json_query('metadata.name') }}"
+ loop: '{{funstuff_service_list.resources}}'
+ loop_control:
+ label: "Service (Namespace: {{item | json_query('metadata.namespace')}})"
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/kustomization.yaml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/kustomization.yaml
new file mode 100644
index 0000000..590f43e
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/kustomization.yaml
@@ -0,0 +1,13 @@
+apiVersion: kustomize.config.k8s.io/v1beta1
+kind: Kustomization
+
+namespace: demos
+
+generatorOptions:
+ disableNameSuffixHash: true
+
+commonLabels:
+ tekton.dev/task: ansible-runner
+
+resources:
+ - ansible-deployer.yaml
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/list-pods.yml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/list-pods.yml
new file mode 100644
index 0000000..b207131
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/list-pods.yml
@@ -0,0 +1,16 @@
+- hosts: localhost
+ connection: local
+ collections:
+ - kubernetes.core
+ tasks:
+ - name: List Pods in namespace
+ kubernetes.core.k8s_info:
+ kind: Pod
+ namespace: kube-system
+ register: kube_system_pods_list
+ - name: Show the list of pods
+ debug:
+ msg: "{{ item | json_query('metadata.name') }}"
+ loop: '{{kube_system_pods_list.resources}}'
+ loop_control:
+ label: "Pod(Namespace: {{item | json_query('metadata.namespace') }})"
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.txt b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.txt
new file mode 100644
index 0000000..5c2ac7b
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.txt
@@ -0,0 +1,4 @@
+kubernetes>=24.2.0
+requests-oauthlib
+jsonpatch
+jmespath
\ No newline at end of file
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.yml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.yml
new file mode 100644
index 0000000..cf4f64c
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.yml
@@ -0,0 +1,6 @@
+---
+collections:
+ - name: kubernetes.core
+ version: 2.0.1
+ - name: community.general
+ version: 10.7.0
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/playbooks-pvc.yaml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/playbooks-pvc.yaml
new file mode 100644
index 0000000..5075f19
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/playbooks-pvc.yaml
@@ -0,0 +1,11 @@
+apiVersion: v1
+kind: PersistentVolumeClaim
+metadata:
+ name: ansible-playbooks
+spec:
+ accessModes:
+ - ReadWriteOnce
+ volumeMode: Filesystem
+ resources:
+ requests:
+ storage: 1Gi |
|
/retest |
1 similar comment
|
/retest |
Diff between version 0.2 and 0.3diff --git a/task/ansible-runner/0.2/README.md b/task/ansible-runner/0.3/README.md
index 257bc2d..bf96ba0 100644
--- a/task/ansible-runner/0.2/README.md
+++ b/task/ansible-runner/0.3/README.md
@@ -9,7 +9,7 @@ The latest versions of ansible-runner requires [`community.general`](https://git
Create the Task and other resources:
```shell
-kubectl apply --filename https://api.hub.tekton.dev/v1/resource/tekton/task/ansible-runner/0.2/raw
+kubectl apply --filename https://api.hub.tekton.dev/v1/resource/tekton/task/ansible-runner/0.3/raw
```
Verify the created tasks:
@@ -23,10 +23,12 @@ tkn task ls
* **project-dir**: The ansible-runner private data dir
* **args:**: The array of arguments to pass to the runner command (_default:_ --help)
* **user-home**: Absolute path to the user's home directory. (_default:_ /tekton/home)
+* **workspaces_ssl_ca_file**: file name of ca bundle. (_default:_ ca-bundle.crt)
## Workspaces
* **runner-dir**: A [workspace](https://github.com/tektoncd/pipeline/blob/main/docs/workspaces.md) to hold the `private_data_dir` as described in https://ansible-runner.readthedocs.io/en/latest/intro.html#runner-input-directory-hierarchy[Runner Directory]
+* **ssl-ca-directory**: A optional [workspace](https://github.com/tektoncd/pipeline/blob/main/docs/workspaces.md) to hold the ca_certs for custom certificate authorities.
## Platforms
@@ -47,7 +49,7 @@ All the examples will be run in namespace called `funstuff`. Create the namespac
```shell
kubectl apply -f https://api.hub.tekton.dev/v1/resource/tekton/task/git-clone/0.5/raw \
- -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.2/support/playbooks-pvc.yaml
+ -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.3/support/playbooks-pvc.yaml
```
Do the git clone of the examples repository:
@@ -66,7 +68,7 @@ tkn task start git-clone \
As we will do get, list and create on the namespace, lets use a service account that has right RBAC:
```shell
-kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.2/support/ansible-deployer.yaml
+kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.3/support/ansible-deployer.yaml
```
### Run Tasks
diff --git a/task/ansible-runner/0.2/ansible-runner.yaml b/task/ansible-runner/0.3/ansible-runner.yaml
index d047c75..944ed05 100644
--- a/task/ansible-runner/0.2/ansible-runner.yaml
+++ b/task/ansible-runner/0.3/ansible-runner.yaml
@@ -1,14 +1,14 @@
---
-apiVersion: tekton.dev/v1beta1
+apiVersion: tekton.dev/v1
kind: Task
metadata:
name: ansible-runner
labels:
- app.kubernetes.io/version: '0.2'
- app.kubernetes.io/ansible-version: '2.12.5'
+ app.kubernetes.io/version: '0.3'
+ app.kubernetes.io/ansible-version: '2.18.2'
annotations:
- tekton.dev/deprecated: "true"
- tekton.dev/pipelines.minVersion: '0.12.1'
+ tekton.dev/deprecated: "false"
+ tekton.dev/pipelines.minVersion: '0.19.0'
tekton.dev/categories: CLI
tekton.dev/tags: cli
tekton.dev/displayName: 'Ansible Runner'
@@ -20,10 +20,16 @@ spec:
workspaces:
- name: runner-dir
description: The Ansibler runner directory
+ - name: ssl-ca-directory
+ optional: true
+ description: |
+ A Workspace containing CA certificates, this will be used by Ansible and pip to
+ verify the peer with when interacting with remote repositories using
+ HTTPS.
params:
- name: project-dir
description: The project directory under the workspace runner-dir
- default: 'project'
+ default: '.'
- name: args
description: The arguments to pass ansible-runner
type: array
@@ -34,11 +40,16 @@ spec:
default: /tekton/home
- name: image
description: Ansible runner image.
- default: quay.io/ansible/ansible-runner:stable-2.12-latest #tag: stable-2.12-latest
+ default: ghcr.io/ansible/community-ansible-dev-tools:v25.5.1 #tag: v25.5.1
+ - name: workspaces_ssl_ca_file
+ default: ""
+
stepTemplate:
env:
- name: HOME
value: $(params.user-home)
+ - name: SSL_CERT_FILE
+ value: "$(workspaces.ssl-ca-directory.path)$(params.workspaces_ssl_ca_file)"
steps:
- name: requirements
image: $(params.image)
@@ -63,9 +74,8 @@ spec:
- name: run-playbook
image: $(params.image)
- command: ['entrypoint']
+ command: ['ansible-runner']
args:
- - ansible-runner
- run
- $(params.args)
- $(params.project-dir)
diff --git a/task/ansible-runner/0.2/tests/pre-apply-task-hook.sh b/task/ansible-runner/0.3/tests/pre-apply-task-hook.sh
old mode 100755
new mode 100644
diff --git a/task/ansible-runner/0.2/tests/resources.yaml b/task/ansible-runner/0.3/tests/resources.yaml
index b8c0a41..e091721 100644
--- a/task/ansible-runner/0.2/tests/resources.yaml
+++ b/task/ansible-runner/0.3/tests/resources.yaml
@@ -14,7 +14,7 @@ apiVersion: v1
kind: ServiceAccount
metadata:
name: ansible-deployer-account
- namespace: ansible-runner-0-2
+ namespace: ansible-runner-0-3
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
@@ -41,7 +41,7 @@ metadata:
subjects:
- kind: ServiceAccount
name: ansible-deployer-account
- namespace: ansible-runner-0-2
+ namespace: ansible-runner-0-3
roleRef:
kind: ClusterRole
name: ansible-deployer
diff --git a/task/ansible-runner/0.2/tests/run.yaml b/task/ansible-runner/0.3/tests/run.yaml
index 3d5c009..b3cf74a 100644
--- a/task/ansible-runner/0.2/tests/run.yaml
+++ b/task/ansible-runner/0.3/tests/run.yaml
@@ -1,5 +1,5 @@
---
-apiVersion: tekton.dev/v1beta1
+apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: ansibler-runner-pipeline
@@ -16,9 +16,10 @@ spec:
params:
- name: url
value: |
- https://github.com/vinamra28/tektoncd-ansible-runner-example
+ https://github.com/sveno1990/catalog/
- name: revision
- value: 'master'
+ value: 'feature/ansible-runner-v0.3'
+
- name: deleteExisting
value: 'true'
# ansible-runner
@@ -32,17 +33,18 @@ spec:
workspace: runner-dir
params:
- name: project-dir
- value: 'kubernetes'
+ value: 'task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes'
- name: args
value: ['-p', 'list-pods.yml']
---
-apiVersion: tekton.dev/v1beta1
+apiVersion: tekton.dev/v1
kind: PipelineRun
metadata:
name: ansibler-runner-pipeline-run
spec:
- serviceAccountName: ansible-deployer-account
+ taskRunTemplate:
+ serviceAccountName: ansible-deployer-account
pipelineRef:
name: ansibler-runner-pipeline
workspaces:
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/README.md b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/README.md
new file mode 100644
index 0000000..63e6e35
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/README.md
@@ -0,0 +1,65 @@
+# Tektoncd Ansible Runner Examples
+
+A repo to hold Ansible runner examples for the Tektoncd Task `ansible-runner`
+
+
+## Common Tasks
+
+```shell
+kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/master/task/git-clone/0.1/git-clone.yaml
+kubectl apply -f https://raw.githubusercontent.com/tektoncd-ansible-runner-example/catalog/master/playbooks-pvc.yaml
+```
+
+## Examples
+
+Run the following Task to clone this repository
+
+```shell
+tkn task start git-clone \
+ --workspace=name=output,claimName=ansible-playbooks \
+ --param=url=https://github.com/kameshsampath/tektoncd-ansible-runner-example \
+ --param=revision=master \
+ --param=deleteExisting=true \
+ --showlog
+```
+
+### Service Account
+
+You need proper RBAC in Kubernetes to allow it to perform the example tasks:
+
+```shell
+kubectl apply -f https://raw.githubusercontent.com/tektoncd-ansible-runner-example/master/kubernetes/ansible-deployer.yaml
+```
+
+### Listing pods
+
+```shell
+ tkn task start ansible-runner \
+ --serviceaccount ansible-deployer-account \
+ --param=project-dir=kubernetes \
+ --param=args='-p list-pods.yml' \
+ --workspace=name=runner-dir,claimName=ansible-playbooks \
+ --showlog
+```
+
+### Create Deployment
+
+```shell
+ tkn task start ansible-runner \
+ --serviceaccount ansible-deployer-account \
+ --param=project-dir=kubernetes \
+ --param=args='-p create-deployment.yml' \
+ --workspace=name=runner-dir,claimName=ansible-playbooks \
+ --showlog
+```
+
+### Create Service
+
+```shell
+ tkn task start ansible-runner \
+ --serviceaccount ansible-deployer-account \
+ --param=project-dir=kubernetes \
+ --param=args='-p create-service.yml' \
+ --workspace=name=runner-dir,claimName=ansible-playbooks \
+ --showlog
+```
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/ansible-deployer.yaml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/ansible-deployer.yaml
new file mode 100644
index 0000000..83ad1c0
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/ansible-deployer.yaml
@@ -0,0 +1,36 @@
+apiVersion: v1
+kind: ServiceAccount
+metadata:
+ name: ansible-deployer-account
+ namespace: default
+---
+kind: ClusterRole
+apiVersion: rbac.authorization.k8s.io/v1
+metadata:
+ name: ansible-deployer
+rules:
+ # Core API
+ - apiGroups: ['']
+ resources: ['services', 'pods', 'deployments', 'configmaps', 'secrets']
+ verbs: ['get', 'list', 'create', 'update', 'delete', 'patch', 'watch']
+ # Apps API
+ - apiGroups: ['apps']
+ resources: ['deployments', 'daemonsets', 'jobs']
+ verbs: ['get', 'list', 'create', 'update', 'delete', 'patch', 'watch']
+ # Knative API
+ - apiGroups: ['serving.knative.dev']
+ resources: ['services', 'revisions', 'routes']
+ verbs: ['get', 'list', 'create', 'update', 'delete', 'patch', 'watch']
+---
+apiVersion: rbac.authorization.k8s.io/v1beta1
+kind: ClusterRoleBinding
+metadata:
+ name: ansible-deployer-binding
+subjects:
+ - kind: ServiceAccount
+ name: ansible-deployer-account
+ namespace: default
+roleRef:
+ kind: ClusterRole
+ name: ansible-deployer
+ apiGroup: rbac.authorization.k8s.io
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-deployment.yml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-deployment.yml
new file mode 100644
index 0000000..1ff2d33
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-deployment.yml
@@ -0,0 +1,45 @@
+- hosts: localhost
+ connection: local
+ collections:
+ - community.kubernetes
+ tasks:
+ - name: Create a new deployment
+ k8s:
+ state: present
+ resource_definition: |
+ apiVersion: apps/v1
+ kind: Deployment
+ metadata:
+ name: helloworld
+ namespace: funstuff
+ spec:
+ selector:
+ matchLabels:
+ app: helloworld
+ template:
+ metadata:
+ labels:
+ app: helloworld
+ spec:
+ containers:
+ - name: helloworld
+ image: quay.io/kameshsampath/quarkus-helloworld
+ resources:
+ limits:
+ memory: "150Mi"
+ cpu: "500m"
+ ports:
+ - containerPort: 8080
+ wait: yes
+ register: helloworld_deployment
+ - name: Get the Deployment
+ k8s_info:
+ kind: Deployment
+ namespace: funstuff
+ register: funstuff_deployments_list
+ - name: Log Deployment Details
+ debug:
+ msg: "{{ item | json_query('metadata.name') }}"
+ loop: '{{funstuff_deployments_list.resources}}'
+ loop_control:
+ label: "Deployment (Namespace: {{item | json_query('metadata.namespace')}},Replicas:{{ item | json_query('spec.replicas')}})"
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-service.yml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-service.yml
new file mode 100644
index 0000000..ad8b5ce
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-service.yml
@@ -0,0 +1,33 @@
+- hosts: localhost
+ connection: local
+ collections:
+ - community.kubernetes
+ tasks:
+ - name: Create a new Service
+ k8s:
+ state: present
+ resource_definition: |
+ apiVersion: v1
+ kind: Service
+ metadata:
+ name: helloworld
+ namespace: funstuff
+ spec:
+ selector:
+ app: helloworld
+ ports:
+ - port: 8080
+ targetPort: 8080
+ wait: yes
+ register: helloworld_svc
+ - name: Get the Service
+ k8s_info:
+ kind: Service
+ namespace: funstuff
+ register: funstuff_service_list
+ - name: Log Service Details
+ debug:
+ msg: "{{ item | json_query('metadata.name') }}"
+ loop: '{{funstuff_service_list.resources}}'
+ loop_control:
+ label: "Service (Namespace: {{item | json_query('metadata.namespace')}})"
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/kustomization.yaml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/kustomization.yaml
new file mode 100644
index 0000000..590f43e
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/kustomization.yaml
@@ -0,0 +1,13 @@
+apiVersion: kustomize.config.k8s.io/v1beta1
+kind: Kustomization
+
+namespace: demos
+
+generatorOptions:
+ disableNameSuffixHash: true
+
+commonLabels:
+ tekton.dev/task: ansible-runner
+
+resources:
+ - ansible-deployer.yaml
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/list-pods.yml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/list-pods.yml
new file mode 100644
index 0000000..b207131
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/list-pods.yml
@@ -0,0 +1,16 @@
+- hosts: localhost
+ connection: local
+ collections:
+ - kubernetes.core
+ tasks:
+ - name: List Pods in namespace
+ kubernetes.core.k8s_info:
+ kind: Pod
+ namespace: kube-system
+ register: kube_system_pods_list
+ - name: Show the list of pods
+ debug:
+ msg: "{{ item | json_query('metadata.name') }}"
+ loop: '{{kube_system_pods_list.resources}}'
+ loop_control:
+ label: "Pod(Namespace: {{item | json_query('metadata.namespace') }})"
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.txt b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.txt
new file mode 100644
index 0000000..5c2ac7b
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.txt
@@ -0,0 +1,4 @@
+kubernetes>=24.2.0
+requests-oauthlib
+jsonpatch
+jmespath
\ No newline at end of file
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.yml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.yml
new file mode 100644
index 0000000..cf4f64c
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.yml
@@ -0,0 +1,6 @@
+---
+collections:
+ - name: kubernetes.core
+ version: 2.0.1
+ - name: community.general
+ version: 10.7.0
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/playbooks-pvc.yaml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/playbooks-pvc.yaml
new file mode 100644
index 0000000..5075f19
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/playbooks-pvc.yaml
@@ -0,0 +1,11 @@
+apiVersion: v1
+kind: PersistentVolumeClaim
+metadata:
+ name: ansible-playbooks
+spec:
+ accessModes:
+ - ReadWriteOnce
+ volumeMode: Filesystem
+ resources:
+ requests:
+ storage: 1Gi |
Feature add ansible-runner v0.3
f1cea37 to
7662dc2
Compare
Diff between version 0.2 and 0.3diff --git a/task/ansible-runner/0.2/README.md b/task/ansible-runner/0.3/README.md
index 257bc2d..bf96ba0 100644
--- a/task/ansible-runner/0.2/README.md
+++ b/task/ansible-runner/0.3/README.md
@@ -9,7 +9,7 @@ The latest versions of ansible-runner requires [`community.general`](https://git
Create the Task and other resources:
```shell
-kubectl apply --filename https://api.hub.tekton.dev/v1/resource/tekton/task/ansible-runner/0.2/raw
+kubectl apply --filename https://api.hub.tekton.dev/v1/resource/tekton/task/ansible-runner/0.3/raw
```
Verify the created tasks:
@@ -23,10 +23,12 @@ tkn task ls
* **project-dir**: The ansible-runner private data dir
* **args:**: The array of arguments to pass to the runner command (_default:_ --help)
* **user-home**: Absolute path to the user's home directory. (_default:_ /tekton/home)
+* **workspaces_ssl_ca_file**: file name of ca bundle. (_default:_ ca-bundle.crt)
## Workspaces
* **runner-dir**: A [workspace](https://github.com/tektoncd/pipeline/blob/main/docs/workspaces.md) to hold the `private_data_dir` as described in https://ansible-runner.readthedocs.io/en/latest/intro.html#runner-input-directory-hierarchy[Runner Directory]
+* **ssl-ca-directory**: A optional [workspace](https://github.com/tektoncd/pipeline/blob/main/docs/workspaces.md) to hold the ca_certs for custom certificate authorities.
## Platforms
@@ -47,7 +49,7 @@ All the examples will be run in namespace called `funstuff`. Create the namespac
```shell
kubectl apply -f https://api.hub.tekton.dev/v1/resource/tekton/task/git-clone/0.5/raw \
- -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.2/support/playbooks-pvc.yaml
+ -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.3/support/playbooks-pvc.yaml
```
Do the git clone of the examples repository:
@@ -66,7 +68,7 @@ tkn task start git-clone \
As we will do get, list and create on the namespace, lets use a service account that has right RBAC:
```shell
-kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.2/support/ansible-deployer.yaml
+kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.3/support/ansible-deployer.yaml
```
### Run Tasks
diff --git a/task/ansible-runner/0.2/ansible-runner.yaml b/task/ansible-runner/0.3/ansible-runner.yaml
index d047c75..944ed05 100644
--- a/task/ansible-runner/0.2/ansible-runner.yaml
+++ b/task/ansible-runner/0.3/ansible-runner.yaml
@@ -1,14 +1,14 @@
---
-apiVersion: tekton.dev/v1beta1
+apiVersion: tekton.dev/v1
kind: Task
metadata:
name: ansible-runner
labels:
- app.kubernetes.io/version: '0.2'
- app.kubernetes.io/ansible-version: '2.12.5'
+ app.kubernetes.io/version: '0.3'
+ app.kubernetes.io/ansible-version: '2.18.2'
annotations:
- tekton.dev/deprecated: "true"
- tekton.dev/pipelines.minVersion: '0.12.1'
+ tekton.dev/deprecated: "false"
+ tekton.dev/pipelines.minVersion: '0.19.0'
tekton.dev/categories: CLI
tekton.dev/tags: cli
tekton.dev/displayName: 'Ansible Runner'
@@ -20,10 +20,16 @@ spec:
workspaces:
- name: runner-dir
description: The Ansibler runner directory
+ - name: ssl-ca-directory
+ optional: true
+ description: |
+ A Workspace containing CA certificates, this will be used by Ansible and pip to
+ verify the peer with when interacting with remote repositories using
+ HTTPS.
params:
- name: project-dir
description: The project directory under the workspace runner-dir
- default: 'project'
+ default: '.'
- name: args
description: The arguments to pass ansible-runner
type: array
@@ -34,11 +40,16 @@ spec:
default: /tekton/home
- name: image
description: Ansible runner image.
- default: quay.io/ansible/ansible-runner:stable-2.12-latest #tag: stable-2.12-latest
+ default: ghcr.io/ansible/community-ansible-dev-tools:v25.5.1 #tag: v25.5.1
+ - name: workspaces_ssl_ca_file
+ default: ""
+
stepTemplate:
env:
- name: HOME
value: $(params.user-home)
+ - name: SSL_CERT_FILE
+ value: "$(workspaces.ssl-ca-directory.path)$(params.workspaces_ssl_ca_file)"
steps:
- name: requirements
image: $(params.image)
@@ -63,9 +74,8 @@ spec:
- name: run-playbook
image: $(params.image)
- command: ['entrypoint']
+ command: ['ansible-runner']
args:
- - ansible-runner
- run
- $(params.args)
- $(params.project-dir)
diff --git a/task/ansible-runner/0.2/tests/pre-apply-task-hook.sh b/task/ansible-runner/0.3/tests/pre-apply-task-hook.sh
old mode 100755
new mode 100644
diff --git a/task/ansible-runner/0.2/tests/resources.yaml b/task/ansible-runner/0.3/tests/resources.yaml
index b8c0a41..e091721 100644
--- a/task/ansible-runner/0.2/tests/resources.yaml
+++ b/task/ansible-runner/0.3/tests/resources.yaml
@@ -14,7 +14,7 @@ apiVersion: v1
kind: ServiceAccount
metadata:
name: ansible-deployer-account
- namespace: ansible-runner-0-2
+ namespace: ansible-runner-0-3
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
@@ -41,7 +41,7 @@ metadata:
subjects:
- kind: ServiceAccount
name: ansible-deployer-account
- namespace: ansible-runner-0-2
+ namespace: ansible-runner-0-3
roleRef:
kind: ClusterRole
name: ansible-deployer
diff --git a/task/ansible-runner/0.2/tests/run.yaml b/task/ansible-runner/0.3/tests/run.yaml
index 3d5c009..b3cf74a 100644
--- a/task/ansible-runner/0.2/tests/run.yaml
+++ b/task/ansible-runner/0.3/tests/run.yaml
@@ -1,5 +1,5 @@
---
-apiVersion: tekton.dev/v1beta1
+apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: ansibler-runner-pipeline
@@ -16,9 +16,10 @@ spec:
params:
- name: url
value: |
- https://github.com/vinamra28/tektoncd-ansible-runner-example
+ https://github.com/sveno1990/catalog/
- name: revision
- value: 'master'
+ value: 'feature/ansible-runner-v0.3'
+
- name: deleteExisting
value: 'true'
# ansible-runner
@@ -32,17 +33,18 @@ spec:
workspace: runner-dir
params:
- name: project-dir
- value: 'kubernetes'
+ value: 'task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes'
- name: args
value: ['-p', 'list-pods.yml']
---
-apiVersion: tekton.dev/v1beta1
+apiVersion: tekton.dev/v1
kind: PipelineRun
metadata:
name: ansibler-runner-pipeline-run
spec:
- serviceAccountName: ansible-deployer-account
+ taskRunTemplate:
+ serviceAccountName: ansible-deployer-account
pipelineRef:
name: ansibler-runner-pipeline
workspaces:
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/README.md b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/README.md
new file mode 100644
index 0000000..63e6e35
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/README.md
@@ -0,0 +1,65 @@
+# Tektoncd Ansible Runner Examples
+
+A repo to hold Ansible runner examples for the Tektoncd Task `ansible-runner`
+
+
+## Common Tasks
+
+```shell
+kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/master/task/git-clone/0.1/git-clone.yaml
+kubectl apply -f https://raw.githubusercontent.com/tektoncd-ansible-runner-example/catalog/master/playbooks-pvc.yaml
+```
+
+## Examples
+
+Run the following Task to clone this repository
+
+```shell
+tkn task start git-clone \
+ --workspace=name=output,claimName=ansible-playbooks \
+ --param=url=https://github.com/kameshsampath/tektoncd-ansible-runner-example \
+ --param=revision=master \
+ --param=deleteExisting=true \
+ --showlog
+```
+
+### Service Account
+
+You need proper RBAC in Kubernetes to allow it to perform the example tasks:
+
+```shell
+kubectl apply -f https://raw.githubusercontent.com/tektoncd-ansible-runner-example/master/kubernetes/ansible-deployer.yaml
+```
+
+### Listing pods
+
+```shell
+ tkn task start ansible-runner \
+ --serviceaccount ansible-deployer-account \
+ --param=project-dir=kubernetes \
+ --param=args='-p list-pods.yml' \
+ --workspace=name=runner-dir,claimName=ansible-playbooks \
+ --showlog
+```
+
+### Create Deployment
+
+```shell
+ tkn task start ansible-runner \
+ --serviceaccount ansible-deployer-account \
+ --param=project-dir=kubernetes \
+ --param=args='-p create-deployment.yml' \
+ --workspace=name=runner-dir,claimName=ansible-playbooks \
+ --showlog
+```
+
+### Create Service
+
+```shell
+ tkn task start ansible-runner \
+ --serviceaccount ansible-deployer-account \
+ --param=project-dir=kubernetes \
+ --param=args='-p create-service.yml' \
+ --workspace=name=runner-dir,claimName=ansible-playbooks \
+ --showlog
+```
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/ansible-deployer.yaml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/ansible-deployer.yaml
new file mode 100644
index 0000000..83ad1c0
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/ansible-deployer.yaml
@@ -0,0 +1,36 @@
+apiVersion: v1
+kind: ServiceAccount
+metadata:
+ name: ansible-deployer-account
+ namespace: default
+---
+kind: ClusterRole
+apiVersion: rbac.authorization.k8s.io/v1
+metadata:
+ name: ansible-deployer
+rules:
+ # Core API
+ - apiGroups: ['']
+ resources: ['services', 'pods', 'deployments', 'configmaps', 'secrets']
+ verbs: ['get', 'list', 'create', 'update', 'delete', 'patch', 'watch']
+ # Apps API
+ - apiGroups: ['apps']
+ resources: ['deployments', 'daemonsets', 'jobs']
+ verbs: ['get', 'list', 'create', 'update', 'delete', 'patch', 'watch']
+ # Knative API
+ - apiGroups: ['serving.knative.dev']
+ resources: ['services', 'revisions', 'routes']
+ verbs: ['get', 'list', 'create', 'update', 'delete', 'patch', 'watch']
+---
+apiVersion: rbac.authorization.k8s.io/v1beta1
+kind: ClusterRoleBinding
+metadata:
+ name: ansible-deployer-binding
+subjects:
+ - kind: ServiceAccount
+ name: ansible-deployer-account
+ namespace: default
+roleRef:
+ kind: ClusterRole
+ name: ansible-deployer
+ apiGroup: rbac.authorization.k8s.io
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-deployment.yml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-deployment.yml
new file mode 100644
index 0000000..1ff2d33
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-deployment.yml
@@ -0,0 +1,45 @@
+- hosts: localhost
+ connection: local
+ collections:
+ - community.kubernetes
+ tasks:
+ - name: Create a new deployment
+ k8s:
+ state: present
+ resource_definition: |
+ apiVersion: apps/v1
+ kind: Deployment
+ metadata:
+ name: helloworld
+ namespace: funstuff
+ spec:
+ selector:
+ matchLabels:
+ app: helloworld
+ template:
+ metadata:
+ labels:
+ app: helloworld
+ spec:
+ containers:
+ - name: helloworld
+ image: quay.io/kameshsampath/quarkus-helloworld
+ resources:
+ limits:
+ memory: "150Mi"
+ cpu: "500m"
+ ports:
+ - containerPort: 8080
+ wait: yes
+ register: helloworld_deployment
+ - name: Get the Deployment
+ k8s_info:
+ kind: Deployment
+ namespace: funstuff
+ register: funstuff_deployments_list
+ - name: Log Deployment Details
+ debug:
+ msg: "{{ item | json_query('metadata.name') }}"
+ loop: '{{funstuff_deployments_list.resources}}'
+ loop_control:
+ label: "Deployment (Namespace: {{item | json_query('metadata.namespace')}},Replicas:{{ item | json_query('spec.replicas')}})"
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-service.yml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-service.yml
new file mode 100644
index 0000000..ad8b5ce
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-service.yml
@@ -0,0 +1,33 @@
+- hosts: localhost
+ connection: local
+ collections:
+ - community.kubernetes
+ tasks:
+ - name: Create a new Service
+ k8s:
+ state: present
+ resource_definition: |
+ apiVersion: v1
+ kind: Service
+ metadata:
+ name: helloworld
+ namespace: funstuff
+ spec:
+ selector:
+ app: helloworld
+ ports:
+ - port: 8080
+ targetPort: 8080
+ wait: yes
+ register: helloworld_svc
+ - name: Get the Service
+ k8s_info:
+ kind: Service
+ namespace: funstuff
+ register: funstuff_service_list
+ - name: Log Service Details
+ debug:
+ msg: "{{ item | json_query('metadata.name') }}"
+ loop: '{{funstuff_service_list.resources}}'
+ loop_control:
+ label: "Service (Namespace: {{item | json_query('metadata.namespace')}})"
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/kustomization.yaml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/kustomization.yaml
new file mode 100644
index 0000000..590f43e
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/kustomization.yaml
@@ -0,0 +1,13 @@
+apiVersion: kustomize.config.k8s.io/v1beta1
+kind: Kustomization
+
+namespace: demos
+
+generatorOptions:
+ disableNameSuffixHash: true
+
+commonLabels:
+ tekton.dev/task: ansible-runner
+
+resources:
+ - ansible-deployer.yaml
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/list-pods.yml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/list-pods.yml
new file mode 100644
index 0000000..b207131
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/list-pods.yml
@@ -0,0 +1,16 @@
+- hosts: localhost
+ connection: local
+ collections:
+ - kubernetes.core
+ tasks:
+ - name: List Pods in namespace
+ kubernetes.core.k8s_info:
+ kind: Pod
+ namespace: kube-system
+ register: kube_system_pods_list
+ - name: Show the list of pods
+ debug:
+ msg: "{{ item | json_query('metadata.name') }}"
+ loop: '{{kube_system_pods_list.resources}}'
+ loop_control:
+ label: "Pod(Namespace: {{item | json_query('metadata.namespace') }})"
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.txt b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.txt
new file mode 100644
index 0000000..5c2ac7b
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.txt
@@ -0,0 +1,4 @@
+kubernetes>=24.2.0
+requests-oauthlib
+jsonpatch
+jmespath
\ No newline at end of file
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.yml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.yml
new file mode 100644
index 0000000..cf4f64c
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.yml
@@ -0,0 +1,6 @@
+---
+collections:
+ - name: kubernetes.core
+ version: 2.0.1
+ - name: community.general
+ version: 10.7.0
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/playbooks-pvc.yaml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/playbooks-pvc.yaml
new file mode 100644
index 0000000..5075f19
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/playbooks-pvc.yaml
@@ -0,0 +1,11 @@
+apiVersion: v1
+kind: PersistentVolumeClaim
+metadata:
+ name: ansible-playbooks
+spec:
+ accessModes:
+ - ReadWriteOnce
+ volumeMode: Filesystem
+ resources:
+ requests:
+ storage: 1Gi |
|
@vinamra28 I made quite some changes, but it should now be working. I had to move the tests to my personal repository because that is where the branch lives. After the merge we could change it to the correct tektoncd repo. Or do you perhaps have another (less dirty) idea. Could you (re)do the review? |
Co-authored-by: Vinamra Jain <vinjain@redhat.com>
Diff between version 0.2 and 0.3diff --git a/task/ansible-runner/0.2/README.md b/task/ansible-runner/0.3/README.md
index 257bc2d..bf96ba0 100644
--- a/task/ansible-runner/0.2/README.md
+++ b/task/ansible-runner/0.3/README.md
@@ -9,7 +9,7 @@ The latest versions of ansible-runner requires [`community.general`](https://git
Create the Task and other resources:
```shell
-kubectl apply --filename https://api.hub.tekton.dev/v1/resource/tekton/task/ansible-runner/0.2/raw
+kubectl apply --filename https://api.hub.tekton.dev/v1/resource/tekton/task/ansible-runner/0.3/raw
```
Verify the created tasks:
@@ -23,10 +23,12 @@ tkn task ls
* **project-dir**: The ansible-runner private data dir
* **args:**: The array of arguments to pass to the runner command (_default:_ --help)
* **user-home**: Absolute path to the user's home directory. (_default:_ /tekton/home)
+* **workspaces_ssl_ca_file**: file name of ca bundle. (_default:_ ca-bundle.crt)
## Workspaces
* **runner-dir**: A [workspace](https://github.com/tektoncd/pipeline/blob/main/docs/workspaces.md) to hold the `private_data_dir` as described in https://ansible-runner.readthedocs.io/en/latest/intro.html#runner-input-directory-hierarchy[Runner Directory]
+* **ssl-ca-directory**: A optional [workspace](https://github.com/tektoncd/pipeline/blob/main/docs/workspaces.md) to hold the ca_certs for custom certificate authorities.
## Platforms
@@ -47,7 +49,7 @@ All the examples will be run in namespace called `funstuff`. Create the namespac
```shell
kubectl apply -f https://api.hub.tekton.dev/v1/resource/tekton/task/git-clone/0.5/raw \
- -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.2/support/playbooks-pvc.yaml
+ -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.3/support/playbooks-pvc.yaml
```
Do the git clone of the examples repository:
@@ -66,7 +68,7 @@ tkn task start git-clone \
As we will do get, list and create on the namespace, lets use a service account that has right RBAC:
```shell
-kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.2/support/ansible-deployer.yaml
+kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ansible-runner/0.3/support/ansible-deployer.yaml
```
### Run Tasks
diff --git a/task/ansible-runner/0.2/ansible-runner.yaml b/task/ansible-runner/0.3/ansible-runner.yaml
index d047c75..c82ad62 100644
--- a/task/ansible-runner/0.2/ansible-runner.yaml
+++ b/task/ansible-runner/0.3/ansible-runner.yaml
@@ -1,14 +1,14 @@
---
-apiVersion: tekton.dev/v1beta1
+apiVersion: tekton.dev/v1
kind: Task
metadata:
name: ansible-runner
labels:
- app.kubernetes.io/version: '0.2'
- app.kubernetes.io/ansible-version: '2.12.5'
+ app.kubernetes.io/version: '0.3'
+ app.kubernetes.io/ansible-version: '2.18.2'
annotations:
- tekton.dev/deprecated: "true"
- tekton.dev/pipelines.minVersion: '0.12.1'
+ tekton.dev/deprecated: "false"
+ tekton.dev/pipelines.minVersion: '1.0.0'
tekton.dev/categories: CLI
tekton.dev/tags: cli
tekton.dev/displayName: 'Ansible Runner'
@@ -20,10 +20,16 @@ spec:
workspaces:
- name: runner-dir
description: The Ansibler runner directory
+ - name: ssl-ca-directory
+ optional: true
+ description: |
+ A Workspace containing CA certificates, this will be used by Ansible and pip to
+ verify the peer with when interacting with remote repositories using
+ HTTPS.
params:
- name: project-dir
description: The project directory under the workspace runner-dir
- default: 'project'
+ default: '.'
- name: args
description: The arguments to pass ansible-runner
type: array
@@ -34,11 +40,16 @@ spec:
default: /tekton/home
- name: image
description: Ansible runner image.
- default: quay.io/ansible/ansible-runner:stable-2.12-latest #tag: stable-2.12-latest
+ default: ghcr.io/ansible/community-ansible-dev-tools:v25.5.1 #tag: v25.5.1
+ - name: workspaces_ssl_ca_file
+ default: ""
+
stepTemplate:
env:
- name: HOME
value: $(params.user-home)
+ - name: SSL_CERT_FILE
+ value: "$(workspaces.ssl-ca-directory.path)$(params.workspaces_ssl_ca_file)"
steps:
- name: requirements
image: $(params.image)
@@ -63,9 +74,8 @@ spec:
- name: run-playbook
image: $(params.image)
- command: ['entrypoint']
+ command: ['ansible-runner']
args:
- - ansible-runner
- run
- $(params.args)
- $(params.project-dir)
diff --git a/task/ansible-runner/0.2/tests/pre-apply-task-hook.sh b/task/ansible-runner/0.3/tests/pre-apply-task-hook.sh
old mode 100755
new mode 100644
diff --git a/task/ansible-runner/0.2/tests/resources.yaml b/task/ansible-runner/0.3/tests/resources.yaml
index b8c0a41..e091721 100644
--- a/task/ansible-runner/0.2/tests/resources.yaml
+++ b/task/ansible-runner/0.3/tests/resources.yaml
@@ -14,7 +14,7 @@ apiVersion: v1
kind: ServiceAccount
metadata:
name: ansible-deployer-account
- namespace: ansible-runner-0-2
+ namespace: ansible-runner-0-3
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
@@ -41,7 +41,7 @@ metadata:
subjects:
- kind: ServiceAccount
name: ansible-deployer-account
- namespace: ansible-runner-0-2
+ namespace: ansible-runner-0-3
roleRef:
kind: ClusterRole
name: ansible-deployer
diff --git a/task/ansible-runner/0.2/tests/run.yaml b/task/ansible-runner/0.3/tests/run.yaml
index 3d5c009..b3cf74a 100644
--- a/task/ansible-runner/0.2/tests/run.yaml
+++ b/task/ansible-runner/0.3/tests/run.yaml
@@ -1,5 +1,5 @@
---
-apiVersion: tekton.dev/v1beta1
+apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: ansibler-runner-pipeline
@@ -16,9 +16,10 @@ spec:
params:
- name: url
value: |
- https://github.com/vinamra28/tektoncd-ansible-runner-example
+ https://github.com/sveno1990/catalog/
- name: revision
- value: 'master'
+ value: 'feature/ansible-runner-v0.3'
+
- name: deleteExisting
value: 'true'
# ansible-runner
@@ -32,17 +33,18 @@ spec:
workspace: runner-dir
params:
- name: project-dir
- value: 'kubernetes'
+ value: 'task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes'
- name: args
value: ['-p', 'list-pods.yml']
---
-apiVersion: tekton.dev/v1beta1
+apiVersion: tekton.dev/v1
kind: PipelineRun
metadata:
name: ansibler-runner-pipeline-run
spec:
- serviceAccountName: ansible-deployer-account
+ taskRunTemplate:
+ serviceAccountName: ansible-deployer-account
pipelineRef:
name: ansibler-runner-pipeline
workspaces:
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/README.md b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/README.md
new file mode 100644
index 0000000..63e6e35
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/README.md
@@ -0,0 +1,65 @@
+# Tektoncd Ansible Runner Examples
+
+A repo to hold Ansible runner examples for the Tektoncd Task `ansible-runner`
+
+
+## Common Tasks
+
+```shell
+kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/master/task/git-clone/0.1/git-clone.yaml
+kubectl apply -f https://raw.githubusercontent.com/tektoncd-ansible-runner-example/catalog/master/playbooks-pvc.yaml
+```
+
+## Examples
+
+Run the following Task to clone this repository
+
+```shell
+tkn task start git-clone \
+ --workspace=name=output,claimName=ansible-playbooks \
+ --param=url=https://github.com/kameshsampath/tektoncd-ansible-runner-example \
+ --param=revision=master \
+ --param=deleteExisting=true \
+ --showlog
+```
+
+### Service Account
+
+You need proper RBAC in Kubernetes to allow it to perform the example tasks:
+
+```shell
+kubectl apply -f https://raw.githubusercontent.com/tektoncd-ansible-runner-example/master/kubernetes/ansible-deployer.yaml
+```
+
+### Listing pods
+
+```shell
+ tkn task start ansible-runner \
+ --serviceaccount ansible-deployer-account \
+ --param=project-dir=kubernetes \
+ --param=args='-p list-pods.yml' \
+ --workspace=name=runner-dir,claimName=ansible-playbooks \
+ --showlog
+```
+
+### Create Deployment
+
+```shell
+ tkn task start ansible-runner \
+ --serviceaccount ansible-deployer-account \
+ --param=project-dir=kubernetes \
+ --param=args='-p create-deployment.yml' \
+ --workspace=name=runner-dir,claimName=ansible-playbooks \
+ --showlog
+```
+
+### Create Service
+
+```shell
+ tkn task start ansible-runner \
+ --serviceaccount ansible-deployer-account \
+ --param=project-dir=kubernetes \
+ --param=args='-p create-service.yml' \
+ --workspace=name=runner-dir,claimName=ansible-playbooks \
+ --showlog
+```
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/ansible-deployer.yaml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/ansible-deployer.yaml
new file mode 100644
index 0000000..83ad1c0
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/ansible-deployer.yaml
@@ -0,0 +1,36 @@
+apiVersion: v1
+kind: ServiceAccount
+metadata:
+ name: ansible-deployer-account
+ namespace: default
+---
+kind: ClusterRole
+apiVersion: rbac.authorization.k8s.io/v1
+metadata:
+ name: ansible-deployer
+rules:
+ # Core API
+ - apiGroups: ['']
+ resources: ['services', 'pods', 'deployments', 'configmaps', 'secrets']
+ verbs: ['get', 'list', 'create', 'update', 'delete', 'patch', 'watch']
+ # Apps API
+ - apiGroups: ['apps']
+ resources: ['deployments', 'daemonsets', 'jobs']
+ verbs: ['get', 'list', 'create', 'update', 'delete', 'patch', 'watch']
+ # Knative API
+ - apiGroups: ['serving.knative.dev']
+ resources: ['services', 'revisions', 'routes']
+ verbs: ['get', 'list', 'create', 'update', 'delete', 'patch', 'watch']
+---
+apiVersion: rbac.authorization.k8s.io/v1beta1
+kind: ClusterRoleBinding
+metadata:
+ name: ansible-deployer-binding
+subjects:
+ - kind: ServiceAccount
+ name: ansible-deployer-account
+ namespace: default
+roleRef:
+ kind: ClusterRole
+ name: ansible-deployer
+ apiGroup: rbac.authorization.k8s.io
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-deployment.yml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-deployment.yml
new file mode 100644
index 0000000..1ff2d33
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-deployment.yml
@@ -0,0 +1,45 @@
+- hosts: localhost
+ connection: local
+ collections:
+ - community.kubernetes
+ tasks:
+ - name: Create a new deployment
+ k8s:
+ state: present
+ resource_definition: |
+ apiVersion: apps/v1
+ kind: Deployment
+ metadata:
+ name: helloworld
+ namespace: funstuff
+ spec:
+ selector:
+ matchLabels:
+ app: helloworld
+ template:
+ metadata:
+ labels:
+ app: helloworld
+ spec:
+ containers:
+ - name: helloworld
+ image: quay.io/kameshsampath/quarkus-helloworld
+ resources:
+ limits:
+ memory: "150Mi"
+ cpu: "500m"
+ ports:
+ - containerPort: 8080
+ wait: yes
+ register: helloworld_deployment
+ - name: Get the Deployment
+ k8s_info:
+ kind: Deployment
+ namespace: funstuff
+ register: funstuff_deployments_list
+ - name: Log Deployment Details
+ debug:
+ msg: "{{ item | json_query('metadata.name') }}"
+ loop: '{{funstuff_deployments_list.resources}}'
+ loop_control:
+ label: "Deployment (Namespace: {{item | json_query('metadata.namespace')}},Replicas:{{ item | json_query('spec.replicas')}})"
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-service.yml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-service.yml
new file mode 100644
index 0000000..ad8b5ce
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/create-service.yml
@@ -0,0 +1,33 @@
+- hosts: localhost
+ connection: local
+ collections:
+ - community.kubernetes
+ tasks:
+ - name: Create a new Service
+ k8s:
+ state: present
+ resource_definition: |
+ apiVersion: v1
+ kind: Service
+ metadata:
+ name: helloworld
+ namespace: funstuff
+ spec:
+ selector:
+ app: helloworld
+ ports:
+ - port: 8080
+ targetPort: 8080
+ wait: yes
+ register: helloworld_svc
+ - name: Get the Service
+ k8s_info:
+ kind: Service
+ namespace: funstuff
+ register: funstuff_service_list
+ - name: Log Service Details
+ debug:
+ msg: "{{ item | json_query('metadata.name') }}"
+ loop: '{{funstuff_service_list.resources}}'
+ loop_control:
+ label: "Service (Namespace: {{item | json_query('metadata.namespace')}})"
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/kustomization.yaml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/kustomization.yaml
new file mode 100644
index 0000000..590f43e
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/kustomization.yaml
@@ -0,0 +1,13 @@
+apiVersion: kustomize.config.k8s.io/v1beta1
+kind: Kustomization
+
+namespace: demos
+
+generatorOptions:
+ disableNameSuffixHash: true
+
+commonLabels:
+ tekton.dev/task: ansible-runner
+
+resources:
+ - ansible-deployer.yaml
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/list-pods.yml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/list-pods.yml
new file mode 100644
index 0000000..b207131
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/list-pods.yml
@@ -0,0 +1,16 @@
+- hosts: localhost
+ connection: local
+ collections:
+ - kubernetes.core
+ tasks:
+ - name: List Pods in namespace
+ kubernetes.core.k8s_info:
+ kind: Pod
+ namespace: kube-system
+ register: kube_system_pods_list
+ - name: Show the list of pods
+ debug:
+ msg: "{{ item | json_query('metadata.name') }}"
+ loop: '{{kube_system_pods_list.resources}}'
+ loop_control:
+ label: "Pod(Namespace: {{item | json_query('metadata.namespace') }})"
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.txt b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.txt
new file mode 100644
index 0000000..5c2ac7b
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.txt
@@ -0,0 +1,4 @@
+kubernetes>=24.2.0
+requests-oauthlib
+jsonpatch
+jmespath
\ No newline at end of file
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.yml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.yml
new file mode 100644
index 0000000..cf4f64c
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/kubernetes/requirements.yml
@@ -0,0 +1,6 @@
+---
+collections:
+ - name: kubernetes.core
+ version: 2.0.1
+ - name: community.general
+ version: 10.7.0
diff --git a/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/playbooks-pvc.yaml b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/playbooks-pvc.yaml
new file mode 100644
index 0000000..5075f19
--- /dev/null
+++ b/task/ansible-runner/0.3/tests/tektoncd-ansible-runner-example/playbooks-pvc.yaml
@@ -0,0 +1,11 @@
+apiVersion: v1
+kind: PersistentVolumeClaim
+metadata:
+ name: ansible-playbooks
+spec:
+ accessModes:
+ - ReadWriteOnce
+ volumeMode: Filesystem
+ resources:
+ requests:
+ storage: 1Gi |
|
/retest |
1 similar comment
|
/retest |
|
@sveno1990: The following test failed, say
Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
Feature add ansible-runner v0.3
Changes
Introduced the ansible-runner v0.3 task based on a different image (community maintained https://github.com/ansible/ansible-dev-tools) and introduced option of custom ca bundle.
Submitter Checklist
These are the criteria that every PR should meet, please check them off as you
review them:
contains
/kind <type>. Valid types are bug, cleanup, design, documentation,feature, flake, misc, question, tep
File path follows
<kind>/<name>/<version>/name.yamlHas
README.mdat<kind>/<name>/<version>/README.mdHas mandatory
metadata.labels-app.kubernetes.io/versionthe same as the<version>of the resourceHas mandatory
metadata.annotationstekton.dev/pipelines.minVersionmandatory
spec.descriptionfollows the conventionSee the contribution guide for more details.