Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
ansible_junos_update_dhcp
#Update configuraton for DHCP on Junos 12.x devices
#Nick Shores 1-8-2018 - Created for WRA
---
- hosts: wra
gather_facts: no
connection: local
roles:
- Juniper.junos
tasks:
- name: "Get commited config"
juniper_junos_config:
retrieve: "committed"
filter: "system/services/dhcp"
host: "{{ ansible_host }}"
when: ansible_network_os == 'junos'
register: output
#- debug:
# var: output.config_lines
- name: "Update DHCP config"
juniper_junos_config:
load: "set"
lines:
- "delete system services dhcp pool {{ dhcp_pool }} name-server 10.0.0.1"
- "set system services dhcp pool {{ dhcp_pool }} name-server 10.0.5.1"
host: "{{ ansible_host }}"
commit: false
check: true
diff: true
when: ansible_network_os == 'junos'
register: dhcp_update_output
- debug:
var: dhcp_update_output.diff_lines
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.