<commit_before>#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2018 F5 Networks Inc.
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)

from __future__ import absolute_import, division, print_function
__metaclass__ = type


ANSIBLE_METADATA = {'metadata_version': '1.1',
                    'status': ['preview'],
                    'supported_by': 'community'}

DOCUMENTATION = r'''
---
module: bigiq_device_facts
short_description: Collect facts from F5 BIG-IQ devices
description:
  - Collect facts from F5 BIG-IQ devices.
version_added: 2.8
options:
  gather_subset:
    description:
      - When supplied, this argument will restrict the facts returned to a given subset.
      - Can specify a list of values to include a larger subset.
      - Values can also be used with an initial C(!) to specify that a specific subset
        should not be collected.
    required: True
    choices:
      - all
      - system-db
      - system-info
      - "!all"
      - "!system-db"
      - "!system-info"
extends_documentation_fragment: f5
author:
  - <NAME> (@caphrim007)
'''

EXAMPLES = r'''
- name: Collect BIG-IQ facts
  bigiq_device_facts:
    gather_subset:
      - system-info
      - vlans
    provider:
      server: lb.mydomain.com
      user: admin
      password: <PASSWORD>
  delegate_to: localhost

- name: Collect all BIG-IQ facts
  bigiq_device_facts:
    gather_subset:
      - all
    provider:
      server: lb.mydomain.com
      user: admin
      password: <PASSWORD>
  delegate_to: localhost

- name: Collect all BIG-IP facts except trunks
  bigiq_device_facts:
    gather_subset:
      - all
      - "!trunks"
    provider:
      server: lb.mydomain.com
      user: admin
      password: <PASSWORD>
  delegate_to: localhost
'''

RETURN = r'''
system_info:
  description: System info related facts.
  returned: When C(system-info) is specified in C(gather_subset).
  type: complex
  contains:
    base_mac_address:
      description:
        - Media Access Control address (MAC address) of the device.
      returned: changed
      type: string
      sample: "fa:16:3e:c3:42:6f"
    marketing_name:
      description:
        - Marketing name of the device platform.
      returned: changed
      type: string
      sample: BIG-IQ Virtual Edition
    time:
      description:
        - Mapping of the current time information to specific time-named keys.
      returned: changed
      type: complex
      contains:
        day:
          description:
            - The current day of the month, in numeric form.
          returned: changed
          type: int
          sample: 7
        hour:
          description:
            - The current hour of the day in 24-hour form.
          returned: changed
          type: int
          sample: 18
        minute:
          description:
            - The current minute of the hour.
          returned: changed
          type: int
          sample: 16
        month:
          description:
            - The current month, in numeric form.
          returned: changed
          type: int
          sample: 6
        second:
          description:
            - The current second of the minute.
          returned: changed
          type: int
          sample: 51
        year:
          description:
            - The current year in 4-digit form.
          returned: changed
          type: int
          sample: 2018
    hardware_information:
      description:
        - Information related to the hardware (drives and CPUs) of the system.
      type: complex
      returned: changed
      contains:
        model:
          description:
            - The model of the hardware.
          type: string
          sample: Virtual Disk
        name:
          description:
            - The name of the hardware.
          type: string
          sample: HD1
        type:
          description:
            - The type of hardware.
          type: string
          sample: physical-disk
        versions:
          description:
            - Hardware specific properties
          type: complex
          contains:
            name:
              description:
                - Name of the property
              type: string
              sample: Size
            version:
              description:
                - Value of the property
              type: string
              sample: 154.00G
    package_edition:
      description:
        - Displays the software edition.
      returned: changed
      type: string
      sample: Point Release 7
    package_version:
      description:
        - A string combining the C(product_build) and C(product_build_date).
      type: string
      sample: "Build 0.0.1 - Tue May 15 15:26:30 PDT 2018"
    product_code:
      description:<commit_msg>adding more fact documentation<commit_after>#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2018 F5 Networks Inc.
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)

from __future__ import absolute_import, division, print_function
__metaclass__ = type


ANSIBLE_METADATA = {'metadata_version': '1.1',
                    'status': ['preview'],
                    'supported_by': 'community'}

DOCUMENTATION = r'''
---
module: bigiq_device_facts
short_description: Collect facts from F5 BIG-IQ devices
description:
  - Collect facts from F5 BIG-IQ devices.
