Commit graph

812 commits

Author SHA1 Message Date
Julien Palard
ab4cbfd5d3 FIX: Removing superfluous bloc wrongly introduced in 2b7799f817. (#39723) 2018-05-04 10:45:33 +02:00
Kevin Breit
c8d287fece Meraki organization module (#38773)
* Initial commit

Query an organization within Meraki. No support is in place for managing
or creating yet

* Change output_level method and make the state parameter required.

* Implemented listing all organizations

- Updated documentation
- Parse results and return all organizations
- Parse results and return specified organization

* Framework for creating an organization

- Documentation example for organization creation
- Framework exists for creating organizations, pending PR 36809
- Created functions for HTTP calls
- Renamed from dashboard.meraki.com to api.meraki.com
- Added required_if for state

* Remove absent state

- Meraki API does not support deleting an organization so absent is removed
- Updated documentation to call it state instead of status

* Small change to documentation

* Support all parameters associated to organization

- Added all parameters needed for all organization actions.
- None of the added ones work at this time.
- Added documentation for clone.

* Integration test for meraki_organization module

* Rename module to meraki for porting to module utility

* Meraki documentation fragment

- Created initial documentation fragment for Meraki modules

* Add meraki module utility to branch. Formerly was on a separate branch.

* CRU support for Meraki organization module

* CRU is supported for Meraki organizations
* There is no DELETE function for organizations in the API
* This code is very messy and needs cleanup
* Create and Update actions don't show status as updated, must fix

* Added Meraki module utility to module utility documentation list

* Added support for organization cloning
* Renamed use_ssl to use_https
* Removed define_method()
* Removed is_org()
* Added is_org_valid() which does all org sanity checks

* Fixes for ansibot
- Changed default of use_proxy from true to false
- Removed some commented out code
- Updated documentation

* Changes for ansibot
- Removed requirement for state parameter. I may readd this.
- Updated formatting

diff --git a/lib/ansible/module_utils/network/meraki/meraki.py b/lib/ansible/module_utils/network/meraki/meraki.py
index 3acd3d1038..395ac7c4b4 100644
--- a/lib/ansible/module_utils/network/meraki/meraki.py
+++ b/lib/ansible/module_utils/network/meraki/meraki.py
@@ -42,7 +42,7 @@ def meraki_argument_spec():
     return dict(auth_key=dict(type='str', no_log=True, fallback=(env_fallback, ['MERAKI_KEY'])),
                 host=dict(type='str', default='api.meraki.com'),
                 name=dict(type='str'),
-                state=dict(type='str', choices=['present', 'absent', 'query'], required=True),
+                state=dict(type='str', choices=['present', 'absent', 'query']),
                 use_proxy=dict(type='bool', default=False),
                 use_https=dict(type='bool', default=True),
                 validate_certs=dict(type='bool', default=True),
diff --git a/lib/ansible/modules/network/meraki/meraki_organization.py b/lib/ansible/modules/network/meraki/meraki_organization.py
index 923d969366..3789be91d6 100644
--- a/lib/ansible/modules/network/meraki/meraki_organization.py
+++ b/lib/ansible/modules/network/meraki/meraki_organization.py
@@ -20,11 +20,9 @@ short_description: Manage organizations in the Meraki cloud
 version_added: "2.6"
 description:
 - Allows for creation, management, and visibility into organizations within Meraki
-
 notes:
 - More information about the Meraki API can be found at U(https://dashboard.meraki.com/api_docs).
 - Some of the options are likely only used for developers within Meraki
-
 options:
     name:
         description:
@@ -32,21 +30,18 @@ options:
         - If C(clone) is specified, C(name) is the name of the new organization.
     state:
         description:
-        - Create or query organizations
-        choices: ['query', 'present']
+        - Create or modify an organization
+        choices: ['present', 'query']
     clone:
         description:
         - Organization to clone to a new organization.
-        type: string
     org_name:
         description:
         - Name of organization.
         - Used when C(name) should refer to another object.
-        type: string
     org_id:
         description:
         - ID of organization
-
 author:
     - Kevin Breit (@kbreit)
 extends_documentation_fragment: meraki
@@ -86,7 +81,6 @@ RETURN = '''
 response:
     description: Data returned from Meraki dashboard.
     type: dict
-    state: query
     returned: info
 '''

@@ -103,6 +97,7 @@ def main():
     argument_spec = meraki_argument_spec()
     argument_spec.update(clone=dict(type='str'),
+                         state=dict(type='str', choices=['present', 'query']),
                          )

@@ -125,11 +120,9 @@ def main():

     meraki.function = 'organizations'
     meraki.params['follow_redirects'] = 'all'
-    meraki.required_if=[
-                           ['state', 'present', ['name']],
-                           ['clone', ['name']],
-                           # ['vpn_PublicIP', ['name']],
-                       ]
+    meraki.required_if = [['state', 'present', ['name']],
+                          ['clone', ['name']],
+                          ]

     create_urls = {'organizations': '/organizations',
                    }
@@ -162,23 +155,16 @@ def main():

-
-    # method = None
-    # org_id = None
-
-
-    # meraki.fail_json(msg=meraki.is_org_valid(meraki.get_orgs(), org_name='AnsibleTestOrg'))
-
     if meraki.params['state'] == 'query':
-      if meraki.params['name'] is None:  # Query all organizations, no matter what
-        orgs = meraki.get_orgs()
-        meraki.result['organization'] = orgs
-      elif meraki.params['name'] is not None:  # Query by organization name
-        module.warn('All matching organizations will be returned, even if there are duplicate named organizations')
-        orgs = meraki.get_orgs()
-        for o in orgs:
-          if o['name'] == meraki.params['name']:
-            meraki.result['organization'] = o
+        if meraki.params['name'] is None:  # Query all organizations, no matter what
+            orgs = meraki.get_orgs()
+            meraki.result['organization'] = orgs
+        elif meraki.params['name'] is not None:  # Query by organization name
+            module.warn('All matching organizations will be returned, even if there are duplicate named organizations')
+            orgs = meraki.get_orgs()
+            for o in orgs:
+                if o['name'] == meraki.params['name']:
+                    meraki.result['organization'] = o
     elif meraki.params['state'] == 'present':
         if meraki.params['clone'] is not None:  # Cloning
             payload = {'name': meraki.params['name']}
@@ -193,7 +179,10 @@ def main():
             payload = {'name': meraki.params['name'],
                        'id': meraki.params['org_id'],
                        }
-            meraki.result['response'] = json.loads(meraki.request(meraki.construct_path('update', org_id=meraki.params['org_id']), payload=json.dumps(payload), method='PUT'))
+            meraki.result['response'] = json.loads(meraki.request(meraki.construct_path('update',
+                                                                                        org_id=meraki.params['org_id']),
+                                                                  payload=json.dumps(payload),
+                                                                  method='PUT'))

diff --git a/lib/ansible/utils/module_docs_fragments/meraki.py b/lib/ansible/utils/module_docs_fragments/meraki.py
index e268d02e68..3569d83b99 100644
--- a/lib/ansible/utils/module_docs_fragments/meraki.py
+++ b/lib/ansible/utils/module_docs_fragments/meraki.py
@@ -35,6 +35,7 @@ options:
         description:
         - Set amount of debug output during module execution
         choices: ['normal', 'debug']
+        default: 'normal'
     timeout:
         description:
         - Time to timeout for HTTP requests.
diff --git a/test/integration/targets/meraki_organization/aliases b/test/integration/targets/meraki_organization/aliases
new file mode 100644
index 0000000000..ad7ccf7ada
--- /dev/null
+++ b/test/integration/targets/meraki_organization/aliases
@@ -0,0 +1 @@
+unsupported

* Formatting fix

* Minor updates due to testing
- Made state required again
- Improved formatting for happier PEP8
- request() now sets instance method

* Fix reporting of the result

* Enhance idempotency checks
- Remove merging functionality as the proposed should be used
- Do check and reverse check to look for differences

* Rewrote and added additional integration tests. This isn't done.

* Updated is_update_required method:
- Original and proposed data is passed to method
- Added ignored_keys list so it can be skipped if needed

* Changes per comments from dag
- Optionally assign function on class instantiation
- URLs now have {} for substitution method
- Move auth_key check to module utility
- Remove is_new and get_existing
- Minor changes to documentation

* Enhancements for future modules and organization
- Rewrote construct_path method for simplicity
- Increased support for network functionality to be committed

* Changes based on Dag feedback and to debug problems

* Minor fixes for validitation testing

* Small changes for dag and Ansibot
- Changed how auth_key is processed
- Removed some commented lines
- Updated documentation fragment, but that may get reverted

* Remove blank line and comment

* Improvements for testing and code simplification
- Added network integration tests
- Modified error handling in request()
	- More testing to come on this
- Rewrote construct_path again. Very simple now.

* Remove trailing whitespace

* Small changes based on dag's response

* Removed certain sections from exit_json and fail_json as they're old
2018-05-04 00:01:05 +02:00
scottb
0c0dc8d9fc
Adds documentation structure and stubs for new VMWare guide (#39246)
* Adding initial skeleton of VMWare docs

* Updated product name capitaliztion; ready for initial PR.

* Add few files and updated some links

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>

* Fixed duplicate anchor tag
2018-05-03 08:05:28 -07:00
Toshio Kuratomi
1885883a88 Document follow changes
Add the file, blockinfile, and replace changes to the follow parameter
to the porting guide
2018-05-03 06:13:21 -07:00
Anna Liao
c812396793 Update playbooks_variables.rst (#39570)
<!--- Your description here -->

+label: docsite_pr
2018-05-01 23:02:32 -07:00
Abhijeet Kasurde
85ad2eae8a Fix typo in porting guides index page (#39582)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2018-05-01 23:00:59 -07:00
Matt Clay
054efb8d80
Update 2.6 roadmap dates. (#39573) 2018-05-01 15:07:37 -07:00
Andrew Gaffney
4134f1204b Add Andrew Gaffney to list of people in Committers Guidelines doc 2018-05-01 12:51:34 -07:00
Andrius Benokraitis
9773157da6 Update intermediate_concepts.rst (#39500)
Updated  GitHub Repos section to better explain what ansible-network@redhat.com is for (not an email list, but adding to the network-automation github repo.
2018-04-30 09:29:37 -05:00
Alicia Cozine
c8a9b411bc
Last docs link fixes (#39391)
* should not need <>, but fails without

* adds anchor to keywords page, uses it on plugins pages

* fixes envvar link errors

* harmonize file name and ref name as python_3

* removes undefined-lable from ignore list
2018-04-27 13:21:39 -05:00
Abhijeet Kasurde
9f1254a32f Typo fix in testing link (#39407)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2018-04-27 01:16:12 -07:00
Matt Clay
32d786af65 Convert more http links to https. 2018-04-25 23:12:46 -07:00
Lucid One
40fcef3e41 Adding support for opensearch of documentation (#38593) 2018-04-25 18:01:26 -07:00
Jordan Borean
f8853d83e3
windows: removed deprecated features in 2.6 (#38930)
* windows: removed deprecated features in 2.6

* Comma surgery.
2018-04-26 06:13:37 +10:00
Alicia Cozine
4b52a54e18 Reduce warnings (#39254)
* removes FAQ links; no entries exist for linked config settings

* fixes various anchors and links

* addresses abadger comments, thanks

* marks orphan pages, avoids TOC errors

* adds links for remote_tmp setting to FAQ
2018-04-25 11:18:52 -07:00
Matt Martz
476d1f818e
Documentation for query/q. Fixes #38275 (#38558) 2018-04-25 12:55:34 -05:00
Matt Clay
7975c8fab0
Improve integration-aliases docs. (#39087) 2018-04-24 14:25:53 -07:00
Brian Coca
b533ebe20d
remove slice docs (#37946) 2018-04-24 11:11:46 -04:00
Andrius Benokraitis
7881866db4 Update ROADMAP_2_6.rst with additional network roadmap items (#39225)
* Update ROADMAP_2_6.rst

Added network_get and network_put to Network modules roadmap

* Update ROADMAP_2_6.rst

add netconf_config to the network module roadmap
2018-04-24 15:55:12 +01:00
Alicia Cozine
8f83061e70 corrects links to 'list_of' pages (#39161) 2018-04-24 15:51:12 +01:00
Alicia Cozine
becc2a0347 adds index page for roadmaps to support internal links (#39109)
* adds index page for roadmaps to support internal links

* includes only roadmaps index page in TOC
2018-04-23 12:22:44 -07:00
Matt Clay
c262dbfd30 Use https for links to ansible.com domains. 2018-04-23 11:33:56 -07:00
saichint
6eecbf10e6 fix nxos_igmp_interface issues (#38752)
* fix nxos_igmp_interface issues

* shippable fix

* fix oif_prefix and oif_source

* shippable fix

* shippable fix

* shippable fix

* add an example for oif_ps

* review comments

* review comments

* more review comments

* fix typo
2018-04-23 20:38:49 +05:30
Josh
aa9d7cb1f3 Update playbooks_debugger.rst (#39117)
Minor typo correction

+label: docsite_pr
2018-04-23 10:37:40 +02:00
Benn Roth
56967497d5 minor accuracy fix
Don't round the parameter 12.04 in the explanatory paragraph unless `version()` rounds the parameter

(cherry picked from commit 5cf544e03e)
2018-04-20 19:14:39 -04:00
Alicia Cozine
bbfd6c6ab1 Internal refs (#39094)
* fixes community refs

* fixes appendix refs

* fixes scenario refs, keeps ACI guide link to devel

* fixes windows refs

* fixes user guide refs

* fixes dev guide refs
2018-04-20 12:17:02 -07:00
John R Barker
c4e298b808 Correct to development_process (#39069) 2018-04-20 12:36:29 -05:00
Matt Clay
9e8889bb70
Fix more docs errors. (#39051)
* Fix remaining unknown-document docs errors.
* Fix last toc-tree-missing-document docs error.
2018-04-20 00:24:47 -07:00
Matt Clay
7e96421132
Handle warnings in docs-build sanity test. (#39043) 2018-04-19 23:09:48 -07:00
Matt Clay
4fc5e89e83 Fix docs build warnings. 2018-04-19 17:54:56 -07:00
Alicia Cozine
64dcc7def0 Fixes more rST errors (#39042)
* removes include, avoids duplicate label rST warnings

* reduces literal_block errors on playbooks_filters

* addresses TOC errors

* ref error on modules page

* trying ref for list_of_database_modules
2018-04-19 17:02:48 -07:00
Alicia Cozine
408e29cbd2 Link fixes (#39038)
* fixes links on plugins pages

* fixes links in community pages

* fixes links in user guide

* adds anchors on playbooks pages
2018-04-19 17:02:30 -07:00
Toshio Kuratomi
a08459a814
Update info on python support (#38855)
* Update the documentation to list Python 3 as official
* Add some reference targets for inventory variables so we can link to docs
* Add a platform FAQ section
  Populate it with

  * virtualenv info (previously on the python3 support page)
  * BSD (Link to the working with BSD page)
  * Solaris (Document how to work around the non-POSIX shell on some
    Solaris hosts)

  Fixes #21594

* Fix some refs in the release_and_maintenance document

* Fix unindent error in module template

Fix for the module/plugin template unintentionally unindented inside of
a raw block, leading to errors like:

ERROR: docs/docsite/rst/modules/redshift_facts_module.rst:289:0: Explicit markup ends without a blank line; unexpected unindent.

* Make wording for Solaris troubleshooting better.
2018-04-18 13:04:47 -07:00
Alicia Cozine
0ebc0b9e5a adds FAQ TOC entry, links & examples to modules (#38706)
* adds FAQ TOC entry, links & examples to modules
* moves link to Notes, corrects examples
2018-04-18 11:41:54 -07:00
Toshio Kuratomi
8cdd75a09f Some more fixes for the docs :ref: disambiguation
The big one is that we needed to set plugin_type when we processed the by_support template.

Also added to list_of_CATEGORY_plugins page (which might not be used)
and corrected a place where I did module_name instead of name_module
2018-04-18 10:06:01 -07:00
Brian Coca
ce8c336d52 added ref to ansilbe molecule 2018-04-18 12:19:09 -04:00
Toshio Kuratomi
9faf7b949e Fix places in docs that refer to modules without namespace
We've namespaced all plugin docs.  Change the docs to reflect that
2018-04-18 08:43:34 -07:00
Martin Krizek
8173602a34
Add expandvars jinja2 filter (#38805)
* Add expandvars jinja2 filter

* Add docs

* Minor edit
2018-04-18 09:29:19 +02:00
scottb
c97e508806
[WIP] disambiguating autogenerated module docs attempted fix of #38439. (#38890)
Disambiguates autogenerated module docs - fixes #38439.
2018-04-17 18:45:07 -07:00
Matt Clay
3d57f45815 Update httptester docs. 2018-04-17 15:02:56 -07:00
Evgeniy Komissarov
92f4065157 Fix typo in windows_faq.rst (#38864)
Fix typo in `python-pip` packet name.
+label: docsite_pr
2018-04-18 07:55:57 +10:00
John R Barker
3d3781db57
Correct formatting (#38874) 2018-04-17 13:19:04 +01:00
Brian Coca
bdbb89378f
centralize doc/config plugin lists (#38775)
* centralize doc/config plugin lists

also update list for generation in docsite
added note to ensure they are in sync

* updated shell page to list plugins

added some more docs hinting at plugins being configurable

* fix edit link for plugins
2018-04-16 09:29:49 -04:00
Kenyon Ralph
3c6a362921 playbooks_async.rst: correct typo 2018-04-16 09:03:39 -04:00
Rémy Léone
d639d5dc96 Fix typo (#38652)
Typo
+label: docsite_pr
2018-04-13 14:15:26 -04:00
CsilLAB
521ea56e77 Add details to see decrypted vault value (#37341)
* Improves ansible-vault section of network getting started
2018-04-12 19:52:34 -05:00
Matt Clay
26fa3adeab Add docs-build sanity test. 2018-04-12 15:56:49 -07:00
Will Thames
4ba29c8bf1 Use a temp directory that is more likely to exist (#38645)
`env:SystemDrive\temp` does not necessarily exist

`env:temp` is much more likely to exist. Use that
2018-04-12 14:16:18 +10:00
Qasim Sarfraz
6d830166e9 Minor typo fix (#38589) 2018-04-12 13:47:48 +10:00
Evgeni Golov
7376a9b946 fix with_<lookup> spelling (#38584)
trivial change ;)

+label: docsite_pr
2018-04-11 15:37:33 -07:00