diff --git a/roles/bastion-ssh-config/tasks/main.yml b/roles/bastion-ssh-config/tasks/main.yml index 7ea39bbd8cd62197ce82a187aeb5ba1e7c03eae5..cf558087cd6de90d9e61b72d4aa48c8eb7a506e4 100644 --- a/roles/bastion-ssh-config/tasks/main.yml +++ b/roles/bastion-ssh-config/tasks/main.yml @@ -3,6 +3,7 @@ set_fact: bastion_ip: "{{ hostvars[groups['bastion'][0]]['ansible_host'] | d(hostvars[groups['bastion'][0]]['ansible_ssh_host']) }}" delegate_to: localhost + connection: local # As we are actually running on localhost, the ansible_ssh_user is your local user when you try to use it directly # To figure out the real ssh user, we delegate this task to the bastion and store the ansible_user in real_user @@ -13,6 +14,7 @@ - name: create ssh bastion conf become: false delegate_to: localhost + connection: local template: src: ssh-bastion.conf dest: "{{ playbook_dir }}/ssh-bastion.conf" diff --git a/roles/download/tasks/download_container.yml b/roles/download/tasks/download_container.yml index fbf0831d2917d122c1e0f36ad91d30e2e110ca51..234bf1f955708bd8b3c94e6464e4a3ec7e5a8323 100644 --- a/roles/download/tasks/download_container.yml +++ b/roles/download/tasks/download_container.yml @@ -25,6 +25,7 @@ stat: path: "{{ image_path_cached }}" delegate_to: localhost + connection: local delegate_facts: no register: cache_image changed_when: false diff --git a/roles/download/tasks/download_file.yml b/roles/download/tasks/download_file.yml index 86727dafc320b5e2186863f0cad0403b4485408b..648f4335387eb331409745d1e447e559c9f11321 100644 --- a/roles/download/tasks/download_file.yml +++ b/roles/download/tasks/download_file.yml @@ -25,6 +25,7 @@ state: directory recurse: yes delegate_to: localhost + connection: local delegate_facts: false run_once: true become: false diff --git a/roles/download/tasks/prep_download.yml b/roles/download/tasks/prep_download.yml index 34bcaa2b90f18efc18219a5b706409b1b5cc7042..8e1d131ca5bc99b363995a35ae0950ba57073a1a 100644 --- a/roles/download/tasks/prep_download.yml +++ b/roles/download/tasks/prep_download.yml @@ -20,6 +20,7 @@ - name: prep_download | On localhost, check if passwordless root is possible command: "true" delegate_to: localhost + connection: local run_once: true register: test_become changed_when: false @@ -34,6 +35,7 @@ - name: prep_download | On localhost, check if user has access to docker without using sudo shell: "{{ image_info_command_on_localhost }}" delegate_to: localhost + connection: local run_once: true register: test_docker changed_when: false @@ -92,6 +94,7 @@ recurse: yes mode: 0755 delegate_to: localhost + connection: local delegate_facts: no run_once: true become: false diff --git a/roles/kubernetes/client/tasks/main.yml b/roles/kubernetes/client/tasks/main.yml index 6634154757a52a63546cefb2d1c2337eaa35fd3e..bbb1ce0e029532b4e0566501c00b8469db344b38 100644 --- a/roles/kubernetes/client/tasks/main.yml +++ b/roles/kubernetes/client/tasks/main.yml @@ -36,6 +36,7 @@ mode: "0750" state: directory delegate_to: localhost + connection: local become: no run_once: yes when: kubeconfig_localhost @@ -88,6 +89,7 @@ dest: "{{ artifacts_dir }}/admin.conf" mode: 0640 delegate_to: localhost + connection: local become: no run_once: yes when: kubeconfig_localhost @@ -112,4 +114,5 @@ become: no run_once: yes delegate_to: localhost + connection: local when: kubectl_localhost and kubeconfig_localhost diff --git a/roles/kubernetes/preinstall/tasks/0030-pre_upgrade.yml b/roles/kubernetes/preinstall/tasks/0030-pre_upgrade.yml index 9bace42dc6cfe44d57b59e109d218cf53ea01f77..62a863808b3ad709a7118fd70986f04d0627cd71 100644 --- a/roles/kubernetes/preinstall/tasks/0030-pre_upgrade.yml +++ b/roles/kubernetes/preinstall/tasks/0030-pre_upgrade.yml @@ -3,6 +3,7 @@ stat: path: "{{ inventory_dir }}/../credentials" delegate_to: localhost + connection: local register: old_credential_dir become: no @@ -10,6 +11,7 @@ stat: path: "{{ inventory_dir }}/credentials" delegate_to: localhost + connection: local register: new_credential_dir become: no when: old_credential_dir.stat.exists @@ -19,6 +21,7 @@ args: creates: "{{ inventory_dir }}/credentials" delegate_to: localhost + connection: local become: no when: - old_credential_dir.stat.exists diff --git a/roles/kubernetes/preinstall/tasks/0090-etchosts.yml b/roles/kubernetes/preinstall/tasks/0090-etchosts.yml index 9edab21f5ca6d9ab5aaa0b2d0e4c3ffda77887bc..5b34d2d7524b2894ef0d3f660015d2b4d226d03d 100644 --- a/roles/kubernetes/preinstall/tasks/0090-etchosts.yml +++ b/roles/kubernetes/preinstall/tasks/0090-etchosts.yml @@ -9,6 +9,7 @@ {% endif %} {% endfor %} delegate_to: localhost + connection: local delegate_facts: yes run_once: yes diff --git a/roles/kubespray-defaults/tasks/fallback_ips.yml b/roles/kubespray-defaults/tasks/fallback_ips.yml index 930885a6ad227e4f96b3519299ebb83c9ed2b584..ad8523db89b4dd509484170077acb321f97196b6 100644 --- a/roles/kubespray-defaults/tasks/fallback_ips.yml +++ b/roles/kubespray-defaults/tasks/fallback_ips.yml @@ -21,6 +21,7 @@ {{ item }}: "{{ found.get('address', '127.0.0.1') }}" {% endfor %} delegate_to: localhost + connection: local delegate_facts: yes become: no run_once: yes diff --git a/roles/kubespray-defaults/tasks/fallback_ips_gather.yml b/roles/kubespray-defaults/tasks/fallback_ips_gather.yml index c5f5b74276f453d1dd0677a26e1e527886b9208a..2d2d000d6258914a7fe9480ac8225abb3e7d2b19 100644 --- a/roles/kubespray-defaults/tasks/fallback_ips_gather.yml +++ b/roles/kubespray-defaults/tasks/fallback_ips_gather.yml @@ -7,4 +7,5 @@ gather_subset: '!all,network' filter: "ansible_default_ipv4" delegate_to: "{{ delegate_host_to_gather_facts }}" + connection: "{{ (delegate_host_to_gather_facts == 'localhost') | ternary('local', omit) }}" delegate_facts: yes diff --git a/roles/kubespray-defaults/tasks/no_proxy.yml b/roles/kubespray-defaults/tasks/no_proxy.yml index 82613882d5548a2a5aa6a2311fca0e37b31ac929..01c6e9ddf2e1e318993402293202d83b54fd9f6e 100644 --- a/roles/kubespray-defaults/tasks/no_proxy.yml +++ b/roles/kubespray-defaults/tasks/no_proxy.yml @@ -19,6 +19,7 @@ {%- endif -%} 127.0.0.1,localhost,{{ kube_service_addresses }},{{ kube_pods_subnet }} delegate_to: localhost + connection: local delegate_facts: yes become: no run_once: yes diff --git a/scripts/collect-info.yaml b/scripts/collect-info.yaml index 15f1c627fef701e1571ac2d034b05dd3b8819e7b..4c203648e39dab49edca64602337b28943984e70 100644 --- a/scripts/collect-info.yaml +++ b/scripts/collect-info.yaml @@ -133,6 +133,7 @@ dest: "{{ dir|default('.') }}/logs.tar.gz" remove: true delegate_to: localhost + connection: local become: false run_once: true diff --git a/tests/cloud_playbooks/delete-aws.yml b/tests/cloud_playbooks/delete-aws.yml index bffb8c60fa57d56a4e9f783dcbc21eb366882508..b72caf0ee75c045aa493cf99797ced272b33d4ef 100644 --- a/tests/cloud_playbooks/delete-aws.yml +++ b/tests/cloud_playbooks/delete-aws.yml @@ -15,3 +15,4 @@ region: "{{ ansible_ec2_placement_region }}" wait: True delegate_to: localhost + connection: local