label 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. # flake8: noqa
  2. # pylint: skip-file
  3. DOCUMENTATION = '''
  4. ---
  5. module: oc_label
  6. short_description: Create, modify, and idempotently manage openshift labels.
  7. description:
  8. - Modify openshift labels programmatically.
  9. options:
  10. state:
  11. description:
  12. - State controls the action that will be taken with resource
  13. - 'present' will create or update and object to the desired state
  14. - 'absent' will ensure certain labels are removed
  15. - 'list' will read the labels
  16. - 'add' will insert labels to the already existing labels
  17. default: present
  18. choices: ["present", "absent", "list", "add"]
  19. aliases: []
  20. kubeconfig:
  21. description:
  22. - The path for the kubeconfig file to use for authentication
  23. required: false
  24. default: /etc/origin/master/admin.kubeconfig
  25. aliases: []
  26. debug:
  27. description:
  28. - Turn on debug output.
  29. required: false
  30. default: False
  31. aliases: []
  32. kind:
  33. description:
  34. - The kind of object that can be managed.
  35. default: node
  36. choices:
  37. - node
  38. - pod
  39. - namespace
  40. aliases: []
  41. labels:
  42. description:
  43. - A list of labels for the resource.
  44. - Each list consists of a key and a value.
  45. - eg, {'key': 'foo', 'value': 'bar'}
  46. required: false
  47. default: None
  48. aliases: []
  49. selector:
  50. description:
  51. - The selector to apply to the resource query
  52. required: false
  53. default: None
  54. aliases: []
  55. author:
  56. - "Joel Diaz <jdiaz@redhat.com>"
  57. extends_documentation_fragment: []
  58. '''
  59. EXAMPLES = '''
  60. - name: Add a single label to a node's existing labels
  61. oc_label:
  62. name: ip-172-31-5-23.ec2.internal
  63. state: add
  64. kind: node
  65. labels:
  66. - key: logging-infra-fluentd
  67. value: 'true'
  68. - name: remove a label from a node
  69. oc_label:
  70. name: ip-172-31-5-23.ec2.internal
  71. state: absent
  72. kind: node
  73. labels:
  74. - key: color
  75. value: blue
  76. - name: Ensure node has these exact labels
  77. oc_label:
  78. name: ip-172-31-5-23.ec2.internal
  79. state: present
  80. kind: node
  81. labels:
  82. - key: color
  83. value: green
  84. - key: type
  85. value: master
  86. - key: environment
  87. value: production
  88. '''