Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...





Code Block
titlesingle set command
collapsetrue
jlk@jkriker-T460:/etc/ansible/roles/ex3400/tasks$ more /etc/ansible/hosts
[ex4300]
172.30.95.194

[ex3400]
172.30.95.165



jlk@jkriker-T460:/etc/ansible/roles/ex3400/tasks$ more single_set_cmd.yml
---
- name: load config and do a commit check then rollback
  hosts: ex4300
  connection: local
  gather_facts: no
  roles:
    - Juniper.junos
  tasks:
    - name: Append .foo to the hostname using private config mode.
      juniper_junos_config:
        config_mode: 'private'
        host: "{{ inventory_hostname }}"
        user: "jansible"
        passwd: "jansible123"
        check: true
        diff: true
        commit: false
        load: 'merge'
        lines:
          - "set system host-name {{ inventory_hostname }}.jlk"
      register: response
    - name: Print the config changes.
      debug:
        var: response












...