|
30 | 30 | description:
|
31 | 31 | - Queries Netbox via its API to return virtually any information
|
32 | 32 | capable of being held in Netbox.
|
33 |
| - - While secrets can be queried, the plugin doesn't yet support |
34 |
| - decrypting them. |
| 33 | + - If wanting to obtain the plaintext attribute of a secret, key_file must be provided. |
35 | 34 | options:
|
36 | 35 | _terms:
|
37 | 36 | description:
|
|
49 | 48 | description:
|
50 | 49 | - The API token created through Netbox
|
51 | 50 | required: True
|
| 51 | + key_file: |
| 52 | + description: |
| 53 | + - The location of the private key tied to user account. |
| 54 | + required: False |
52 | 55 | requirements:
|
53 | 56 | - pynetbox
|
54 | 57 | """
|
|
78 | 81 | api_endpoint='http://localhost/',
|
79 | 82 | api_filter='role=management tag=Dell'),
|
80 | 83 | token='<redacted>') }}"
|
| 84 | +
|
| 85 | +# Obtain a secret for R1-device |
| 86 | +tasks: |
| 87 | + - name: "Obtain secrets for R1-Device" |
| 88 | + debug: |
| 89 | + msg: "{{ query('netbox', 'secrets', api_filter='device=R1-Device', api_endpoint='http://localhost/', token='<redacted>', key_file='~/.ssh/id_rsa') }}" |
81 | 90 | """
|
82 | 91 |
|
83 | 92 | RETURN = """
|
@@ -149,9 +158,6 @@ def get_endpoint(netbox, term):
|
149 | 158 | "rirs": {"endpoint": netbox.ipam.rirs},
|
150 | 159 | "roles": {"endpoint": netbox.ipam.roles},
|
151 | 160 | "secret-roles": {"endpoint": netbox.secrets.secret_roles},
|
152 |
| - # Note: Currently unable to decrypt secrets as key wizardry needs to |
153 |
| - # take place first but term will return unencrypted elements of secrets |
154 |
| - # i.e. that they exist etc. |
155 | 161 | "secrets": {"endpoint": netbox.secrets.secrets},
|
156 | 162 | "services": {"endpoint": netbox.ipam.services},
|
157 | 163 | "sites": {"endpoint": netbox.dcim.sites},
|
|
0 commit comments