├── roles ├── network_backup │ ├── vars │ │ └── main.yml │ ├── tasks │ │ ├── eos.yml │ │ ├── ios.yml │ │ ├── nxos.yml │ │ ├── vyos.yml │ │ ├── aireos.yml │ │ ├── aruba.yml │ │ ├── iosxr.yml │ │ ├── junos.yml │ │ ├── main.yml │ │ ├── linux.yml │ │ ├── fortimgr.yml │ │ └── f5-os.yml │ ├── defaults │ │ └── main.yaml │ └── meta │ │ └── argument_specs.yml └── network_facts │ ├── tasks │ ├── routeros.yml │ ├── vyos.yml │ ├── main.yml │ ├── fortimgr.yml │ ├── junos.yml │ ├── linux.yml │ ├── aireos.yml │ ├── eos.yml │ ├── f5-os.yml │ ├── iosxr.yml │ ├── aruba.yml │ ├── nxos.yml │ ├── ios.yml │ └── paloalto.yml │ ├── defaults │ └── main.yaml │ └── meta │ └── argument_specs.yml ├── test.yaml ├── network_backup.yml ├── inventory.yml ├── collections ├── requirements.yml └── README.md ├── inventory_netbox.yml ├── facts_network.yml ├── netbox_facts.yml ├── facts_linux.yml ├── README.md ├── ansible.cfg └── LICENSE /roles/network_backup/vars/main.yml: -------------------------------------------------------------------------------- 1 | network_backup_path: "/tmp/backup" 2 | -------------------------------------------------------------------------------- /test.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | ## This is a very thorough test, please ensure that values are properly set before running 3 | test 4 | test2 5 | test3 6 | -------------------------------------------------------------------------------- /roles/network_facts/tasks/routeros.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: collect all facts 3 | community.routeros.facts: 4 | gather_subset: all 5 | 6 | - name: export running config 7 | community.routeros.command: /export 8 | -------------------------------------------------------------------------------- /roles/network_facts/tasks/vyos.yml: -------------------------------------------------------------------------------- 1 | - name: 2 | vyos_facts: 3 | # compatible with old facts modules (<= 2.8) 4 | gather_subset: min 5 | # facts from network resource modules (2.9+) 6 | #gather_network_resources: all 7 | -------------------------------------------------------------------------------- /roles/network_facts/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: "include {{ ansible_network_os }} tasks" 3 | include_tasks: "{{ item }}" 4 | with_first_found: 5 | - files: "{{ ansible_network_os }}.yml" 6 | skip: true 7 | paths: tasks 8 | 9 | -------------------------------------------------------------------------------- /network_backup.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: backup configs to external files 3 | hosts: "{{ hosts | default('all') | lower }}" 4 | gather_facts: no 5 | connection: "{{ ansible_connection | default(network_cli) }}" 6 | 7 | roles: 8 | - role: network_backup 9 | -------------------------------------------------------------------------------- /roles/network_backup/tasks/eos.yml: -------------------------------------------------------------------------------- 1 | - name: backup current device config 2 | eos_config: 3 | backup: yes 4 | backup_options: 5 | filename: "{{ ansible_network_os }}-{{ inventory_hostname }}.cfg" 6 | dir_path: "{{ network_backup_path }}" 7 | -------------------------------------------------------------------------------- /roles/network_backup/tasks/ios.yml: -------------------------------------------------------------------------------- 1 | - name: backup current device config 2 | ios_config: 3 | backup: yes 4 | backup_options: 5 | filename: "{{ ansible_network_os }}-{{ inventory_hostname }}.cfg" 6 | dir_path: "{{ network_backup_path }}" 7 | -------------------------------------------------------------------------------- /roles/network_backup/tasks/nxos.yml: -------------------------------------------------------------------------------- 1 | - name: backup current device config 2 | nxos_config: 3 | backup: yes 4 | backup_options: 5 | filename: "{{ ansible_network_os }}-{{ inventory_hostname }}.cfg" 6 | dir_path: "{{ network_backup_path }}" 7 | -------------------------------------------------------------------------------- /roles/network_backup/tasks/vyos.yml: -------------------------------------------------------------------------------- 1 | - name: backup current device config 2 | vyos_config: 3 | backup: yes 4 | backup_options: 5 | filename: "{{ ansible_network_os }}-{{ inventory_hostname }}.cfg" 6 | dir_path: "{{ network_backup_path }}" 7 | -------------------------------------------------------------------------------- /roles/network_backup/tasks/aireos.yml: -------------------------------------------------------------------------------- 1 | - name: backup current device config 2 | aireos_config: 3 | backup: yes 4 | backup_options: 5 | filename: "{{ ansible_network_os }}-{{ inventory_hostname }}.cfg" 6 | dir_path: "{{ network_backup_path }}" 7 | -------------------------------------------------------------------------------- /roles/network_backup/tasks/aruba.yml: -------------------------------------------------------------------------------- 1 | - name: backup current device config 2 | aruba_config: 3 | backup: yes 4 | backup_options: 5 | filename: "{{ ansible_network_os }}-{{ inventory_hostname }}.cfg" 6 | dir_path: "{{ network_backup_path }}" 7 | -------------------------------------------------------------------------------- /roles/network_backup/tasks/iosxr.yml: -------------------------------------------------------------------------------- 1 | - name: backup current device config 2 | iosxr_config: 3 | backup: yes 4 | backup_options: 5 | filename: "{{ ansible_network_os }}-{{ inventory_hostname }}.cfg" 6 | dir_path: "{{ network_backup_path }}" 7 | -------------------------------------------------------------------------------- /roles/network_backup/tasks/junos.yml: -------------------------------------------------------------------------------- 1 | - name: backup current device config 2 | junos_config: 3 | backup: yes 4 | backup_options: 5 | filename: "{{ ansible_network_os }}-{{ inventory_hostname }}.cfg" 6 | dir_path: "{{ network_backup_path }}" 7 | -------------------------------------------------------------------------------- /roles/network_facts/tasks/fortimgr.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Gather Fortinet facts 3 | fortimgr_facts: 4 | provider: "{{ fmgr_connection }}" 5 | config_filter: 6 | - address 7 | - address_group 8 | adoms: "all" 9 | #fortigates: "all" 10 | -------------------------------------------------------------------------------- /roles/network_backup/defaults/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | ansible_network_os: undefined 3 | #cli_nexus_long_timeout: 4 | # host: "{{ inventory_hostname }}" 5 | # username: "{{ ansible_username }}" 6 | # password: "{{ ansible_password }}" 7 | # transport: cli 8 | # timeout: 180 9 | -------------------------------------------------------------------------------- /roles/network_facts/tasks/junos.yml: -------------------------------------------------------------------------------- 1 | - name: junos facts 2 | junipernetworks.junos.junos_facts: 3 | # compatible with legacy facts modules (<= 2.8) 4 | gather_subset: min 5 | # facts from network resource modules (2.9+) 6 | gather_network_resources: all 7 | -------------------------------------------------------------------------------- /roles/network_backup/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: set backup output directory - /var/tmp/backup 3 | file: 4 | path: /var/tmp/backup/ 5 | state: directory 6 | 7 | - name: "include {{ ansible_network_os }} tasks" 8 | include_tasks: "{{ ansible_network_os }}.yml" 9 | -------------------------------------------------------------------------------- /roles/network_backup/tasks/linux.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Execute show commands to collect device info 3 | setup: 4 | filter: ansible_distribution_version 5 | register: linux_facts 6 | 7 | - name: set version fact 8 | set_fact: 9 | version: "{{ (linux_facts)['ansible_facts']['ansible_distribution_version'] }}" 10 | 11 | -------------------------------------------------------------------------------- /roles/network_facts/defaults/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | #ansible_network_os: linux 3 | 4 | # RouterOS 5 | #ansible_connection: ansible.netcommon.network_cli 6 | #ansible_network_os: community.routeros.routeros 7 | #ansible_network_cli_ssh_type: libssh 8 | #ansible_ssh_pass: "{{ ansible_password }}" 9 | #ansible_user: "{{ ansible_username }}" 10 | #ansible_host: “{{ ip_or_dns_goes_here }}” 11 | -------------------------------------------------------------------------------- /roles/network_facts/tasks/linux.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: gather os facts 3 | ansible.builtin.setup: 4 | # filter: ansible_distribution_version 5 | # register: os_facts 6 | 7 | #- name: example setting custom rhel version fact 8 | # ansible.builtin.set_fact: 9 | # ipu_rhel_version: "{{ (os_facts)['ansible_facts']['ansible_distribution_version'] }}" 10 | # ipu_tla_name: "{{ sot_tla }}" 11 | # ipu_chg_req: "{{ snow_record_number }}" 12 | -------------------------------------------------------------------------------- /inventory.yml: -------------------------------------------------------------------------------- 1 | # This is a template I generate for my lab/test devices 2 | [all] 3 | {{ lab_cisco_ios }} ansible_ssh_private_key_file=/Users/potus33/.ssh/net_lab_cred 4 | {{ lab_cisco_nxos }} ansible_ssh_private_key_file=/Users/potus33/.ssh/net_lab_cred 5 | {{ lab_cisco_iosxr }} ansible_ssh_private_key_file=/Users/potus33/.ssh/net_lab_cred 6 | {{ lab_cisco_junos }} ansible_ssh_private_key_file=/Users/potus33/.ssh/net_lab_cred 7 | 8 | #[all:vars] 9 | #ansible_ssh_user=ec2-user 10 | -------------------------------------------------------------------------------- /collections/requirements.yml: -------------------------------------------------------------------------------- 1 | --- 2 | collections: 3 | 4 | - name: ansible.netcommon 5 | - name: ansible.posix 6 | - name: ansible.utils 7 | 8 | - name: cisco.ios 9 | - name: cisco.nxos 10 | - name: cisco.ios-xr 11 | #- name: cisco.asr 12 | #- name: cisco.asa 13 | 14 | - name: arista.eos 15 | - name: junipernetworks.junos 16 | - name: f5networks.f5_module 17 | - name: vyos.vyos 18 | - name: fortinet.fortios 19 | #- name: netbox.netbox 20 | #- name: community.routeros 21 | #- name: infoblox.nios_modules 22 | -------------------------------------------------------------------------------- /roles/network_backup/tasks/fortimgr.yml: -------------------------------------------------------------------------------- 1 | - name: backup global or a_specific_vdom settings 2 | fortios_system_config_backup_restore: 3 | config: "system config backup" 4 | host: "{{ inventory_hostname }}" 5 | username: "{{ ansible_user }}" 6 | password: "{{ ansible_password }}" 7 | vdom: "{{ vdom }}" 8 | backup: "yes" 9 | https: True 10 | ssl_verify: False 11 | scope: "global" or "vdom" 12 | filename: "{{ network_backup_path }}/{{ ansible_network_os }}-{{ inventory_hostname }}.cfg" 13 | -------------------------------------------------------------------------------- /inventory_netbox.yml: -------------------------------------------------------------------------------- 1 | --- 2 | plugin: netbox.netbox.nb_inventory 3 | api_endpoint: "{{ netbox_url }}" #The Address of the NetBox Server 4 | validate_certs: True 5 | config_context: True # This controls if the variables set in the context will be appended to the device 6 | token: "{{ netbox_token }}" 7 | group_by: 8 | - sites 9 | - racks 10 | - tags 11 | - device_roles 12 | - device_types 13 | - manufacturers 14 | - platforms 15 | device_query_filters: 16 | - has_primary_ip: 'true' 17 | interfaces: True 18 | services: True 19 | -------------------------------------------------------------------------------- /facts_network.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: collect network device facts and running configs 3 | hosts: "{{ hosts | default('all') | lower }}" 4 | gather_facts: yes 5 | connection: "{{ ansible_connection | default(network_cli) }}" 6 | 7 | roles: 8 | - role: network_facts 9 | 10 | tasks: 11 | - ansible.builtin.debug: 12 | msg: "{{ inventory_hostname }} is running {{ ansible_network_os }} verion {{ ansible_net_version }}" 13 | 14 | #- name: print ansible facts 15 | # debug: 16 | # var: ansible_facts 17 | 18 | #- name: print hostvars 19 | # debug: 20 | # var: hostvars 21 | 22 | -------------------------------------------------------------------------------- /roles/network_facts/tasks/aireos.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # There is not yet a formal AireOS fact module, so we use command parsing: 3 | - name: collect output from aireos device 4 | aireos_command: 5 | commands: 6 | - show sysinfo 7 | - show run-config commands 8 | provider: "{{ cli }}" 9 | register: output 10 | 11 | - name: set version fact 12 | set_fact: 13 | version: "{{ output.stdout[0] | regex_search('Product Version\\.* (.*)', '\\1') | first }}" 14 | 15 | - name: set config fact 16 | set_fact: 17 | config: "{{ output.stdout[1] }}" 18 | 19 | - name: set config_lines fact 20 | set_fact: 21 | config_lines: "{{ output.stdout_lines[1] }}" 22 | -------------------------------------------------------------------------------- /netbox_facts.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: collect network device facts to populate netbox inventory 3 | hosts: "{{ hosts | default('all') | lower }}" 4 | gather_facts: yes 5 | connection: "{{ ansible_connection | default(network_cli) }}" 6 | 7 | roles: 8 | # gather facts from individual network hosts 9 | - role: network_facts 10 | 11 | tasks: 12 | # create or update host info in netbox 13 | - name: create device within netbox 14 | netbox.netbox.netbox_device: 15 | netbox_url: "{{ netbox_url }}" 16 | netbox_token: "{{ netbox_token }}" 17 | data: 18 | name: "{{ item }}" 19 | comments: Updated by Ansible “{{ hostvars['item']['ansible_facts']['ansible_net_serialnum'] }}” 20 | state: present 21 | loop: "{{ groups['all'] }}" 22 | -------------------------------------------------------------------------------- /facts_linux.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: collect os facts 3 | hosts: "{{ hosts | default('all') | lower }}" 4 | gather_facts: yes 5 | #connection: "{{ ansible_connection | default() }}" 6 | 7 | tasks: 8 | ansible.builtin.debug: 9 | msg: "Server {{ inventory_hostname }} is running {{ ansible_distribution }}.{{ ansible_distribution_major_version }}" 10 | 11 | - ansible.builtin.set_fact: 12 | fact_inv_os_ver: "{{ inventory_hostname }}_{{ ansible_distribution }}.{{ ansible_distribution_major_version }}" 13 | 14 | - ansible.builtin.debug: 15 | var: "fact_inv_os_ver" 16 | 17 | #- name: print ansible facts 18 | # ansible.builtin.debug: 19 | # var: ansible_facts 20 | 21 | #- name: print hostvars 22 | # ansible.builtin.debug: 23 | # var: hostvars 24 | 25 | -------------------------------------------------------------------------------- /roles/network_facts/tasks/eos.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: 3 | arista.eos.eos_facts: 4 | # compatible with old facts modules (<= 2.8) 5 | gather_subset: min 6 | # facts from network resource modules (2.9+) 7 | #gather_network_resources: all 8 | 9 | #- name: collect output from eos device 10 | # eos_command: 11 | # commands: 12 | # - show version | json 13 | # - show running-config all | json 14 | # - show ip interface brief | include {{ ansible_host }} 15 | # register: output 16 | 17 | #- name: set version fact 18 | # set_fact: 19 | # version: "{{ output.stdout[0].version }}" 20 | 21 | #- name: set config fact 22 | # set_fact: 23 | # config: "{{ output.stdout[1] }}" 24 | 25 | #- name: set management interface name fact 26 | # set_fact: 27 | # mgmt_interface_name: "{{ output.stdout[2].split()[0] }}" 28 | -------------------------------------------------------------------------------- /roles/network_backup/tasks/f5-os.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: f5 facts 3 | bigip_facts: 4 | server: "{{ inventory_hostname }}" 5 | user: "{{ ansible_username }}" 6 | password: "{{ ansible_password }}" 7 | include: 8 | - interface 9 | - vlan 10 | - certificate 11 | - client_ssl_profile 12 | - device 13 | - pool 14 | - rule 15 | - self_ip 16 | delegate_to: localhost 17 | 18 | - name: collect output from f5 device 19 | bigip_command: 20 | commands: 21 | - show running-config one-line 22 | server: "{{ inventory_hostname }}" 23 | password: "{{ ansible_password }}" 24 | user: "{{ ansible_username }}" 25 | changed_when: false 26 | register: output 27 | 28 | - name: set config fact 29 | set_fact: 30 | config: "{{ output.stdout[0] }}" 31 | 32 | - name: set config_lines fact 33 | set_fact: 34 | config_lines: "{{ output.stdout_lines[0] }}" 35 | -------------------------------------------------------------------------------- /roles/network_facts/tasks/f5-os.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: f5 facts 3 | bigip_facts: 4 | server: "{{ inventory_hostname }}" 5 | user: "{{ ansible_username }}" 6 | password: "{{ ansible_password }}" 7 | include: 8 | - interface 9 | - vlan 10 | - certificate 11 | - client_ssl_profile 12 | - device 13 | - pool 14 | - rule 15 | - self_ip 16 | delegate_to: localhost 17 | 18 | - name: collect output from f5 device 19 | bigip_command: 20 | commands: 21 | - show running-config one-line 22 | server: "{{ inventory_hostname }}" 23 | password: "{{ ansible_password }}" 24 | user: "{{ ansible_username }}" 25 | changed_when: false 26 | register: output 27 | 28 | - name: set config fact 29 | set_fact: 30 | config: "{{ output.stdout[0] }}" 31 | 32 | - name: set config_lines fact 33 | set_fact: 34 | config_lines: "{{ output.stdout_lines[0] }}" 35 | -------------------------------------------------------------------------------- /roles/network_facts/tasks/iosxr.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: 3 | cisco.iosxr.iosxr_facts: 4 | # compatible with old facts modules (<= 2.8) 5 | gather_subset: min 6 | # facts from network resource modules (2.9+) 7 | #gather_network_resources: all 8 | 9 | #- name: collect output from iosxr device 10 | # iosxr_command: 11 | # commands: 12 | # - show version 13 | # - show running-config 14 | # - show ipv4 vrf all interface brief | include {{ ansible_host }} 15 | # provider: "{{ cli }}" 16 | # register: output 17 | # 18 | #- name: set version fact 19 | # set_fact: 20 | # version: "{{ output.stdout[0] | regex_search('Version (\\S+)\\[', '\\1') | first }}" 21 | # 22 | #- name: set config fact 23 | # set_fact: 24 | # config: "{{ output.stdout[1] }}" 25 | # 26 | #- name: set config_lines fact 27 | # set_fact: 28 | # config_lines: "{{ output.stdout_lines[1] }}" 29 | # 30 | #- name: set management interface name fact 31 | # set_fact: 32 | # mgmt_interface_name: "{{ output.stdout[2].split()[0] }}" 33 | # 34 | #- name: set vrf interface name fact 35 | # set_fact: 36 | # vrf_name: "{{ output.stdout[2].split()[-1] }}" 37 | -------------------------------------------------------------------------------- /roles/network_facts/tasks/aruba.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # There is not yet a formal Aruba fact module, so we use command parsing: 3 | - name: collect output from aruba_mobility_controller device 4 | aruba_command: 5 | commands: 6 | - show version 7 | - show running-config 8 | - show ip interface brief | include {{ ansible_host }} 9 | provider: "{{ cli }}" 10 | register: output 11 | 12 | - name: set version fact 13 | set_fact: 14 | version: "{{ output.stdout[0] | regex_search('Version (\\S+)', '\\1') | first }}" 15 | 16 | - name: set config fact 17 | set_fact: 18 | config: "{{ output.stdout[1] }}" 19 | 20 | - name: set config_lines fact 21 | set_fact: 22 | config_lines: "{{ output.stdout_lines[1] }}" 23 | 24 | - name: set management interface name fact 25 | set_fact: 26 | mgmt_interface_name: "{{ output.stdout[2] | regex_search('([\\w\\d]+\\s[\\w\\d]+)', '\\1') | first }}" 27 | 28 | - name: set master/local fact for HA settings 29 | set_fact: 30 | ha_role: "{{ output_wlan.stdout[0] | regex_search('switchrole\\:(\\w+)', '\\1') | first }}" 31 | when: output_wlan is defined and output_wlan.stdout is defined 32 | -------------------------------------------------------------------------------- /roles/network_facts/tasks/nxos.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: 3 | cisco.nxos.nxos_facts: 4 | # compatible with old facts modules (<= 2.8) 5 | gather_subset: min 6 | # facts from network resource modules (2.9+) 7 | #gather_network_resources: all 8 | 9 | #- name: collect output from nxos device 10 | # nxos_command: 11 | # commands: 12 | # - show running-config all 13 | # - show ip interface brief vrf all | include " {{ ansible_host }} " 14 | # provider: "{{ cli_nexus_long_timeout }}" 15 | # register: output 16 | # 17 | #- name: set version fact 18 | # set_fact: 19 | # version: "{{ output.stdout[0] | regex_findall('version\\s+(\\S+)') | first }}" 20 | # 21 | #- name: set config fact 22 | # set_fact: 23 | # config: "{{ output.stdout[0] }}" 24 | # 25 | #- name: set config_lines fact 26 | # set_fact: 27 | # config_lines: "{{ output.stdout_lines[0] }}" 28 | # 29 | #- name: set management interface name fact 30 | # set_fact: 31 | # mgmt_interface_name: "{{ output.stdout[1].split()[0] }}" 32 | # 33 | #- nxos_command: 34 | # commands: 35 | # - show vrf interface {{ mgmt_interface_name }} | exclude Interface 36 | # provider: "{{ cli }}" 37 | # register: output 38 | # 39 | #- name: set management interface vrf name fact 40 | # set_fact: 41 | # vrf_name: "{{ output.stdout[0].split()[1] }}" 42 | -------------------------------------------------------------------------------- /roles/network_facts/tasks/ios.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: ios facts 3 | cisco.ios.ios_facts: 4 | gather_network_resources: all ### facts from network resource modules (2.9+) 5 | gather_subset: all ### compatible with legacy facts (<= 2.8) 6 | 7 | #- name: ios facts 8 | # ios_facts: 9 | # gather_network_resources: all ### facts from network resource modules (2.9+) 10 | # gather_subset: all ### compatible with old facts modules (<= 2.8) 11 | 12 | - name: print ansible facts 13 | ansible.builtin.debug: 14 | var: ansible_facts 15 | 16 | - name: print hostvars 17 | ansible.builtin.debug: 18 | var: hostvars 19 | 20 | #- name: collect output from ios device 21 | # cisco.ios.ios_command: 22 | # commands: 23 | # - show version 24 | # - show running-config 25 | # - show ip interface brief | include {{ ansible_host }} 26 | # register: output 27 | # 28 | #- name: set version fact 29 | # ansible.builtin.set_fact: 30 | # version: "{{ output.stdout[0] | regex_search('Version (\\S+)', '\\1') | first }}" 31 | # 32 | #- name: set model number 33 | # ansible.builtin.set_fact: 34 | # model_number: "{{ output.stdout[0] | regex_search('[cC]isco\\s+(\\S+).+?with .+? bytes of.+?memory', '\\1') | first | regex_search('(\\d+)') }}" 35 | # 36 | #- name: set config fact 37 | # ansible.builtin.set_fact: 38 | # config: "{{ output.stdout[1] }}" 39 | # 40 | #- name: set config_lines fact 41 | # ansible.builtin.set_fact: 42 | # config_lines: "{{ output.stdout_lines[1] }}" 43 | # 44 | #- name: set management interface name fact 45 | # ansible.builtin.set_fact: 46 | # mgmt_interface_name: "{{ output.stdout[2].split()[0] }}" 47 | -------------------------------------------------------------------------------- /roles/network_facts/tasks/paloalto.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # 3 | # Palo Alto network_facts role tasks. 4 | # 5 | # File name: paloalto-pa.yml 6 | # Dependencies: panos_op.py Ansible module (https://github.com/PaloAltoNetworks/ansible-pan/blob/develop/library/panos_op.py) 7 | # pan-python Python package (https://pypi.python.org/pypi/pan-python) 8 | # pandevice Python package (https://pypi.python.org/pypi/pandevice) 9 | # Valid SSL certificates properly installed on the Palo Alto devices with device shortname listed 10 | # in the SAN (Subject Alternative Name). 11 | # 12 | # Facts gathered by these tasks: 13 | # - Software version number 14 | # - Device running config 15 | # 16 | # Notes: Since not all Palo Alto devices have proper SSL certificates generated and installed, a run-time 17 | # variable {{ https_verify }} is used here to by-pass the default certificate verification process. 18 | # When https_verify is set to "0", SSL certificate verification process will be by-passed. [Default: "1"] 19 | # 20 | 21 | - debug: 22 | msg: "START paloalto-pa.yml - {{ inventory_hostname }}" 23 | 24 | # Override the PYTHONHTTPSVERIFY OS environment variable if https_verify is defined 25 | - name: Override the PYTHONHTTPSVERIFY OS environment variable 26 | set_fact: 27 | https_verify: "{{ https_verify | default('1') }}" 28 | 29 | # 30 | # Execute show commands. 31 | # 32 | - name: Execute show commands to collect device info 33 | panos_op: 34 | cmd: "show system info" 35 | username: "{{ cli_username }}" 36 | password: "{{ cli_password }}" 37 | ip_address: "{{ ansible_host }}" 38 | environment: 39 | PYTHONHTTPSVERIFY: "{{ https_verify }}" 40 | register: sysinfo_output 41 | changed_when: false 42 | # 'show' command should be executed even in check mode. 43 | check_mode: no 44 | 45 | - name: Execute show commands to collect device config 46 | panos_op: 47 | cmd: "show config running" 48 | username: "{{ cli_username }}" 49 | password: "{{ cli_password }}" 50 | ip_address: "{{ ansible_host }}" 51 | environment: 52 | PYTHONHTTPSVERIFY: "{{ https_verify }}" 53 | register: config_output 54 | changed_when: false 55 | # 'show' command should be executed even in check mode. 56 | check_mode: no 57 | 58 | # 59 | # Set common facts 60 | # 61 | - name: set version fact 62 | set_fact: 63 | version: "{{ (sysinfo_output.stdout | from_json)['response']['result']['system']['sw-version'] }}" 64 | when: sysinfo_output.stdout is defined 65 | 66 | # - name: set model number fact 67 | # set_fact: 68 | # model_number: "{{ (sysinfo_output.stdout | from_json)['response']['result']['system']['model'] }}" 69 | # when: sysinfo_output.stdout is defined 70 | # 71 | # - name: set serial number fact 72 | # set_fact: 73 | # serial_number: "{{ (sysinfo_output.stdout | from_json)['response']['result']['system']['serial'] }}" 74 | # when: sysinfo_output.stdout is defined 75 | 76 | - name: set config fact 77 | set_fact: 78 | config: "{{ config_output.stdout }}" 79 | when: config_output.stdout is defined 80 | 81 | - name: set config_lines fact 82 | set_fact: 83 | config_lines: "{{ config_output.stdout_lines }}" 84 | when: config_output.stdout_lines is defined 85 | 86 | # The following variables are created to make playbooks more readable. 87 | - name: set the config_system fact 88 | set_fact: 89 | config_system: "{{ config.response.result.config.devices.entry.deviceconfig.system }}" 90 | when: 91 | - config is defined 92 | - config.response.result.config.devices.entry.deviceconfig.system is defined 93 | 94 | - name: set the config_logsettings fact 95 | set_fact: 96 | config_logsettings: "{{ config.response.result.config.shared['log-settings'] }}" 97 | when: 98 | - config is defined 99 | - config.response.result.config.shared['log-settings'] is defined 100 | 101 | - name: set the config_serverprofile fact 102 | set_fact: 103 | config_serverprofile: "{{ config.response.result.config.shared['server-profile'] }}" 104 | when: 105 | - config is defined 106 | - config.response.result.config.shared['server-profile'] is defined 107 | -------------------------------------------------------------------------------- /collections/README.md: -------------------------------------------------------------------------------- 1 | # Collections 2 | 3 | Collections are a distribution format for Ansible content that can include playbooks, roles, modules, and plugins. You can install and use collections through a distribution server, such as Ansible Galaxy, or a Pulp 3 Galaxy server. 4 | 5 | ## Installing collections with `ansible-galaxy` 6 | 7 | By default, ansible-galaxy collection install uses https://galaxy.ansible.com as the Galaxy server (as listed in the `ansible.cfg` file under `GALAXY_SERVER`). You do not need any further configuration. 8 | 9 | * To **install** a collection hosted in Galaxy: 10 | 11 | ``` 12 | ansible-galaxy collection install my_namespace.my_collection 13 | ``` 14 | 15 | * To **upgrade** a collection to the latest available version from the Galaxy server, you can use the --upgrade option: 16 | 17 | ``` 18 | ansible-galaxy collection install my_namespace.my_collection --upgrade 19 | ``` 20 | 21 | * You can also directly use the **tarball** from your build: 22 | 23 | ``` 24 | ansible-galaxy collection install my_namespace-my_collection-1.0.0.tar.gz -p ./collections 25 | ``` 26 | 27 | * You can build and install a collection from a **local source directory**. 28 | The ansible-galaxy utility builds the collection using the MANIFEST.json or galaxy.yml metadata in the directory. 29 | 30 | ``` 31 | ansible-galaxy collection install /path/to/collection -p ./collections 32 | ``` 33 | 34 | * Finally, you can also install multiple collections in a namespace directory. 35 | ``` 36 | ns/ 37 | ├── collection1/ 38 | │ ├── MANIFEST.json 39 | │ └── plugins/ 40 | └── collection2/ 41 | ├── galaxy.yml 42 | └── plugins/ 43 | ``` 44 | ``` 45 | ansible-galaxy collection install /path/to/ns -p ./collections 46 | ``` 47 | 48 | ## Using collections in a playbook 49 | 50 | Once installed, you can reference a collection content by its fully qualified collection name (FQCN): 51 | ``` 52 | - hosts: all 53 | tasks: 54 | - my_namespace.my_collection.mymodule: 55 | option1: value 56 | ``` 57 | 58 | This works for roles or any type of plugin distributed within the collection: 59 | 60 | ``` 61 | - hosts: all 62 | tasks: 63 | - import_role: 64 | name: my_namespace.my_collection.role1 65 | 66 | - my_namespace.mycollection.mymodule: 67 | option1: value 68 | 69 | - debug: 70 | msg: '{{ lookup("my_namespace.my_collection.lookup1", 'param1')| my_namespace.my_collection.filter1 }}' 71 | ``` 72 | 73 | ## Install multiple collections with a requirements file 74 | 75 | You can set up a requirements.yml file to install multiple collections in one command. This file is a YAML file in the format: 76 | ``` 77 | --- 78 | collections: 79 | # With just the collection name 80 | - my_namespace.my_collection 81 | 82 | # With the collection name, version, and source options 83 | - name: my_namespace.my_other_collection 84 | version: 'version range identifiers (default: ``*``)' 85 | source: 'The Galaxy URL to pull the collection from (default: ``--api-server`` from cmdline)' 86 | ``` 87 | 88 | You can specify four keys for each collection entry: 89 | 90 | ``` 91 | name 92 | version 93 | source 94 | type 95 | ``` 96 | 97 | The version key uses the same range identifier format documented in Installing an older version of a collection. 98 | 99 | The type key can be set to `file`, `galaxy`, `git`, `url`, `dir`, or `subdirs`. If type is omitted, the name key is used to implicitly determine the source of the collection. 100 | 101 | When you install a collection with `type: git`, the version key can refer to a branch or to a git commit-ish object (commit or tag). For example: 102 | 103 | ``` 104 | collections: 105 | - name: https://github.com/organization/repo_name.git 106 | type: git 107 | version: devel 108 | ``` 109 | 110 | You can also add roles to a requirements.yml file, under the roles key. The values follow the same format as a requirements file used in older Ansible releases. 111 | 112 | ``` 113 | --- 114 | roles: 115 | # Install a role from Ansible Galaxy. 116 | - name: geerlingguy.java 117 | version: 1.9.6 118 | 119 | collections: 120 | # Install a collection from Ansible Galaxy. 121 | - name: geerlingguy.php_roles 122 | version: 0.9.3 123 | source: https://galaxy.ansible.com 124 | ``` 125 | 126 | To install both roles and collections at the same time with one command, run the following: 127 | ``` 128 | $ ansible-galaxy install -r requirements.yml 129 | ``` 130 | 131 | Running `ansible-galaxy collection install -r` or `ansible-galaxy role install -r` will only install collections, or roles, respectively. 132 | -------------------------------------------------------------------------------- /roles/network_facts/meta/argument_specs.yml: -------------------------------------------------------------------------------- 1 | --- 2 | argument_specs: 3 | main: 4 | short_description: Auto-generated specs for network_facts role - main entry point 5 | description: 6 | - Automatically generated argument specification for the network_facts role. 7 | - 'Entry point: main' 8 | - 'Includes task files: {{ item }}' 9 | aireos: 10 | short_description: Auto-generated specs for network_facts role - aireos entry point 11 | description: 12 | - Automatically generated argument specification for the network_facts role. 13 | - 'Entry point: aireos' 14 | options: 15 | cli: 16 | description: Variable used in aireos entry point 17 | type: str 18 | required: true 19 | version_added: 1.0.0 20 | aruba: 21 | short_description: Auto-generated specs for network_facts role - aruba entry point 22 | description: 23 | - Automatically generated argument specification for the network_facts role. 24 | - 'Entry point: aruba' 25 | options: 26 | cli: 27 | description: Variable used in aruba entry point 28 | type: str 29 | required: true 30 | version_added: 1.0.0 31 | output_wlan: 32 | description: Variable used in aruba entry point 33 | type: str 34 | required: true 35 | version_added: 1.0.0 36 | eos: 37 | short_description: Auto-generated specs for network_facts role - eos entry point 38 | description: 39 | - Automatically generated argument specification for the network_facts role. 40 | - 'Entry point: eos' 41 | f5-os: 42 | short_description: Auto-generated specs for network_facts role - f5-os entry point 43 | description: 44 | - Automatically generated argument specification for the network_facts role. 45 | - 'Entry point: f5-os' 46 | - 'Includes task files: -' 47 | fortimgr: 48 | short_description: Auto-generated specs for network_facts role - fortimgr entry point 49 | description: 50 | - Automatically generated argument specification for the network_facts role. 51 | - 'Entry point: fortimgr' 52 | options: 53 | fmgr_connection: 54 | description: Variable used in fortimgr entry point 55 | type: str 56 | required: true 57 | version_added: 1.0.0 58 | ios: 59 | short_description: Auto-generated specs for network_facts role - ios entry point 60 | description: 61 | - Automatically generated argument specification for the network_facts role. 62 | - 'Entry point: ios' 63 | iosxr: 64 | short_description: Auto-generated specs for network_facts role - iosxr entry point 65 | description: 66 | - Automatically generated argument specification for the network_facts role. 67 | - 'Entry point: iosxr' 68 | options: 69 | cli: 70 | description: Variable used in iosxr entry point 71 | type: str 72 | required: true 73 | version_added: 1.0.0 74 | junos: 75 | short_description: Auto-generated specs for network_facts role - junos entry point 76 | description: 77 | - Automatically generated argument specification for the network_facts role. 78 | - 'Entry point: junos' 79 | linux: 80 | short_description: Auto-generated specs for network_facts role - linux entry point 81 | description: 82 | - Automatically generated argument specification for the network_facts role. 83 | - 'Entry point: linux' 84 | options: 85 | snow_record_number: 86 | description: Variable used in linux entry point 87 | type: str 88 | required: true 89 | version_added: 1.0.0 90 | sot_tla: 91 | description: Variable used in linux entry point 92 | type: str 93 | required: true 94 | version_added: 1.0.0 95 | nxos: 96 | short_description: Auto-generated specs for network_facts role - nxos entry point 97 | description: 98 | - Automatically generated argument specification for the network_facts role. 99 | - 'Entry point: nxos' 100 | options: 101 | cli: 102 | description: Variable used in nxos entry point 103 | type: str 104 | required: true 105 | version_added: 1.0.0 106 | cli_nexus_long_timeout: 107 | description: Variable used in nxos entry point 108 | type: str 109 | required: true 110 | version_added: 1.0.0 111 | mgmt_interface_name: 112 | description: Variable used in nxos entry point 113 | type: str 114 | required: true 115 | version_added: 1.0.0 116 | paloalto: 117 | short_description: Auto-generated specs for network_facts role - paloalto entry point 118 | description: 119 | - Automatically generated argument specification for the network_facts role. 120 | - 'Entry point: paloalto' 121 | options: 122 | cli_password: 123 | description: Variable used in paloalto entry point 124 | type: str 125 | required: true 126 | version_added: 1.0.0 127 | cli_username: 128 | description: Variable used in paloalto entry point 129 | type: str 130 | required: true 131 | version_added: 1.0.0 132 | system: 133 | description: Variable used in paloalto entry point 134 | type: str 135 | required: true 136 | version_added: 1.0.0 137 | routeros: 138 | short_description: Auto-generated specs for network_facts role - routeros entry point 139 | description: 140 | - Automatically generated argument specification for the network_facts role. 141 | - 'Entry point: routeros' 142 | vyos: 143 | short_description: Auto-generated specs for network_facts role - vyos entry point 144 | description: 145 | - Automatically generated argument specification for the network_facts role. 146 | - 'Entry point: vyos' 147 | ... 148 | -------------------------------------------------------------------------------- /roles/network_backup/meta/argument_specs.yml: -------------------------------------------------------------------------------- 1 | --- 2 | argument_specs: 3 | main: 4 | short_description: Auto-generated specs for network_backup role - main entry point 5 | description: 6 | - Automatically generated argument specification for the network_backup role. 7 | - 'Entry point: main' 8 | - 'Includes task files: {{ ansible_network_os }}' 9 | options: 10 | network_backup_path: 11 | description: 'resource name (used in task) (default: ''/tmp/backup'') (defined in vars)' 12 | type: path 13 | default: /tmp/backup 14 | version_added: 1.0.0 15 | aireos: 16 | short_description: Auto-generated specs for network_backup role - aireos entry point 17 | description: 18 | - Automatically generated argument specification for the network_backup role. 19 | - 'Entry point: aireos' 20 | options: 21 | network_backup_path: 22 | description: 'resource name (used in task) (default: ''/tmp/backup'') (defined in vars)' 23 | type: path 24 | default: /tmp/backup 25 | version_added: 1.0.0 26 | aruba: 27 | short_description: Auto-generated specs for network_backup role - aruba entry point 28 | description: 29 | - Automatically generated argument specification for the network_backup role. 30 | - 'Entry point: aruba' 31 | options: 32 | network_backup_path: 33 | description: 'resource name (used in task) (default: ''/tmp/backup'') (defined in vars)' 34 | type: path 35 | default: /tmp/backup 36 | version_added: 1.0.0 37 | eos: 38 | short_description: Auto-generated specs for network_backup role - eos entry point 39 | description: 40 | - Automatically generated argument specification for the network_backup role. 41 | - 'Entry point: eos' 42 | options: 43 | network_backup_path: 44 | description: 'resource name (used in task) (default: ''/tmp/backup'') (defined in vars)' 45 | type: path 46 | default: /tmp/backup 47 | version_added: 1.0.0 48 | f5-os: 49 | short_description: Auto-generated specs for network_backup role - f5-os entry point 50 | description: 51 | - Automatically generated argument specification for the network_backup role. 52 | - 'Entry point: f5-os' 53 | - 'Includes task files: -' 54 | options: 55 | network_backup_path: 56 | description: 'resource name (used in task) (default: ''/tmp/backup'') (defined in vars)' 57 | type: path 58 | default: /tmp/backup 59 | version_added: 1.0.0 60 | fortimgr: 61 | short_description: Auto-generated specs for network_backup role - fortimgr entry point 62 | description: 63 | - Automatically generated argument specification for the network_backup role. 64 | - 'Entry point: fortimgr' 65 | options: 66 | network_backup_path: 67 | description: 'resource name (used in task) (default: ''/tmp/backup'') (defined in vars)' 68 | type: path 69 | default: /tmp/backup 70 | version_added: 1.0.0 71 | vdom: 72 | description: Variable used in fortimgr entry point 73 | type: str 74 | required: true 75 | version_added: 1.0.0 76 | ios: 77 | short_description: Auto-generated specs for network_backup role - ios entry point 78 | description: 79 | - Automatically generated argument specification for the network_backup role. 80 | - 'Entry point: ios' 81 | options: 82 | network_backup_path: 83 | description: 'resource name (used in task) (default: ''/tmp/backup'') (defined in vars)' 84 | type: path 85 | default: /tmp/backup 86 | version_added: 1.0.0 87 | iosxr: 88 | short_description: Auto-generated specs for network_backup role - iosxr entry point 89 | description: 90 | - Automatically generated argument specification for the network_backup role. 91 | - 'Entry point: iosxr' 92 | options: 93 | network_backup_path: 94 | description: 'resource name (used in task) (default: ''/tmp/backup'') (defined in vars)' 95 | type: path 96 | default: /tmp/backup 97 | version_added: 1.0.0 98 | junos: 99 | short_description: Auto-generated specs for network_backup role - junos entry point 100 | description: 101 | - Automatically generated argument specification for the network_backup role. 102 | - 'Entry point: junos' 103 | options: 104 | network_backup_path: 105 | description: 'resource name (used in task) (default: ''/tmp/backup'') (defined in vars)' 106 | type: path 107 | default: /tmp/backup 108 | version_added: 1.0.0 109 | linux: 110 | short_description: Auto-generated specs for network_backup role - linux entry point 111 | description: 112 | - Automatically generated argument specification for the network_backup role. 113 | - 'Entry point: linux' 114 | options: 115 | network_backup_path: 116 | description: 'resource name (used in task) (default: ''/tmp/backup'') (defined in vars)' 117 | type: path 118 | default: /tmp/backup 119 | version_added: 1.0.0 120 | nxos: 121 | short_description: Auto-generated specs for network_backup role - nxos entry point 122 | description: 123 | - Automatically generated argument specification for the network_backup role. 124 | - 'Entry point: nxos' 125 | options: 126 | network_backup_path: 127 | description: 'resource name (used in task) (default: ''/tmp/backup'') (defined in vars)' 128 | type: path 129 | default: /tmp/backup 130 | version_added: 1.0.0 131 | vyos: 132 | short_description: Auto-generated specs for network_backup role - vyos entry point 133 | description: 134 | - Automatically generated argument specification for the network_backup role. 135 | - 'Entry point: vyos' 136 | options: 137 | network_backup_path: 138 | description: 'resource name (used in task) (default: ''/tmp/backup'') (defined in vars)' 139 | type: path 140 | default: /tmp/backup 141 | version_added: 1.0.0 142 | ... 143 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Facts Machine 2 | 3 | ## Facts, Configs, and Backups with Ansible 4 | 5 | The Facts Machine parses network configs into a data model. This role gathers native Ansible Facts or sets custom facts to parse command output and convert device configurations into code. 6 | 7 | Once gathered, facts can be used as backups/restores, called later as variables in other roles or playbooks, and used to define the state of a device. And most importantly, facts are used to build the framework of a network CMDB! 8 | 9 | This role will is compatible with the following platforms: 10 | 11 | ``` 12 | Linux 13 | Windows 14 | -- 15 | IOS 16 | IOS-XR 17 | NX-OS 18 | AireOS 19 | EOS 20 | JunOS 21 | Aruba 22 | F5 23 | Palo Alto 24 | Fortigate 25 | VYOS 26 | RouterOS 27 | ``` 28 | 29 | -------------- 30 | 31 | ### Find Your Host Login Details 32 | 33 | Ansible needs a few minimum details to get started. In particular, the `ansible_os` and `ansible_network_os` inventory variables to define the respective server or device OS (which should ideally be coming from a proper CMDB). 34 | 35 | At a minimum, you need to define these for each of your inventory hosts: 36 | ``` 37 | ansible_hostname hostname_fqdn 38 | ansible_username username 39 | ansible_password password 40 | and... 41 | ansible_os redhat/ubuntu/windows/etc... 42 | and/or... 43 | ansible_network_os ios/nxos/eos/etc 44 | ``` 45 | 46 | ### Buid an Inventory File 47 | 48 | And then you need an inventory file that lists the hosts you're connecting to: 49 | 50 | P.S. I *highly* recommend [vaulting your passwords/keys/creds](https://docs.ansible.com/ansible/latest/user_guide/vault.html#creating-encrypted-variables) instead of storing them plaintext! My inventories usually start like this: 51 | 52 | ``` 53 | [all] 54 | ios-dc1-rtr 55 | ios-dc2-rtr 56 | ios-dc1-swt 57 | ios-dc2-swt 58 | nxos-dc1-rtr 59 | nxos-dc2-rtr 60 | 61 | [all:vars] 62 | ansible_connection=network_cli 63 | ansible_user=admin 64 | ansible_password: !vault | 65 | $ANSIBLE_VAULT;1.2;AES256;ansible_user 66 | 66386134653765386232383236303063623663343437643766386435663632343266393064373933 67 | 3661666132363339303639353538316662616638356631650a316338316663666439383138353032 68 | 63393934343937373637306162366265383461316334383132626462656463363630613832313562 69 | 3837646266663835640a313164343535316666653031353763613037656362613535633538386539 70 | 65656439626166666363323435613131643066353762333232326232323565376635 71 | 72 | [ios] 73 | ios-dc1-rtr 74 | ios-dc2-rtr 75 | ios-dc1-swt 76 | ios-dc2-swt 77 | 78 | [ios:vars] 79 | ansible_become=yes 80 | ansible_become_method=enable 81 | ansible_network_os=ios 82 | 83 | [nxos] 84 | nxos-dc1-rtr 85 | nxos-dc2-rtr 86 | 87 | [nxos:vars] 88 | ansible_become=yes 89 | ansible_become_method=enable 90 | ansible_network_os=nxos 91 | ``` 92 | 93 | -------------- 94 | 95 | ## Ansible Fact Collection 96 | 97 | Ansible's native fact gathering can be invoked by setting `gather_facts: true` in your top level playbook. And every major networking vendor has fact modules that you can use in a playbook task: `ios_facts`, `eos_facts`, `nxos_facts`, `junos_facts`, etc... Just enable `gather_facts`, and you're on your way! 98 | 99 | Here's an example of gathering facts from a Cisco IOS device to create a backup of the full running config, and parse config subsets into a platform-agnostic data model: 100 | 101 | ``` 102 | - name: collect device facts and running configs 103 | hosts: all 104 | gather_facts: yes 105 | connection: network_cli 106 | ``` 107 | 108 | Or at the task level: 109 | 110 | ``` 111 | tasks: 112 | - name: gather ios facts 113 | cisco.ios.ios_facts: 114 | gather_subset: all 115 | ``` 116 | 117 | Either way, this is how you start down the path to true Config-to-Code! 118 | 119 | ``` 120 | ansible_facts: 121 | ansible_net_fqdn: ios-dc2-rtr.lab.vault112 122 | ansible_net_gather_subset: 123 | - interfaces 124 | ansible_net_hostname: ios-dc2-rtr 125 | ansible_net_serialnum: X11G14CLASSIFIED... 126 | ansible_net_system: nxos 127 | ansible_net_model: 93180yc-ex 128 | ansible_net_version: 14.22.0F 129 | ansible_network_resources: 130 | interfaces: 131 | - name: Ethernet1/1 132 | enabled: true 133 | mode: trunk 134 | - name: Ethernet1/2 135 | enabled: false 136 | ... 137 | ``` 138 | 139 | #### Fact Caching 140 | 141 | Ansible Facts can be cached too! Options include local file, memcached, Redis, and a plethora of others, via Ansible's [Cache Plugins](https://docs.ansible.com/ansible/latest/plugins/cache.html). And caching can be enabled with just the click button in AWX/AAP Job Templates, where you can then view facts via UI and API both. 142 | 143 | ![fact cache](https://docs.ansible.com/ansible-tower/latest/html/userguide/_images/job-templates-options-use-factcache.png) 144 | 145 | The combination of using network facts and fact caching can allow you to poll existing, in-memory data rather than parsing numerous additional commands to constantly check/refresh the device's running config. 146 | 147 | When using AAP, you can access cached facts for an individual host via: 148 | ```https://{{ aap_fqdn }}/api/v2/hosts/{{ inventory_host }}/ansible_facts``` 149 | 150 | 151 | ### Backups and Restores 152 | 153 | I consider device backups part of the fact collection process. If you're already connecting to a device and parsing its config, you might as well make a backup too. In the same time that Ansible is parsing config lines, you can easily have it dump the full running-config to a backup location of any kind -- local file, external share, git repo, etc... 154 | ``` 155 | - cisco.ios.ios_config: 156 | backup: yes 157 | backup_options: 158 | filename: "{{ ansible_network_os }}-{{ inventory_hostname }}.cfg" 159 | dir_path: /var/tmp/backup/ 160 | ``` 161 | 162 | And if you want to restore these configs, just grab the most recent backup file: 163 | ``` 164 | - name: restore config 165 | cisco.ios.ios_config: 166 | src: /var/tmp/backup/{{ ansible_network_os }}-{{inventory_hostname}}.cfg 167 | ``` 168 | 169 | ### Create Your Own Custom Ansible Facts 170 | 171 | You can also run custom commands, save the output, and parse the configuration later. Any output can be parsed and saved as a fact! 172 | 173 | Here's an example of how to set a custom fact for Cisco IOS versions. This will run `show version`, find the version details, and save it as the variable `cisco-ios-version`. 174 | 175 | ``` 176 | - name: run `show version` command 177 | cisco.ios.ios_command: 178 | commands: 179 | - show version 180 | register: output 181 | 182 | - name: set version fact 183 | ansible.builtin.set_fact: 184 | cisco-ios-version: "{{ output.stdout[0] | regex_search('Version (\\S+)', '\\1') | first }}" 185 | ``` 186 | 187 | Setting custom facts works particularly well for building out infrastructure checks/verifications. A good example of this is how F5 natively gathers the attached license. But you also can identify additional content that will help you automate expiration/renewal processes. For instance, this will run one command (`show sys license`) and set two facts: one for when the device was licensed, and another for the service check date: 188 | 189 | ``` 190 | - name: get license information - {{ inventory_hostname }} 191 | f5.bigip_command: 192 | commands: 193 | - show sys license 194 | register: license_output 195 | 196 | - name: search for `licensed on` and `service check date` 197 | ansible.builtin.set_fact: 198 | licensed_on: "{{ license_output.stdout[0] | regex_search('Licensed On (.*)') }}" 199 | service_date: "{{ license_output.stdout[0] | regex_search('Service Check Date (.*)') }}" 200 | 201 | - name: Get Licensed On and Service Check Date 202 | ansible.builtin.set_fact: 203 | licensed_on: "{{ licensed_on.split(' ') | last }}" 204 | service_date: "{{ service_date.split(' ') | last }}" 205 | 206 | - ansible.builtin.debug: 207 | msg: 208 | - "Licensed On date is {{ licensed_on }}" 209 | - "Service Check Date is {{ service_date }}" 210 | ``` 211 | 212 | -------------- 213 | 214 | ## Ansible at Scale 215 | 216 | ### Network vs OS 217 | 218 | It’s important to differentiate that Ansible operates somewhat differently when running against network devices and cloud/API endpoints. When Ansible runs against a full OS like Linux, the remote hosts have Python/Bash, and they both receive commands and process their own data and state changes. As an example with a Linux host, a standard logging service configuration playbook would be fully executed on the remote host; upon completion, only task results are sent back to Ansible. 219 | 220 | Network devices, on the other hand, rarely perform their own data processing. Until quite recently, very few network devices were built to have software APIs -- much less run Python. This presents a problem for any external configuration or management system. Things like SNMP may address some parts of this problem, by allowing some aspects of configuration and device state to be set or polled, but the reality is that a vast majority of networks are still managed via good ol' fashioned screen scrapes and command orchestration scripts...and that doesn't have to be the only option! 221 | 222 | -------------- 223 | 224 | ### Speed and Performance 225 | 226 | Get into a habit of routinely checking your playbook runtimes. Basline peformance testing is your friend! This will display run times for individual tasks and the whole playbook run: 227 | 228 | ``` 229 | #ansible.cfg 230 | callback_whitelist = profile_tasks, timer 231 | ``` 232 | 233 | -------------- 234 | 235 | ### Ansible Facts + Networking at Scale 236 | 237 | Ansible helps solve the problem of communicating with every device on your network. But even though this is the 21st century, network orchestration is still accomplished primarily by sending commands to devices, and awaiting their returning output back to Ansible (or anything else). Over. And over. And over... 238 | 239 | Rather than being able to rely on remote devices to do their own work, Ansible handles *all* network data processing -- as it’s received -- from remote devices. Which means all data processing will to be performed locally on Ansible/AWX/Tower/AAP. 240 | 241 | In the pursuit of scaling Ansible to manage large network device inventories -- especially with regard to large scale fact collection -- there are a number of factors that will directly impact job performance: 242 | 243 | 1. Frequency and extent of orchestrating/scheduling gathering facts, making and validating changes, etc... 244 | 2. Device configuration size (raw text output from `show run`, etc..) 245 | 3. Inventory sizes and devices families, e.g. IOS, NXOS, XR, Linux, etc... 246 | 4. Ansible network facts modules, parsers, and fact caching 247 | 248 | ##### Frequency and extent of orchestrating/scheduling device changes 249 | With any large inventory, there comes a balancing act between scheduling fact collection and configuration changes to avoid resource contention. At a high level, this can be as simple as benchmarking job run times with AAP resource loads, and setting job template forks accordingly. When creating new network automation roles, it’s important to establish solid development practices to avoid potentially significant processing times. 250 | 251 | ##### Device configuration size 252 | Most network automation roles will be utilizing Ansible facts derived from device configs. By looking at the raw device config sizes, such as the text output from `show run`, we can establish a rough estimate of memory usage per-host during large jobs. 253 | 254 | ##### Inventory sizes and devices families, e.g. IOS, NXOS, XR 255 | Due to the large inventory size and the likelihood of significant inventory metadata, it’s critical to ensure that inventories are broken into smaller groups -- group sizes of 5,000 or less are highly recommended. Additionally, it’s important to note that device types/families perform noticeably faster/slower than others. IOS, for instance, is often 3-4 faster than NXOS. 256 | 257 | ##### Implementation and availability of a Fact Cache 258 | Ansible can collect device facts -- useful variables about remote hosts that can be used in playbooks. Additionally, these facts can be cached in AAP. The combination of using network facts with the fact cache can significantly increase AAP job speed and reduce processing loads. 259 | 260 | -------------- 261 | 262 | ## Storing and Using Facts 263 | 264 | Unless your clusters have significant free resources to spare, AAP is not ideal for collecting, storing, *and* retrieving facts in environments with constant jobs running against large inventories. Simply put, processing all of these local facts **while** running a full cluster will put a tremendous strain on AAP. 265 | 266 | Any CMDB and Source of Truth should be implemented external to AAP. And it's highly suggested to use something like an ELK cluster to store AAP logs and Ansible Facts: 267 | 268 | https://github.com/harrytruman/elk-ansible 269 | -------------------------------------------------------------------------------- /ansible.cfg: -------------------------------------------------------------------------------- 1 | # Example config file for ansible -- https://ansible.com/ 2 | # ======================================================= 3 | 4 | # Nearly all parameters can be overridden in ansible-playbook 5 | # or with command line flags. Ansible will read ANSIBLE_CONFIG, 6 | # ansible.cfg in the current working directory, .ansible.cfg in 7 | # the home directory, or /etc/ansible/ansible.cfg, whichever it 8 | # finds first 9 | 10 | # For a full list of available options, run ansible-config list or see the 11 | # documentation: https://docs.ansible.com/ansible/latest/reference_appendices/config.html. 12 | 13 | [defaults] 14 | inventory = inventory 15 | #library = ~/.ansible/plugins/modules:/usr/share/ansible/plugins/modules 16 | #module_utils = ~/.ansible/plugins/module_utils:/usr/share/ansible/plugins/module_utils 17 | #remote_tmp = ~/.ansible/tmp 18 | #local_tmp = ~/.ansible/tmp 19 | #forks = 5 20 | #poll_interval = 0.001 21 | #ask_pass = False 22 | #transport = smart 23 | 24 | # Plays will gather facts by default, which contain information about 25 | # the remote system. 26 | # 27 | # smart - gather by default, but don't regather if already gathered 28 | # implicit - gather by default, turn off with gather_facts: False 29 | # explicit - do not gather by default, must say gather_facts: True 30 | #gathering = implicit 31 | 32 | # This only affects the gathering done by a play's gather_facts directive, 33 | # by default gathering retrieves all facts subsets 34 | # all - gather all subsets 35 | # network - gather min and network facts 36 | # hardware - gather hardware facts (longest facts to retrieve) 37 | # virtual - gather min and virtual facts 38 | # facter - import facts from facter 39 | # ohai - import facts from ohai 40 | # You can combine them using comma (ex: network,virtual) 41 | # You can negate them using ! (ex: !hardware,!facter,!ohai) 42 | # A minimal set of facts is always gathered. 43 | # 44 | gather_subset = all 45 | 46 | # some hardware related facts are collected 47 | # with a maximum timeout of 10 seconds. This 48 | # option lets you increase or decrease that 49 | # timeout to something more suitable for the 50 | # environment. 51 | # 52 | gather_timeout = 30 53 | 54 | # Ansible facts are available inside the ansible_facts.* dictionary 55 | # namespace. This setting maintains the behaviour which was the default prior 56 | # to 2.5, duplicating these variables into the main namespace, each with a 57 | # prefix of 'ansible_'. 58 | # This variable is set to True by default for backwards compatibility. It 59 | # will be changed to a default of 'False' in a future release. 60 | # 61 | #inject_facts_as_vars = True 62 | 63 | # Paths to search for roles, colon separated 64 | #roles_path = ~/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles 65 | 66 | # Host key checking is enabled by default 67 | #host_key_checking = True 68 | 69 | # You can only have one 'stdout' callback type enabled at a time. The default 70 | # is 'default'. The 'yaml' or 'debug' stdout callback plugins are easier to read. 71 | # 72 | #stdout_callback = default 73 | #stdout_callback = yaml 74 | #stdout_callback = debug 75 | 76 | 77 | # Ansible ships with some plugins that require whitelisting, 78 | # this is done to avoid running all of a type by default. 79 | # These setting lists those that you want enabled for your system. 80 | # Custom plugins should not need this unless plugin author disables them 81 | # by default. 82 | # 83 | # Enable callback plugins, they can output to stdout but cannot be 'stdout' type. 84 | callback_whitelist = timer, profile_tasks 85 | 86 | # Determine whether includes in tasks and handlers are "static" by 87 | # default. As of 2.0, includes are dynamic by default. Setting these 88 | # values to True will make includes behave more like they did in the 89 | # 1.x versions. 90 | # 91 | #task_includes_static = False 92 | #handler_includes_static = False 93 | 94 | # Controls if a missing handler for a notification event is an error or a warning 95 | #error_on_missing_handler = True 96 | 97 | # Default timeout for connection plugins 98 | timeout = 10 99 | 100 | # Default user to use for playbooks if user is not specified 101 | # Uses the connection plugin's default, normally the user currently executing Ansible, 102 | # unless a different user is specified here. 103 | # 104 | #remote_user = root 105 | 106 | # Logging is off by default unless this path is defined. 107 | #log_path = /var/log/ansible.log 108 | 109 | # Default module to use when running ad-hoc commands 110 | #module_name = command 111 | 112 | # Use this shell for commands executed under sudo. 113 | # you may need to change this to /bin/bash in rare instances 114 | # if sudo is constrained. 115 | # 116 | #executable = /bin/sh 117 | 118 | # By default, variables from roles will be visible in the global variable 119 | # scope. To prevent this, set the following option to True, and only 120 | # tasks and handlers within the role will see the variables there 121 | # 122 | #private_role_vars = False 123 | 124 | # List any Jinja2 extensions to enable here. 125 | #jinja2_extensions = jinja2.ext.do,jinja2.ext.i18n 126 | 127 | # If set, always use this private key file for authentication, same as 128 | # if passing --private-key to ansible or ansible-playbook 129 | # 130 | #private_key_file = /path/to/file 131 | 132 | # If set, configures the path to the Vault password file as an alternative to 133 | # specifying --vault-password-file on the command line. This can also be 134 | # an executable script that returns the vault password to stdout. 135 | # 136 | #vault_password_file = /path/to/vault_password_file 137 | 138 | # Format of string {{ ansible_managed }} available within Jinja2 139 | # templates indicates to users editing templates files will be replaced. 140 | # replacing {file}, {host} and {uid} and strftime codes with proper values. 141 | # 142 | #ansible_managed = Ansible managed: {file} modified on %Y-%m-%d %H:%M:%S by {uid} on {host} 143 | 144 | # {file}, {host}, {uid}, and the timestamp can all interfere with idempotence 145 | # in some situations so the default is a static string: 146 | # 147 | #ansible_managed = Ansible managed 148 | 149 | # By default, ansible-playbook will display "Skipping [host]" if it determines a task 150 | # should not be run on a host. Set this to "False" if you don't want to see these "Skipping" 151 | # messages. NOTE: the task header will still be shown regardless of whether or not the 152 | # task is skipped. 153 | # 154 | #display_skipped_hosts = True 155 | 156 | # By default, if a task in a playbook does not include a name: field then 157 | # ansible-playbook will construct a header that includes the task's action but 158 | # not the task's args. This is a security feature because ansible cannot know 159 | # if the *module* considers an argument to be no_log at the time that the 160 | # header is printed. If your environment doesn't have a problem securing 161 | # stdout from ansible-playbook (or you have manually specified no_log in your 162 | # playbook on all of the tasks where you have secret information) then you can 163 | # safely set this to True to get more informative messages. 164 | # 165 | #display_args_to_stdout = False 166 | 167 | # Ansible will raise errors when attempting to dereference 168 | # Jinja2 variables that are not set in templates or action lines. Uncomment this line 169 | # to change this behavior. 170 | # 171 | #error_on_undefined_vars = False 172 | 173 | # Ansible may display warnings based on the configuration of the 174 | # system running ansible itself. This may include warnings about 3rd party packages or 175 | # other conditions that should be resolved if possible. 176 | # To disable these warnings, set the following value to False: 177 | # 178 | #system_warnings = True 179 | 180 | # Ansible may display deprecation warnings for language 181 | # features that should no longer be used and will be removed in future versions. 182 | # To disable these warnings, set the following value to False: 183 | # 184 | #deprecation_warnings = True 185 | 186 | # Ansible can optionally warn when usage of the shell and 187 | # command module appear to be simplified by using a default Ansible module 188 | # instead. These warnings can be silenced by adjusting the following 189 | # setting or adding warn=yes or warn=no to the end of the command line 190 | # parameter string. This will for example suggest using the git module 191 | # instead of shelling out to the git command. 192 | # 193 | #command_warnings = False 194 | 195 | 196 | # set plugin path directories here, separate with colons 197 | #action_plugins = /usr/share/ansible/plugins/action 198 | #become_plugins = /usr/share/ansible/plugins/become 199 | #cache_plugins = /usr/share/ansible/plugins/cache 200 | #callback_plugins = /usr/share/ansible/plugins/callback 201 | #connection_plugins = /usr/share/ansible/plugins/connection 202 | #lookup_plugins = /usr/share/ansible/plugins/lookup 203 | #inventory_plugins = /usr/share/ansible/plugins/inventory 204 | #vars_plugins = /usr/share/ansible/plugins/vars 205 | #filter_plugins = /usr/share/ansible/plugins/filter 206 | #test_plugins = /usr/share/ansible/plugins/test 207 | #terminal_plugins = /usr/share/ansible/plugins/terminal 208 | #strategy_plugins = /usr/share/ansible/plugins/strategy 209 | 210 | 211 | # Ansible will use the 'linear' strategy but you may want to try another one. 212 | strategy = free 213 | 214 | # By default, callbacks are not loaded for /bin/ansible. Enable this if you 215 | # want, for example, a notification or logging callback to also apply to 216 | # /bin/ansible runs 217 | # 218 | #bin_ansible_callbacks = False 219 | 220 | 221 | # Don't like cows? that's unfortunate. 222 | # set to 1 if you don't want cowsay support or export ANSIBLE_NOCOWS=1 223 | #nocows = 1 224 | 225 | # Set which cowsay stencil you'd like to use by default. When set to 'random', 226 | # a random stencil will be selected for each task. The selection will be filtered 227 | # against the `cow_whitelist` option below. 228 | # 229 | #cow_selection = default 230 | #cow_selection = random 231 | 232 | # When using the 'random' option for cowsay, stencils will be restricted to this list. 233 | # it should be formatted as a comma-separated list with no spaces between names. 234 | # NOTE: line continuations here are for formatting purposes only, as the INI parser 235 | # in python does not support them. 236 | # 237 | #cow_whitelist=bud-frogs,bunny,cheese,daemon,default,dragon,elephant-in-snake,elephant,eyes,\ 238 | # hellokitty,kitty,luke-koala,meow,milk,moofasa,moose,ren,sheep,small,stegosaurus,\ 239 | # stimpy,supermilker,three-eyes,turkey,turtle,tux,udder,vader-koala,vader,www 240 | 241 | # Don't like colors either? 242 | # set to 1 if you don't want colors, or export ANSIBLE_NOCOLOR=1 243 | # 244 | #nocolor = 1 245 | 246 | # If set to a persistent type (not 'memory', for example 'redis') fact values 247 | # from previous runs in Ansible will be stored. This may be useful when 248 | # wanting to use, for example, IP information from one group of servers 249 | # without having to talk to them in the same playbook run to get their 250 | # current IP information. 251 | # 252 | #fact_caching = memory 253 | 254 | # This option tells Ansible where to cache facts. The value is plugin dependent. 255 | # For the jsonfile plugin, it should be a path to a local directory. 256 | # For the redis plugin, the value is a host:port:database triplet: fact_caching_connection = localhost:6379:0 257 | # 258 | #fact_caching_connection=/tmp 259 | 260 | # retry files 261 | # When a playbook fails a .retry file can be created that will be placed in ~/ 262 | # You can enable this feature by setting retry_files_enabled to True 263 | # and you can change the location of the files by setting retry_files_save_path 264 | # 265 | #retry_files_enabled = False 266 | #retry_files_save_path = ~/.ansible-retry 267 | 268 | # prevents logging of task data, off by default 269 | #no_log = False 270 | 271 | # prevents logging of tasks, but only on the targets, data is still logged on the master/controller 272 | #no_target_syslog = False 273 | 274 | # Controls whether Ansible will raise an error or warning if a task has no 275 | # choice but to create world readable temporary files to execute a module on 276 | # the remote machine. This option is False by default for security. Users may 277 | # turn this on to have behaviour more like Ansible prior to 2.1.x. See 278 | # https://docs.ansible.com/ansible/latest/user_guide/become.html#becoming-an-unprivileged-user 279 | # for more secure ways to fix this than enabling this option. 280 | # 281 | #allow_world_readable_tmpfiles = False 282 | 283 | # Controls what compression method is used for new-style ansible modules when 284 | # they are sent to the remote system. The compression types depend on having 285 | # support compiled into both the controller's python and the client's python. 286 | # The names should match with the python Zipfile compression types: 287 | # * ZIP_STORED (no compression. available everywhere) 288 | # * ZIP_DEFLATED (uses zlib, the default) 289 | # These values may be set per host via the ansible_module_compression inventory variable. 290 | # 291 | #module_compression = 'ZIP_DEFLATED' 292 | 293 | # This controls the cutoff point (in bytes) on --diff for files 294 | # set to 0 for unlimited (RAM may suffer!). 295 | # 296 | #max_diff_size = 104448 297 | 298 | # Controls showing custom stats at the end, off by default 299 | #show_custom_stats = False 300 | 301 | # Controls which files to ignore when using a directory as inventory with 302 | # possibly multiple sources (both static and dynamic) 303 | # 304 | #inventory_ignore_extensions = ~, .orig, .bak, .ini, .cfg, .retry, .pyc, .pyo 305 | 306 | # This family of modules use an alternative execution path optimized for network appliances 307 | # only update this setting if you know how this works, otherwise it can break module execution 308 | # 309 | #network_group_modules=eos, nxos, ios, iosxr, junos, vyos 310 | 311 | # When enabled, this option allows lookups (via variables like {{lookup('foo')}} or when used as 312 | # a loop with `with_foo`) to return data that is not marked "unsafe". This means the data may contain 313 | # jinja2 templating language which will be run through the templating engine. 314 | # ENABLING THIS COULD BE A SECURITY RISK 315 | # 316 | #allow_unsafe_lookups = False 317 | 318 | # set default errors for all plays 319 | #any_errors_fatal = False 320 | 321 | 322 | [inventory] 323 | # List of enabled inventory plugins and the order in which they are used. 324 | #enable_plugins = host_list, script, auto, yaml, ini, toml 325 | 326 | # Ignore these extensions when parsing a directory as inventory source 327 | #ignore_extensions = .pyc, .pyo, .swp, .bak, ~, .rpm, .md, .txt, ~, .orig, .ini, .cfg, .retry 328 | 329 | # ignore files matching these patterns when parsing a directory as inventory source 330 | #ignore_patterns= 331 | 332 | # If 'True' unparsed inventory sources become fatal errors, otherwise they are warnings. 333 | #unparsed_is_failed = False 334 | 335 | 336 | [privilege_escalation] 337 | #become = False 338 | #become_method = sudo 339 | #become_ask_pass = False 340 | 341 | 342 | ## Connection Plugins ## 343 | 344 | # Settings for each connection plugin go under a section titled '[[plugin_name]_connection]' 345 | # To view available connection plugins, run ansible-doc -t connection -l 346 | # To view available options for a connection plugin, run ansible-doc -t connection [plugin_name] 347 | # https://docs.ansible.com/ansible/latest/plugins/connection.html 348 | 349 | [paramiko_connection] 350 | # uncomment this line to cause the paramiko connection plugin to not record new host 351 | # keys encountered. Increases performance on new host additions. Setting works independently of the 352 | # host key checking setting above. 353 | #record_host_keys=False 354 | 355 | # by default, Ansible requests a pseudo-terminal for commands executed under sudo. Uncomment this 356 | # line to disable this behaviour. 357 | #pty = False 358 | 359 | # paramiko will default to looking for SSH keys initially when trying to 360 | # authenticate to remote devices. This is a problem for some network devices 361 | # that close the connection after a key failure. Uncomment this line to 362 | # disable the Paramiko look for keys function 363 | #look_for_keys = False 364 | 365 | # When using persistent connections with Paramiko, the connection runs in a 366 | # background process. If the host doesn't already have a valid SSH key, by 367 | # default Ansible will prompt to add the host key. This will cause connections 368 | # running in background processes to fail. Uncomment this line to have 369 | # Paramiko automatically add host keys. 370 | #host_key_auto_add = True 371 | 372 | 373 | [ssh_connection] 374 | # ssh arguments to use 375 | # Leaving off ControlPersist will result in poor performance, so use 376 | # paramiko on older platforms rather than removing it, -C controls compression use 377 | #ssh_args = -C -o ControlMaster=auto -o ControlPersist=60s 378 | 379 | # The base directory for the ControlPath sockets. 380 | # This is the "%(directory)s" in the control_path option 381 | # 382 | # Example: 383 | # control_path_dir = /tmp/.ansible/cp 384 | #control_path_dir = ~/.ansible/cp 385 | 386 | # The path to use for the ControlPath sockets. This defaults to a hashed string of the hostname, 387 | # port and username (empty string in the config). The hash mitigates a common problem users 388 | # found with long hostnames and the conventional %(directory)s/ansible-ssh-%%h-%%p-%%r format. 389 | # In those cases, a "too long for Unix domain socket" ssh error would occur. 390 | # 391 | # Example: 392 | # control_path = %(directory)s/%%h-%%r 393 | #control_path = 394 | 395 | # Enabling pipelining reduces the number of SSH operations required to 396 | # execute a module on the remote server. This can result in a significant 397 | # performance improvement when enabled, however when using "sudo:" you must 398 | # first disable 'requiretty' in /etc/sudoers 399 | # 400 | # By default, this option is disabled to preserve compatibility with 401 | # sudoers configurations that have requiretty (the default on many distros). 402 | # 403 | #pipelining = False 404 | 405 | # Control the mechanism for transferring files (old) 406 | # * smart = try sftp and then try scp [default] 407 | # * True = use scp only 408 | # * False = use sftp only 409 | #scp_if_ssh = smart 410 | 411 | # Control the mechanism for transferring files (new) 412 | # If set, this will override the scp_if_ssh option 413 | # * sftp = use sftp to transfer files 414 | # * scp = use scp to transfer files 415 | # * piped = use 'dd' over SSH to transfer files 416 | # * smart = try sftp, scp, and piped, in that order [default] 417 | #transfer_method = smart 418 | 419 | # If False, sftp will not use batch mode to transfer files. This may cause some 420 | # types of file transfer failures impossible to catch however, and should 421 | # only be disabled if your sftp version has problems with batch mode 422 | #sftp_batch_mode = False 423 | 424 | # The -tt argument is passed to ssh when pipelining is not enabled because sudo 425 | # requires a tty by default. 426 | #usetty = True 427 | 428 | # Number of times to retry an SSH connection to a host, in case of UNREACHABLE. 429 | # For each retry attempt, there is an exponential backoff, 430 | # so after the first attempt there is 1s wait, then 2s, 4s etc. up to 30s (max). 431 | #retries = 3 432 | 433 | 434 | [persistent_connection] 435 | # Configures the persistent connection timeout value in seconds. This value is 436 | # how long the persistent connection will remain idle before it is destroyed. 437 | # If the connection doesn't receive a request before the timeout value 438 | # expires, the connection is shutdown. The default value is 30 seconds. 439 | connect_timeout = 120 440 | 441 | # The command timeout value defines the amount of time to wait for a command 442 | # or RPC call before timing out. The value for the command timeout must 443 | # be less than the value of the persistent connection idle timeout (connect_timeout) 444 | # The default value is 30 second. 445 | command_timeout = 120 446 | 447 | 448 | ## Become Plugins ## 449 | 450 | # Settings for become plugins go under a section named '[[plugin_name]_become_plugin]' 451 | # To view available become plugins, run ansible-doc -t become -l 452 | # To view available options for a specific plugin, run ansible-doc -t become [plugin_name] 453 | # https://docs.ansible.com/ansible/latest/plugins/become.html 454 | 455 | [sudo_become_plugin] 456 | #flags = -H -S -n 457 | #user = root 458 | 459 | 460 | [selinux] 461 | # file systems that require special treatment when dealing with security context 462 | # the default behaviour that copies the existing context or uses the user default 463 | # needs to be changed to use the file system dependent context. 464 | #special_context_filesystems=fuse,nfs,vboxsf,ramfs,9p,vfat 465 | 466 | # Set this to True to allow libvirt_lxc connections to work without SELinux. 467 | #libvirt_lxc_noseclabel = False 468 | 469 | 470 | [colors] 471 | #highlight = white 472 | #verbose = blue 473 | #warn = bright purple 474 | #error = red 475 | #debug = dark gray 476 | #deprecate = purple 477 | #skip = cyan 478 | #unreachable = red 479 | #ok = green 480 | #changed = yellow 481 | #diff_add = green 482 | #diff_remove = red 483 | #diff_lines = cyan 484 | 485 | 486 | [diff] 487 | # Always print diff when running ( same as always running with -D/--diff ) 488 | #always = False 489 | 490 | # Set how many context lines to show in diff 491 | #context = 3 492 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | --------------------------------------------------------------------------------