Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tags parameter to packet_device #418

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
minor_changes:
- packet_device - add ``tags`` parameter on device creation (https://github.com/ansible-collections/community.general/pull/418)
11 changes: 11 additions & 0 deletions plugins/modules/cloud/packet/packet_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@
description:
- List of device IDs on which to operate.

tags:
description:
- List of device tags.
- Currently implemented only for device creation.
type: list
elements: str

facility:
description:
- Facility slug for device creation. See Packet API for current list - U(https://www.packet.net/developers/api/facilities/).
Expand Down Expand Up @@ -137,6 +144,7 @@
- packet_device:
project_id: 89b497ee-5afc-420a-8fb5-56984898f4df
hostnames: myserver
tags: ci-xyz
operating_system: ubuntu_16_04
plan: baremetal_0
facility: sjc1
Expand Down Expand Up @@ -432,6 +440,7 @@ def create_single_device(module, packet_conn, hostname):
% param)
project_id = module.params.get('project_id')
plan = module.params.get('plan')
tags = module.params.get('tags')
user_data = module.params.get('user_data')
facility = module.params.get('facility')
operating_system = module.params.get('operating_system')
Expand All @@ -446,6 +455,7 @@ def create_single_device(module, packet_conn, hostname):
device = packet_conn.create_device(
project_id=project_id,
hostname=hostname,
tags=tags,
plan=plan,
facility=facility,
operating_system=operating_system,
Expand Down Expand Up @@ -594,6 +604,7 @@ def main():
facility=dict(),
features=dict(type='dict'),
hostnames=dict(type='list', aliases=['name']),
tags=dict(type='list', elements='str'),
locked=dict(type='bool', default=False, aliases=['lock']),
operating_system=dict(),
plan=dict(),
Expand Down