f5os_restconf_post
Short Description: POST to resources of the F5OS RESTCONF API.
Description:
- POST/Write to resources of the F5OS RESTCONF API.
Author: Simon Kowallik (@simonkowallik)
Version Added: 1.3.0
Options
| Option | Description | Required | Type | Default / Choices | 
|---|---|---|---|---|
| uri | The URI of the resource to write to. | true | str | |
| config | The desired configuration to apply to the resource (PATCH) or to replace the resource with (PUT). | false | dict | |
| secrets | A list of secrets to redact from the output. Any value in this list will be redacted with ‘VALUE_SPECIFIED_IN_NO_LOG_PARAMETER’. | false | list | 
Attributes
| Attribute | Support | Description | 
|---|---|---|
| check_mode | none | The module does not support check mode. | 
| diff_mode | none | The module does not support diff mode. | 
Notes
- This module requires the f5networks.f5os collection to be installed on the ansible controller.
- This module uses the httpapi of the f5networks.f5os collection.
Return Values
| Key | Description | Returned | Type | Elements | 
|---|---|---|---|---|
| api_response | The API response received from the F5OS RESTCONF API. | always | dict | 
Examples
- name: 'Update user password'
  vars:
    f5os_api_prefix: "{{ '/restconf' if ansible_httpapi_port == '8888' else '/api' }}"
    f5os_username: admin
    f5os_password: "{{ lookup('env', 'F5OS_PASSWORD') }}"
  block:
    - name: 'Set user password'
      f5_ps_ansible.f5os.f5os_restconf_post:
        uri: '{{ f5os_api_prefix }}/data/openconfig-system:system/aaa/authentication/f5-system-aaa:users/f5-system-aaa:user={{ f5os_username }}/config/f5-system-aaa:set-password'
        config:
          f5-system-aaa:password: "{{ f5os_password }}"
        secrets:
          - "{{ f5os_password }}"
    - name: 'Get ansible_date_time variable'
      ansible.builtin.setup:
        gather_subset: [min]
    - name: 'Set last changed - prevents prompting to change password on next login'
      f5_ps_ansible.f5os.f5os_restconf_config:
        uri: '{{ f5os_api_prefix }}/data/openconfig-system:system/aaa/authentication/f5-system-aaa:users/f5-system-aaa:user={{ f5os_username }}/config'
        method: PATCH
        config:
          f5-system-aaa:config:
            last-change: "{{ ansible_date_time.date }}"
        config_query: |-
          "f5-system-aaa:config"."last-change" | { "f5-system-aaa:config": { "last-change": @ } }