Ansible Kubernetes
约 1 分钟阅读
ansible-galaxy collection install community.kubernetes- name: kubectl
hosts: localhost
gather_facts: false
tasks:
- add_host:
name: nextcloud
ansible_connection: kubectl
ansible_kubectl_context: default
ansible_kubectl_namespace: default
ansible_kubectl_pod: nextcloud-74fc895c6f-hxrq6
groupname: pods
- hosts: pods
gather_facts: false
tasks:
- raw: pwd
register: raw_result
- debug:
msg: '{{raw_result.stdout_lines[0]}}'- name: kubectl
hosts: localhost
gather_facts: false
connection: local
collections:
- community.kubernetes
tasks:
- k8s_exec:
namespace: incos
pod: nextcloud-74fc7f5c6f-hxrq6
command: pwd
register: raw_result
- debug:
msg: '{{raw_result.stdout_lines[0]}}'关联信息
反向链接、本文链接的其他页面和外部资料。
参考资料
GitHub1 条
- ansible-collections/community.kubernetesgithub.com/ansible-collections/community.kubernetes