Skip to content
This repository has been archived by the owner on May 14, 2020. It is now read-only.

Commit

Permalink
Adapt logging to correct ref to fortiosapi
Browse files Browse the repository at this point in the history
provide example with multi lines wildcard fqdn, adapt to fortiosapi 0.6.2 for set to work properly
  • Loading branch information
thomnico committed Jul 12, 2017
1 parent 9845ef2 commit de61b66
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 302 deletions.
293 changes: 0 additions & 293 deletions library/fortiosapi.py

This file was deleted.

2 changes: 1 addition & 1 deletion library/fortiosconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
fos = FortiOSAPI()
formatter = logging.Formatter(
'%(asctime)s %(name)-12s %(levelname)-8s %(message)s')
logger = logging.getLogger('fortinetconflib')
logger = logging.getLogger('fortiosapi')
hdlr = logging.FileHandler('/var/tmp/ansible-fortiosconfig.log')
hdlr.setFormatter(formatter)
logger.addHandler(hdlr)
Expand Down
22 changes: 14 additions & 8 deletions play.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@
vars:
host: "192.168.115.128"
username: "admin"
password: "adminpasswd"
password: ""
vdom: "root"
tasks:
# - name: Upload python module wrkaround when pip is not an option.
# copy: src=library/fortiosapi.py dest=/usr/local/lib/python2.7/dist-packages/fortiosapi.py
# If you manage python pip externaly you don't need that version is
# here to ensure update/downgrade if needed (optional)
- pip:
name: fortiosapi
version: 0.6.2
- name: Set static route on the fortigate
fortiosconfig:
action: "set"
Expand All @@ -21,7 +24,7 @@
dst: "10.10.32.0 255.255.255.0"
device: "port2"
gateway: "192.168.40.252"
- name: add firewall address
- name: add multiple firewall address
fortiosconfig:
config: "firewall address"
action: "set"
Expand All @@ -30,13 +33,16 @@
password: "{{ password }}"
vdom: "{{ vdom }}"
config_parameters:
wildcard-fqdn: "*.libertyglobal.com"
name: "lb-ansible"
wildcard-fqdn: "*.{{ item }}"
name: "all.{{ item }}"
type: "wildcard-fqdn"
- name: add firewall policy
with_items:
- "fortinet.com"
- "acme.org"
- name: firewall policy
fortiosconfig:
config: "firewall policy"
action: "set"
action: "post"
host: "{{ host }}"
username: "{{ username }}"
password: "{{ password }}"
Expand Down

0 comments on commit de61b66

Please sign in to comment.