version_added: 2.8
options:
  gather_subset:
    description:
      - When supplied, this argument will restrict the facts returned to a given subset.
      - Can specify a list of values to include a larger subset.
      - Values can also be used with an initial C(!) to specify that a specific subset
        should not be collected.
    required: True
    choices:
      - all
      - system-db
      - system-info
      - "!all"
      - "!system-db"
      - "!system-info"
extends_documentation_fragment: f5
author:
  - <NAME> (@caphrim007)
'''

EXAMPLES = r'''
- name: Collect BIG-IQ facts
  bigiq_device_facts:
    gather_subset:
      - system-info
      - vlans
    provider:
      server: lb.mydomain.com
      user: admin
      password: <PASSWORD>
  delegate_to: localhost

- name: Collect all BIG-IQ facts
  bigiq_device_facts:
    gather_subset:
      - all
    provider:
      server: lb.mydomain.com
      user: admin
      password: <PASSWORD>
  delegate_to: localhost

- name: Collect all BIG-IP facts except trunks
  bigiq_device_facts:
    gather_subset:
      - all
      - "!trunks"
    provider:
      server: lb.mydomain.com
      user: admin
      password: <PASSWORD>
  delegate_to: localhost
'''

RETURN = r'''
system_info:
  description: System info related facts.
  returned: When C(system-info) is specified in C(gather_subset).
  type: complex
  contains:
    base_mac_address:
      description:
        - Media Access Control address (MAC address) of the device.
      returned: changed
      type: string
      sample: "fa:16:3e:c3:42:6f"
    marketing_name:
      description:
        - Marketing name of the device platform.
      returned: changed
      type: string
      sample: BIG-IQ Virtual Edition
    time:
      description:
        - Mapping of the current time information to specific time-named keys.
      returned: changed
      type: complex
      contains:
        day:
          description:
            - The current day of the month, in numeric form.
          returned: changed
          type: int
          sample: 7
        hour:
          description:
            - The current hour of the day in 24-hour form.
          returned: changed
          type: int
          sample: 18
        minute:
          description:
            - The current minute of the hour.
          returned: changed
          type: int
          sample: 16
        month:
          description:
            - The current month, in numeric form.
          returned: changed
          type: int
          sample: 6
        second:
          description:
            - The current second of the minute.
          returned: changed
          type: int
          sample: 51
        year:
          description:
            - The current year in 4-digit form.
          returned: changed
          type: int
          sample: 2018
    hardware_information:
      description:
        - Information related to the hardware (drives and CPUs) of the system.
      type: complex
      returned: changed
      contains:
        model:
          description:
            - The model of the hardware.
          type: string
          sample: Virtual Disk
        name:
          description:
            - The name of the hardware.
          type: string
          sample: HD1
        type:
          description:
            - The type of hardware.
          type: string
          sample: physical-disk
        versions:
          description:
            - Hardware specific properties
          type: complex
          contains:
            name:
              description:
                - Name of the property
              type: string
              sample: Size
            version:
              description:
                - Value of the property
              type: string
              sample: 154.00G
    is_admin_password_changed:
      description:
        - Whether the admin password was changed from its default or not.
      returned: changed
      type: bool
      sample: yes
    is_root_password_changed:
      description:
        - Whether the root password was changed from its default or not.
      returned: changed
      type: bool
      sample: no
    is_system_setup:
      description:
        - Whether the system has been setup or not.
      returned: changed
      type: bool
      sample: yes
    package_edition:
      description:
        - Displays the software edition.
      returned: changed
      type: string
      sample: Point Release 7
    package_version:
      description:
        - A string combining the C(product_build) and C(product_build_date).
      type: string
      sample: "Build 0.0.1 - Tue May 15 15:26:30 PDT 2018"
    product_code:
      description:
{'fraction_non_alphanumeric': 0.06995965758142281, 'fraction_numerical': 0.01259470628751353, 'mean_word_length': 1.7256637168141593, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5270307', 'n_tokens_mistral': 2819, 'n_tokens_neox': 2707, 'n_words': 940}