k8s运维内功 – kubespray源码详解(十一)
以下部分内容为以debug方式逐个调用ansible任务时通过AIAnsible时生成,
AIAnsible的仓库地址为: https://github.com/sunnycloudy/aiansible
<STEP: 301>
/root/.nujnus/test_suite/K8s_v2_22_2/install_k8s_v2_22_2/install/kubespray/roles/download/tasks/check_pull_required.yml #4
[代码和注释:]
4|- name: check_pull_required | Generate a list of information about the images on a node # noqa 305 image_info_command contains a pipe, therefore requiring shell
5| shell: "{
{ image_info_command }}" # 执行shell命令,获取节点上镜像的列表信息
6| register: docker_images # 将命令执行结果注册到变量docker_images中
7| changed_when: false # 即使命令执行了,也不标记任务状态为changed
8| check_mode: no # 在检查模式下不执行此任务
9| when: not download_always_pull # 当download_always_pull变量为False时执行此任务
[参数:]
_raw_params: /usr/local/bin/nerdctl -n k8s.io images --format '{
{ .Repository }}:{
{ .Tag }}' 2>/dev/null | grep