-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31 from sean1986/master
updated files for AJA 2nd edition
- Loading branch information
Showing
224 changed files
with
3,074 additions
and
2,071 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
*Day One: Automating Junos with Ansible* is available as a free PDF on [Juniper J-Net](https://www.juniper.net/us/en/training/jnbooks/day-one/automation-series/automating-junos-ansible/); for eBooks get it on [Apple iBooks/iTunes](https://itunes.apple.com/us/book/day-one-automating-junos-with-ansible/id1351397873?mt=11) or on [Amazon for Kindle](https://www.amazon.com/Day-One-Automating-Junos®-Ansible-ebook/dp/B079YZDVYJ). For print books purchase at the [Day One Print Store](http://store.vervante.com/c/v/V4081804173.html). | ||
|
||
------------------------------------------------------------ | ||
|
||
The text of *Day One: Automating Junos with Ansible* walks the reader through creating a number of example playbooks and their supporting files. Some of the playbooks are revised several times in a single chapter. Some of the playbooks are revised several times across several chapters. | ||
The text of *Day One: Automating Junos with Ansible, 2nd Edition* walks the reader through creating a number of example playbooks and their supporting files. Some of the playbooks are revised several times in a single chapter. Some of the playbooks are revised several times across several chapters. | ||
|
||
In order to maintain a "flow" the book does not ask the reader to save the revisions to the playbooks and supporting files using different, versioned names (for example, "save playbook-2.yaml as playbook-3.yaml"). Instead, the book assumes the reader will keep revising the files "in place." (This is also, in the author's experience, closer to how scripts and playbooks evolve in the real world.) | ||
|
||
However, this lack of versioning creates a problem when trying to represent the files at different states of their evolution, which is the goal of the book's directory in Juniper's GitHub repository. The files in this directory are "versioned" in two ways: | ||
|
||
- Playbooks and supporting files from each chapter are in chapter-specific directories. Chapter 8 has two directories because of the changes made to the inventory file during the chapter. | ||
|
||
- Some of the playbooks and templates have version suffixes (for example, base-settings-1.yaml, base-settings-2.yaml, etc.) to identify the sequence in which the versions are created in the book. | ||
- Some of the playbooks and templates have version suffixes (for example, base-settings-1.yaml, base-settings-2.yaml, etc.) to identify the sequence in which the versions are created in the book. In most cases, section headers in the book identify the version of the file being worked on in that section. | ||
|
||
You can copy each chapter's files and folders, as needed, from the chapter's directory into your ~/aja2 directory if you wish the directory paths to appear as written in the book, or you can run the playbooks for each chapter from within the chapter's directory. | ||
|
||
------------------------------------------------------------ | ||
|
||
You can copy each chapter's files and folders, as needed, into your ~/aja directory if you wish everything to appear exactly as written in the book, or you can run the playbooks for each chapter from within the chapter directory. | ||
*Day One: Automating Junos with Ansible, 2nd Edition* is available as a free PDF on [Juniper J-Net](https://www.juniper.net/us/en/training/jnbooks/day-one/automation-series/automating-junos-ansible/); for eBooks get it on [Apple iBooks/iTunes](https://itunes.apple.com/us/book/day-one-automating-junos-with-ansible/id1351397873?mt=11) or on [Amazon for Kindle](https://www.amazon.com/Day-One-Automating-Junos®-Ansible-ebook/dp/B079YZDVYJ). For print books purchase at the [Day One Print Store](http://store.vervante.com/c/v/V4081804173.html). |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
[defaults] | ||
inventory = inventory3 | ||
host_key_checking = False | ||
log_path = ~/aja/ansible.log |
This file contains 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 file contains 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 file contains 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 file contains 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
38 changes: 38 additions & 0 deletions
38
ansible/Automating_Junos_with_Ansible/chapter_10/get-device-facts-4.yaml
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
--- | ||
- name: Get facts from Junos device and save as CSV file | ||
hosts: | ||
- all | ||
roles: | ||
- Juniper.junos | ||
connection: local | ||
gather_facts: no | ||
|
||
vars: | ||
facts_dir: "{{ user_data_path }}/facts" | ||
facts_build_dir: "{{ user_data_path }}/facts/build" | ||
connection_settings: | ||
host: "{{ ansible_host }}" | ||
|
||
tasks: | ||
- name: confirm/create report directory | ||
file: | ||
path: "{{ facts_dir }}" | ||
state: directory | ||
run_once: yes | ||
delegate_to: localhost | ||
|
||
- name: confirm/create build directory | ||
file: | ||
path: "{{ facts_build_dir }}" | ||
state: directory | ||
run_once: yes | ||
delegate_to: localhost | ||
|
||
- name: get device facts | ||
juniper_junos_facts: | ||
provider: "{{ connection_settings }}" | ||
|
||
- name: save device facts | ||
template: | ||
src: template/device-facts-4a.j2 | ||
dest: "{{ facts_build_dir }}/{{ inventory_hostname }}.txt" |
60 changes: 60 additions & 0 deletions
60
ansible/Automating_Junos_with_Ansible/chapter_10/get-device-facts-5.yaml
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
--- | ||
- name: Get facts from Junos device and save as CSV file | ||
hosts: | ||
- all | ||
roles: | ||
- Juniper.junos | ||
connection: local | ||
gather_facts: no | ||
|
||
vars: | ||
facts_dir: "{{ user_data_path }}/facts" | ||
facts_build_dir: "{{ user_data_path }}/facts/build" | ||
connection_settings: | ||
host: "{{ ansible_host }}" | ||
systime: "{{ ansible_date_time.time | replace(':', '-') }}" | ||
timestamp: "{{ ansible_date_time.date }}_{{ systime }}" | ||
report_file: "{{ facts_dir }}/device-facts_{{ timestamp }}.csv" | ||
|
||
tasks: | ||
- name: get localhost environment info | ||
setup: | ||
run_once: yes | ||
delegate_to: localhost | ||
|
||
- name: confirm/create report directory | ||
file: | ||
path: "{{ facts_dir }}" | ||
state: directory | ||
run_once: yes | ||
delegate_to: localhost | ||
|
||
- name: delete old build directory if present | ||
file: | ||
path: "{{ facts_build_dir }}" | ||
state: absent | ||
run_once: yes | ||
delegate_to: localhost | ||
|
||
- name: create build directory | ||
file: | ||
path: "{{ facts_build_dir }}" | ||
state: directory | ||
run_once: yes | ||
delegate_to: localhost | ||
|
||
- name: get device facts | ||
juniper_junos_facts: | ||
provider: "{{ connection_settings }}" | ||
|
||
- name: save device facts | ||
template: | ||
src: template/device-facts-5.j2 | ||
dest: "{{ facts_build_dir }}/{{ inventory_hostname }}.csv" | ||
|
||
- name: assemble inventory report | ||
assemble: | ||
src: "{{ facts_build_dir }}" | ||
dest: "{{ report_file }}" | ||
run_once: yes | ||
delegate_to: localhost |
Oops, something went wrong.