Versions Compared

Key

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


https://hub.docker.com/r/juniper/pyez-ansible/

...

jkriker@jkriker-T460 MINGW64 ~/Documents/ansiblescript/facts_playbook
$ ls
hosts playbook.yml


Start the container:

cd   ~/Documents/ansiblescript/facts_playbook

docker run -it --rm -v $PWD:/project juniper/pyez-ansible ash

...

Basic hosts & playbook.yml file:

ansible-playbook -i hosts playbook.yml



Code Block
titleplaybook.yml
collapsetrue
---
- name: Get facts
  hosts: vMX
  connection: local
  gather_facts: no
  
  roles:
  - Juniper.junos
  
  #vars_prompt:
  #- name: ADMUSER
  #    prompt: Username
  #    private: no
  #- name: ADMPASS
  #   prompt: password
  #   private: yes

  tasks:
  - name: Get junos facts
    junos_get_facts:
      #host: "{{ inventory_hostname }}"
      host: vMX
      #user: "{{ ADMUSER }}"
      user: "ansible"
      #passwd: "{{ ADMPASS }}"
      passwd: "ansible123"
    register: junos
  - name: Print facts
    debug:
      var: junos



Code Block
titlehosts
collapsetrue
[vMX]
192.168.99.11


...