mirror of https://github.com/ansible/ansible.git
connection plugins: try config, then play_context (#69751)
Change: Rather than only using config, have base connection plugins fall back to play_context. Test Plan: - Tested ansible-connection logic against an IOS device - Tested -k against a VM - CI Signed-off-by: Rick Elrod <rick@elrod.me>pull/69762/head
parent
eea84b6fdd
commit
8e19ab178a
@ -0,0 +1,3 @@
|
||||
# Keeping incidental for efficiency, to avoid spinning up another VM
|
||||
shippable/vyos/incidental
|
||||
network/vyos
|
@ -0,0 +1,14 @@
|
||||
- hosts: vyos-1-1-8
|
||||
gather_facts: false
|
||||
|
||||
tasks:
|
||||
- name: Run whoami
|
||||
vyos.vyos.vyos_command:
|
||||
commands:
|
||||
- whoami
|
||||
register: whoami
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- whoami is successful
|
||||
- whoami.stdout_lines[0][0] == 'atester'
|
@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env bash
|
||||
set -ux # no -e because we want to run teardown no matter waht
|
||||
export ANSIBLE_ROLES_PATH=../
|
||||
|
||||
ansible-playbook setup.yml -i "$INVENTORY_PATH" "$@"
|
||||
|
||||
# We need a nonempty file to override key with (empty file gives a
|
||||
# lovely "list index out of range" error)
|
||||
foo=$(mktemp)
|
||||
echo hello > "$foo"
|
||||
|
||||
ansible-playbook \
|
||||
-i "$INVENTORY_PATH" \
|
||||
-e ansible_user=atester \
|
||||
-e ansible_password=testymctest \
|
||||
-e ansible_ssh_private_key_file="$foo" \
|
||||
passworded_user.yml
|
||||
|
||||
ansible-playbook teardown.yml -i "$INVENTORY_PATH" "$@"
|
@ -0,0 +1,14 @@
|
||||
- hosts: vyos-1-1-8
|
||||
connection: ansible.netcommon.network_cli
|
||||
become: true
|
||||
gather_facts: false
|
||||
|
||||
tasks:
|
||||
- name: Create user with password
|
||||
register: result
|
||||
vyos.vyos.vyos_config:
|
||||
lines:
|
||||
- set system login user atester full-name "Ansible Tester"
|
||||
- set system login user atester authentication plaintext-password testymctest
|
||||
- set system login user jsmith level admin
|
||||
- delete service ssh disable-password-authentication
|
@ -0,0 +1,14 @@
|
||||
- hosts: vyos-1-1-8
|
||||
connection: ansible.netcommon.network_cli
|
||||
become: true
|
||||
gather_facts: false
|
||||
|
||||
tasks:
|
||||
- name: Get rid of user (undo everything from setup.yml)
|
||||
register: result
|
||||
vyos.vyos.vyos_config:
|
||||
lines:
|
||||
- delete system login user atester full-name "Ansible Tester"
|
||||
- delete system login user atester authentication plaintext-password testymctest
|
||||
- delete system login user jsmith level admin
|
||||
- set service ssh disable-password-authentication
|
Loading…
Reference in New Issue