Skip to content

Commit

Permalink
simplyfy example by removing changed_when: false
Browse files Browse the repository at this point in the history
it is recomendation by @felixfontein to avoid changed_when: false as it may confuse users and they mayht assume that you have to use that parameter

most probably no-changed-when linter rule was enforced with ansible-lint v24.6.0 released yesterday https://github.com/ansible/ansible-lint/releases/tag/v24.6.0
  • Loading branch information
yurnov committed Jun 5, 2024
1 parent 03be82d commit d87f4bd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
9 changes: 3 additions & 6 deletions docs/kubernetes.core.kubectl_connection.rst
Original file line number Diff line number Diff line change
Expand Up @@ -382,8 +382,7 @@ Examples
# be aware that the command is executed as the user that started the container
# and requires python to be installed in the image
- name: Run a command in a pod
ansible.builtin.command: echo "Hello, World!"
changed_when: false
ansible.builtin.command: /run/some/script.sh
- name: Run a command in a pod using local kubectl with inventory variables
# Example inventory:
Expand All @@ -407,8 +406,7 @@ Examples
# be aware that the command is executed as the user that started the container
# and requires python to be installed in the image
- name: Run a command in a pod
ansible.builtin.command: echo "Hello, World!"
changed_when: false
ansible.builtin.command: /run/some/script.sh
- name: Run a command in a pod using dynamic inventory
hosts: localhost
Expand Down Expand Up @@ -441,9 +439,8 @@ Examples
- name: Run a command in My App pod
# be aware that the command is executed as the user that started the container
# and requires python to be installed in the image
ansible.builtin.command: echo "Hello, World!"
ansible.builtin.command: /run/some/script.sh
delegate_to: "{{ my_app_pod_name }}"
changed_when: false
Expand Down
9 changes: 3 additions & 6 deletions plugins/connection/kubectl.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,7 @@
# be aware that the command is executed as the user that started the container
# and requires python to be installed in the image
- name: Run a command in a pod
ansible.builtin.command: echo "Hello, World!"
changed_when: false
ansible.builtin.command: /run/some/script.sh
- name: Run a command in a pod using local kubectl with inventory variables
# Example inventory:
Expand All @@ -220,8 +219,7 @@
# be aware that the command is executed as the user that started the container
# and requires python to be installed in the image
- name: Run a command in a pod
ansible.builtin.command: echo "Hello, World!"
changed_when: false
ansible.builtin.command: /run/some/script.sh
- name: Run a command in a pod using dynamic inventory
hosts: localhost
Expand Down Expand Up @@ -254,9 +252,8 @@
- name: Run a command in My App pod
# be aware that the command is executed as the user that started the container
# and requires python to be installed in the image
ansible.builtin.command: echo "Hello, World!"
ansible.builtin.command: /run/some/script.sh
delegate_to: "{{ my_app_pod_name }}"
changed_when: false
"""

import json
Expand Down

0 comments on commit d87f4bd

Please sign in to comment.