Use local_action instead of delegate_to in switch config tasks

As of ansible 2.3, it is no longer possible to use delegate_to with a host other
than localhost. Use of a jump host can be enabled via setting ProxyCommand in
ansible_ssh_common_args as for other hosts.
This commit is contained in:
Mark Goddard 2017-10-12 10:49:13 +00:00
parent 887f06106d
commit da75d6b734
5 changed files with 6 additions and 14 deletions

View File

@ -26,7 +26,6 @@
- role: ssh-known-host - role: ssh-known-host
- role: dell-switch - role: dell-switch
dell_switch_delegate_to: localhost
dell_switch_type: "{{ switch_type }}" dell_switch_type: "{{ switch_type }}"
dell_switch_provider: "{{ switch_dellos_provider }}" dell_switch_provider: "{{ switch_dellos_provider }}"
dell_switch_config: "{{ switch_config }}" dell_switch_config: "{{ switch_config }}"
@ -39,7 +38,6 @@
- role: ssh-known-host - role: ssh-known-host
- role: junos-switch - role: junos-switch
junos_switch_delegate_to: localhost
junos_switch_type: "{{ switch_type }}" junos_switch_type: "{{ switch_type }}"
junos_switch_provider: "{{ switch_junos_provider }}" junos_switch_provider: "{{ switch_junos_provider }}"
junos_switch_config_format: "{{ switch_junos_config_format }}" junos_switch_config_format: "{{ switch_junos_config_format }}"

View File

@ -1,7 +1,4 @@
--- ---
# Host on which to execute DellOS Ansible modules.
dell_switch_delegate_to:
# Type of Dell switch. One of dellos6, dellos9. # Type of Dell switch. One of dellos6, dellos9.
dell_switch_type: dell_switch_type:

View File

@ -1,14 +1,14 @@
--- ---
- name: Ensure DellOS6 switches are configured - name: Ensure DellOS6 switches are configured
dellos6_config: local_action:
module: dellos6_config
provider: "{{ dell_switch_provider }}" provider: "{{ dell_switch_provider }}"
src: dellos6-config.j2 src: dellos6-config.j2
delegate_to: "{{ dell_switch_delegate_to }}"
when: "{{ dell_switch_type == 'dellos6' }}" when: "{{ dell_switch_type == 'dellos6' }}"
- name: Ensure DellOS9 switches are configured - name: Ensure DellOS9 switches are configured
dellos9_config: local_action:
module: dellos9_config
provider: "{{ dell_switch_provider }}" provider: "{{ dell_switch_provider }}"
src: dellos9-config.j2 src: dellos9-config.j2
delegate_to: "{{ dell_switch_delegate_to }}"
when: "{{ dell_switch_type == 'dellos9' }}" when: "{{ dell_switch_type == 'dellos9' }}"

View File

@ -1,7 +1,4 @@
--- ---
# Host on which to execute Junos Ansible modules.
junos_switch_delegate_to:
# Authentication provider information. # Authentication provider information.
junos_switch_provider: junos_switch_provider:

View File

@ -27,11 +27,11 @@
become: "{{ lookup('env', 'VIRTUAL_ENV') == None }}" become: "{{ lookup('env', 'VIRTUAL_ENV') == None }}"
- name: Ensure Juniper switches are configured - name: Ensure Juniper switches are configured
junos_config: local_action:
module: junos_config
provider: "{{ junos_switch_provider }}" provider: "{{ junos_switch_provider }}"
src: "{{ junos_switch_src }}" src: "{{ junos_switch_src }}"
src_format: "{{ junos_switch_config_format }}" src_format: "{{ junos_switch_config_format }}"
delegate_to: "{{ junos_switch_delegate_to }}"
vars: vars:
junos_switch_config_format_to_src: junos_switch_config_format_to_src:
set: junos-config-set.j2 set: junos-config-set.j2