This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| system { | |
| login { | |
| user ansible { | |
| class super-user; | |
| authentication { | |
| ssh-rsa "{{ ansible_public_key }}"; | |
| } | |
| } | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # This task upgrades software | |
| - name: Upgrade junos software | |
| hosts: all | |
| connection: local | |
| gather_facts: no | |
| roles: | |
| - Juniper.junos | |
| vars_prompt: | |
| - name: USER | |
| prompt: Device user |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Based on examples at https://github.com/Juniper/ansible-junos-stdlib/blob/deb0f9bf4fbe0c0db6026d674a81d5b671dcf756/library/junos_jsnapy | |
| # I tested my example using ansible-junos-stdlib commit deb0f9bf4fbe0c0db6026d674a81d5b671dcf756. | |
| # The current version (3/17/2017) in Galaxy is 1.4.0. The junos_jsnapy module in 1.4.0 will not work with this example. | |
| # The "err" and "info" messages work fine using the jsnapy command line tool; however, I can get them to display in the playbook | |
| # run. | |
| - name: BGP peer test | |
| hosts: all | |
| connection: local | |
| gather_facts: no |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| interface_test: | |
| - rpc: get-interface-information | |
| - args: | |
| interface-name: et-2/0/0 | |
| - iterate: | |
| xpath: //physical-interface | |
| tests: | |
| - exists: name | |
| info: "Test succeeded. et-2/0/0 exists" | |
| err: "Test failed. et-2/0/0 does not exist" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #jinja2: lstrip_blocks: True | |
| {% set vlans_per_ifl = 10 %} | |
| {% for ifd, int in host.uplinks.items() %} | |
| {{ ifd }} { | |
| description "{{ int.description }}"; | |
| apply-groups-except interface-properties; | |
| vlan-tagging; | |
| mtu 9432; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| From phusion/baseimage:0.9.18 | |
| MAINTAINER Jeff Loughridge <jloughridge@acm.org> | |
| RUN apt-get update && apt-get -y install --no-install-recommends \ | |
| git \ | |
| nano \ | |
| openssh-server \ | |
| python-apt \ | |
| software-properties-common |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //interfaces/interface[name='lo0']/unit[name='0']/family/inet/address/primary/preceding-sibling::name |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| - name: Get primary lo0 address | |
| hosts: all | |
| connection: local | |
| gather_facts: no | |
| roles: | |
| - Juniper.junos | |
| - cmprescott.xml | |
| vars: | |
| temp_dir: /tmp | |
| USER: jeffl |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # based on Duke Dougal's post at http://superuser.com/questions/844101/docker-login-via-ssh-always-asks-for-password | |
| FROM ubuntu:trusty | |
| ENV USER ubuntu | |
| RUN apt-get update && apt-get install -y openssh-server | |
| RUN mkdir /var/run/sshd | |
| RUN adduser --disabled-password --gecos "" $USER | |
| RUN adduser $USER sudo | |
| ADD authorized_keys /home/$USER/.ssh/authorized_keys | |
| RUN chown $USER /home/$USER/.ssh/authorized_keys | |
| RUN chown -R $USER:$USER /home/$USER/.ssh/authorized_keys |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import logging | |
| logging.basicConfig(stream=sys.stdout, level=logging.DEBUG, | |
| format='%(asctime)s.%(msecs)d %(levelname)s %(module)s - %(funcName)s: %(message)s', | |
| datefmt="%Y-%m-%d %H:%M:%S") | |
| logging.debug("Here is a debug-level message") |