Skip confirmation in Ansible during deleting node with Kubspray

545 Views Asked by At

I'm trying to run Ansible playbook remove-node.yml from Kubespray repository. But when I run a job I get an error:

TASK [check confirmation] ******************************************************
fatal: [node61]: FAILED! => {"changed": false, "msg": "Delete nodes confirmation failed"}

I'm doing it through GitLabCI and here is my .gitlab-ci.yml:

stages:
  - deploy

image: ***/releases/kubespray:v2.12.5

variables:
  ANSIBLE_HOST_KEY_CHECKING: "False"

before_script:
    - mkdir -p ~/.ssh
    - echo "$id_rsa" | base64 -d > ~/.ssh/id_rsa
    - chmod -R 700 ~/.ssh

delete_node:
  stage: deploy
  when: manual
  script:
    - ansible-playbook -v -u root --key-file=~/.ssh/id_rsa --extra-vars skip_confirmation=yes -i inventory/hosts.ini /kubespray/remove-node.yml -e "node=node61"  

I've tried check_confirmation, skip_confirmation=true, True or 'true' and other variations, but none of them works

2

There are 2 best solutions below

1
vehbi yusuf can On

Can you run your script like this?

ansible-playbook -v -u root --key-file=~/.ssh/id_rsa -i inventory/hosts.ini /kubespray/remove-node.yml --extra-var "node=node61 skip_confirmation=true"
0
RedBluff On

The required variable is delete_nodes_confirmation not skip_confirmation.
So the answer is delete_nodes_confirmation=yes.