diff options
author | Victor da Costa <victorockeiro@gmail.com> | 2018-03-09 19:31:27 +0100 |
---|---|---|
committer | Chris Houseknecht <chousekn@redhat.com> | 2018-03-09 13:31:27 -0500 |
commit | cb53b717a490e52276a156b2221c411e56c590a5 (patch) | |
tree | d53e7809aa041a475f6aecc209c308d8df522af2 /lib/ansible/galaxy | |
parent | c2a063a5c0977bb5bc6bb89fea1f6b0af93dcf3b (diff) | |
download | ansible-cb53b717a490e52276a156b2221c411e56c590a5.tar.gz |
Ansible Galaxy: skel for network role #37241 (#37251)
* Skel for network role (#37241)
Skel and boilerplate for network role.
* Add network option as valid type
Diffstat (limited to 'lib/ansible/galaxy')
17 files changed, 522 insertions, 0 deletions
diff --git a/lib/ansible/galaxy/data/network/.travis.yml b/lib/ansible/galaxy/data/network/.travis.yml new file mode 100644 index 0000000000..36bbf6208c --- /dev/null +++ b/lib/ansible/galaxy/data/network/.travis.yml @@ -0,0 +1,29 @@ +--- +language: python +python: "2.7" + +# Use the new container infrastructure +sudo: false + +# Install ansible +addons: + apt: + packages: + - python-pip + +install: + # Install ansible + - pip install ansible + + # Check ansible version + - ansible --version + + # Create ansible.cfg with correct roles_path + - printf '[defaults]\nroles_path=../' >ansible.cfg + +script: + # Basic role syntax check + - ansible-playbook tests/test.yml -i tests/inventory --syntax-check + +notifications: + webhooks: https://galaxy.ansible.com/api/v1/notifications/
\ No newline at end of file diff --git a/lib/ansible/galaxy/data/network/README.md b/lib/ansible/galaxy/data/network/README.md new file mode 100644 index 0000000000..84533c635a --- /dev/null +++ b/lib/ansible/galaxy/data/network/README.md @@ -0,0 +1,38 @@ +Role Name +========= + +A brief description of the role goes here. + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses any vendor specific SDKs or module with specific dependencies, it may be a good idea to mention in this section that the package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: + + - hosts: servers + roles: + - { role: username.rolename, x: 42 } + +License +------- + +BSD + +Author Information +------------------ + +An optional section for the role authors to include contact information, or a website (HTML is not allowed). diff --git a/lib/ansible/galaxy/data/network/cliconf_plugins/example.py.j2 b/lib/ansible/galaxy/data/network/cliconf_plugins/example.py.j2 new file mode 100644 index 0000000000..02f234acb2 --- /dev/null +++ b/lib/ansible/galaxy/data/network/cliconf_plugins/example.py.j2 @@ -0,0 +1,40 @@ +# +# (c) 2018 Red Hat Inc. +# +# This file is part of Ansible +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# +from __future__ import (absolute_import, division, print_function) +from ansible.errors import AnsibleError +__metaclass__ = type + +try: + from ansible.plugins.cliconf import CliconfBase + """ + Examples: + https://github.com/ansible/ansible/blob/devel/lib/ansible/plugins/cliconf/iosxr.py + https://github.com/ansible/ansible/blob/devel/lib/ansible/plugins/cliconf/junos.py + """ +except ImportError: + raise AnsibleError("Cliconf Plugin [ {{ role_name }} ]: Dependency not satisfied") + + +class Cliconf(CliconfBase): + """ + Examples: + https://github.com/ansible/ansible/blob/devel/lib/ansible/plugins/cliconf/iosxr.py + https://github.com/ansible/ansible/blob/devel/lib/ansible/plugins/cliconf/junos.py + """ + raise AnsibleError("Cliconf Plugin [ {{ role_name }} ]: Not implemented") diff --git a/lib/ansible/galaxy/data/network/defaults/main.yml.j2 b/lib/ansible/galaxy/data/network/defaults/main.yml.j2 new file mode 100644 index 0000000000..3818e64c33 --- /dev/null +++ b/lib/ansible/galaxy/data/network/defaults/main.yml.j2 @@ -0,0 +1,2 @@ +--- +# defaults file for {{ role_name }} diff --git a/lib/ansible/galaxy/data/network/files/.git_keep b/lib/ansible/galaxy/data/network/files/.git_keep new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/lib/ansible/galaxy/data/network/files/.git_keep diff --git a/lib/ansible/galaxy/data/network/library/example_command.py.j2 b/lib/ansible/galaxy/data/network/library/example_command.py.j2 new file mode 100644 index 0000000000..8c8594bd25 --- /dev/null +++ b/lib/ansible/galaxy/data/network/library/example_command.py.j2 @@ -0,0 +1,71 @@ +# +# (c) 2018 Red Hat Inc. +# +# This file is part of Ansible +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# +from __future__ import (absolute_import, division, print_function) +from ansible.errors import AnsibleError +__metaclass__ = type + + +### Documentation +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + + +DOCUMENTATION = """ + Examples: + https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/network/iosxr/iosxr_command.py + https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/network/junos/junos_command.py +""" + +EXAMPLES = """ + Examples: + https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/network/iosxr/iosxr_command.py + https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/network/junos/junos_command.py +""" + + +RETURN = """ + Examples: + https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/network/iosxr/iosxr_command.py + https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/network/junos/junos_command.py +""" + +#### Imports +try: + from ansible.module_utils.basic import AnsibleModule + """ + Examples: + https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/network/iosxr/iosxr_command.py + https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/network/junos/junos_command.py + """ +except ImportError: + raise AnsibleError("[ {{ role_name }}_command ]: Dependency not satisfied") + +#### Implementation +def main(): + """ + Examples: + https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/network/iosxr/iosxr_command.py + https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/network/junos/junos_command.py + """ + raise AnsibleError(" [ {{ role_name }}_command ]: Not Implemented") + +#### Entrypoint +if __name__ == '__main__': + main() diff --git a/lib/ansible/galaxy/data/network/library/example_config.py.j2 b/lib/ansible/galaxy/data/network/library/example_config.py.j2 new file mode 100644 index 0000000000..15c29aff2e --- /dev/null +++ b/lib/ansible/galaxy/data/network/library/example_config.py.j2 @@ -0,0 +1,71 @@ +# +# (c) 2018 Red Hat Inc. +# +# This file is part of Ansible +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# +from __future__ import (absolute_import, division, print_function) +from ansible.errors import AnsibleError +__metaclass__ = type + + +### Documentation +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + + +DOCUMENTATION = """ + Examples: + https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/network/iosxr/iosxr_config.py + https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/network/junos/junos_config.py +""" + +EXAMPLES = """ + Examples: + https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/network/iosxr/iosxr_config.py + https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/network/junos/junos_config.py +""" + + +RETURN = """ + Examples: + https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/network/iosxr/iosxr_config.py + https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/network/junos/junos_config.py +""" + +### Imports +try: + from ansible.module_utils.basic import AnsibleModule + """ + Examples: + https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/network/iosxr/iosxr_config.py + https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/network/junos/junos_config.py + """ +except ImportError: + raise AnsibleError("[ {{ role_name }}_config ]: Dependency not satisfied") + +### Implementation +def main(): + """ + Examples: + https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/network/iosxr/iosxr_config.py + https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/network/junos/junos_config.py + """ + raise AnsibleError(" [ {{ role_name }}_config ]: Not Implemented") + +### Entrypoint +if __name__ == '__main__': + main() diff --git a/lib/ansible/galaxy/data/network/library/example_facts.py.j2 b/lib/ansible/galaxy/data/network/library/example_facts.py.j2 new file mode 100644 index 0000000000..ecff927f39 --- /dev/null +++ b/lib/ansible/galaxy/data/network/library/example_facts.py.j2 @@ -0,0 +1,71 @@ +# +# (c) 2018 Red Hat Inc. +# +# This file is part of Ansible +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# +from __future__ import (absolute_import, division, print_function) +from ansible.errors import AnsibleError +__metaclass__ = type + + +### Documentation +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + + +DOCUMENTATION = """ + Examples: + https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/network/iosxr/iosxr_facts.py + https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/network/junos/junos_facts.py +""" + +EXAMPLES = """ + Examples: + https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/network/iosxr/iosxr_facts.py + https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/network/junos/junos_facts.py +""" + + +RETURN = """ + Examples: + https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/network/iosxr/iosxr_facts.py + https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/network/junos/junos_facts.py +""" + +### Imports +try: + from ansible.module_utils.basic import AnsibleModule + """ + Examples: + https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/network/iosxr/iosxr_facts.py + https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/network/junos/junos_facts.py + """ +except ImportError: + raise AnsibleError("[ {{ role_name }}_facts ]: Dependency not satisfied") + +### Implementation +def main(): + """ + Examples: + https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/network/iosxr/iosxr_facts.py + https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/network/junos/junos_facts.py + """ + raise AnsibleError(" [ {{ role_name }}_facts ]: Not Implemented") + +### Entrypoint +if __name__ == '__main__': + main() diff --git a/lib/ansible/galaxy/data/network/meta/main.yml.j2 b/lib/ansible/galaxy/data/network/meta/main.yml.j2 new file mode 100644 index 0000000000..cdefce594e --- /dev/null +++ b/lib/ansible/galaxy/data/network/meta/main.yml.j2 @@ -0,0 +1,60 @@ +galaxy_info: + author: {{ author }} + description: {{ description }} + company: {{ company }} + + # If the issue tracker for your role is not on github, uncomment the + # next line and provide a value + # issue_tracker_url: {{ issue_tracker_url }} + + # Some suggested licenses: + # - BSD (default) + # - MIT + # - GPLv2 + # - GPLv3 + # - Apache + # - CC-BY + license: {{ license }} + + min_ansible_version: {{ min_ansible_version }} + + # If this a Container Enabled role, provide the minimum Ansible Container version. + # min_ansible_container_version: + + # Optionally specify the branch Galaxy will use when accessing the GitHub + # repo for this role. During role install, if no tags are available, + # Galaxy will use this branch. During import Galaxy will access files on + # this branch. If Travis integration is configured, only notifications for this + # branch will be accepted. Otherwise, in all cases, the repo's default branch + # (usually master) will be used. + #github_branch: + + # + # platforms is a list of platforms, and each platform has a name and a list of versions. + # + # platforms: + # - name: VYOS + # versions: + # - all + # - 25 + # - name: SomePlatform + # versions: + # - all + # - 1.0 + # - 7 + # - 99.99 + + galaxy_tags: [] + # List tags for your role here, one per line. A tag is a keyword that describes + # and categorizes the role. Users find roles by searching for tags. Be sure to + # remove the '[]' above, if you add tags to this list. + # + # NOTE: A tag is limited to a single word comprised of alphanumeric characters. + # Maximum 20 tags per role. + +dependencies: [] + # List your role dependencies here, one per line. Be sure to remove the '[]' above, + # if you add dependencies to this list. + {%- for dependency in dependencies %} + #- {{ dependency }} + {%- endfor %} diff --git a/lib/ansible/galaxy/data/network/module_utils/example.py.j2 b/lib/ansible/galaxy/data/network/module_utils/example.py.j2 new file mode 100644 index 0000000000..9bf2d3f61e --- /dev/null +++ b/lib/ansible/galaxy/data/network/module_utils/example.py.j2 @@ -0,0 +1,40 @@ +# +# (c) 2018 Red Hat Inc. +# +# This file is part of Ansible +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# +from __future__ import (absolute_import, division, print_function) +from ansible.errors import AnsibleError +__metaclass__ = type + +### Imports +try: + from ansible.module_utils.basic import env_fallback, return_values + from ansible.module_utils.connection import Connection + """ + Examples: + https://github.com/ansible/ansible/blob/devel/lib/ansible/module_utils/network/iosxr/iosxr.py + https://github.com/ansible/ansible/blob/devel/lib/ansible/module_utils/network/junos//junos.py + """ +except ImportError: + raise AnsibleError("Netconf Plugin [ {{ role_name }} ]: Dependency not satisfied") + +### Implementation +""" + Examples: + https://github.com/ansible/ansible/blob/devel/lib/ansible/module_utils/network/iosxr/iosxr.py + https://github.com/ansible/ansible/blob/devel/lib/ansible/module_utils/network/junos//junos.py +""" diff --git a/lib/ansible/galaxy/data/network/netconf_plugins/example.py.j2 b/lib/ansible/galaxy/data/network/netconf_plugins/example.py.j2 new file mode 100644 index 0000000000..e3a1ce6160 --- /dev/null +++ b/lib/ansible/galaxy/data/network/netconf_plugins/example.py.j2 @@ -0,0 +1,40 @@ +# +# (c) 2018 Red Hat Inc. +# +# This file is part of Ansible +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# +from __future__ import (absolute_import, division, print_function) +from ansible.errors import AnsibleError +__metaclass__ = type + +try: + from ansible.plugins.terminal import NetconfBase + """ + Examples: + https://github.com/ansible/ansible/blob/devel/lib/ansible/plugins/netconf/iosxr.py + https://github.com/ansible/ansible/blob/devel/lib/ansible/plugins/netconf/junos.py + """ +except ImportError: + raise AnsibleError("Netconf Plugin [ {{ role_name }} ]: Dependency not satisfied") + + +class Netconf(NetconfBase): + """ + Examples: + https://github.com/ansible/ansible/blob/devel/lib/ansible/plugins/netconf/iosxr.py + https://github.com/ansible/ansible/blob/devel/lib/ansible/plugins/netconf/junos.py + """ + raise AnsibleError("Netconf Plugin [ {{ role_name }} ]: Not implemented") diff --git a/lib/ansible/galaxy/data/network/tasks/main.yml.j2 b/lib/ansible/galaxy/data/network/tasks/main.yml.j2 new file mode 100644 index 0000000000..a988065059 --- /dev/null +++ b/lib/ansible/galaxy/data/network/tasks/main.yml.j2 @@ -0,0 +1,2 @@ +--- +# tasks file for {{ role_name }} diff --git a/lib/ansible/galaxy/data/network/templates/.git_keep b/lib/ansible/galaxy/data/network/templates/.git_keep new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/lib/ansible/galaxy/data/network/templates/.git_keep diff --git a/lib/ansible/galaxy/data/network/terminal_plugins/example.py.j2 b/lib/ansible/galaxy/data/network/terminal_plugins/example.py.j2 new file mode 100644 index 0000000000..621a140c59 --- /dev/null +++ b/lib/ansible/galaxy/data/network/terminal_plugins/example.py.j2 @@ -0,0 +1,40 @@ +# +# (c) 2018 Red Hat Inc. +# +# This file is part of Ansible +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# +from __future__ import (absolute_import, division, print_function) +from ansible.errors import AnsibleError +__metaclass__ = type + +try: + from ansible.plugins.terminal import TerminalBase + """ + Examples: + https://github.com/ansible/ansible/blob/devel/lib/ansible/plugins/terminal/iosxr.py + https://github.com/ansible/ansible/blob/devel/lib/ansible/plugins/terminal/junos.py + """ +except ImportError: + raise AnsibleError("Terminal Plugin [ {{ role_name }} ]: Dependency not satisfied") + + +class TerminalModule(TerminalBase): + """ + Examples: + https://github.com/ansible/ansible/blob/devel/lib/ansible/plugins/terminal/iosxr.py + https://github.com/ansible/ansible/blob/devel/lib/ansible/plugins/terminal/junos.py + """ + raise AnsibleError("Terminal Plugin [ {{ role_name }} ]: Not implemented") diff --git a/lib/ansible/galaxy/data/network/tests/inventory b/lib/ansible/galaxy/data/network/tests/inventory new file mode 100644 index 0000000000..878877b077 --- /dev/null +++ b/lib/ansible/galaxy/data/network/tests/inventory @@ -0,0 +1,2 @@ +localhost + diff --git a/lib/ansible/galaxy/data/network/tests/test.yml.j2 b/lib/ansible/galaxy/data/network/tests/test.yml.j2 new file mode 100644 index 0000000000..11284eb5b8 --- /dev/null +++ b/lib/ansible/galaxy/data/network/tests/test.yml.j2 @@ -0,0 +1,14 @@ +--- +- hosts: localhost + connection: network_cli + gather_facts: False + + roles: + - {{ role_name }} + +- hosts: localhost + connection: netconf + gather_facts: False + + roles: + - {{ role_name }} diff --git a/lib/ansible/galaxy/data/network/vars/main.yml.j2 b/lib/ansible/galaxy/data/network/vars/main.yml.j2 new file mode 100644 index 0000000000..092d511a1e --- /dev/null +++ b/lib/ansible/galaxy/data/network/vars/main.yml.j2 @@ -0,0 +1,2 @@ +--- +# vars file for {{ role_name }} |