W3cubDocs

/Ansible

oc - Manage OpenShift Resources

New in version 2.4.

Synopsis

  • T
  • h
  • i
  • s
  • m
  • o
  • d
  • u
  • l
  • e
  • a
  • l
  • l
  • o
  • w
  • s
  • m
  • a
  • n
  • a
  • g
  • e
  • m
  • e
  • n
  • t
  • o
  • f
  • r
  • e
  • s
  • o
  • u
  • r
  • c
  • e
  • s
  • i
  • n
  • a
  • n
  • O
  • p
  • e
  • n
  • S
  • h
  • i
  • f
  • t
  • c
  • l
  • u
  • s
  • t
  • e
  • r
  • .
  • T
  • h
  • e
  • i
  • n
  • v
  • e
  • n
  • t
  • o
  • r
  • y
  • h
  • o
  • s
  • t
  • c
  • a
  • n
  • b
  • e
  • a
  • n
  • y
  • h
  • o
  • s
  • t
  • w
  • i
  • t
  • h
  • n
  • e
  • t
  • w
  • o
  • r
  • k
  • c
  • o
  • n
  • n
  • e
  • c
  • t
  • i
  • v
  • i
  • t
  • y
  • t
  • o
  • t
  • h
  • e
  • O
  • p
  • e
  • n
  • S
  • h
  • i
  • f
  • t
  • c
  • l
  • u
  • s
  • t
  • e
  • r
  • ;
  • t
  • h
  • e
  • d
  • e
  • f
  • a
  • u
  • l
  • t
  • p
  • o
  • r
  • t
  • b
  • e
  • i
  • n
  • g
  • 8
  • 4
  • 4
  • 3
  • /
  • T
  • C
  • P
  • .
  • T
  • h
  • i
  • s
  • m
  • o
  • d
  • u
  • l
  • e
  • r
  • e
  • l
  • i
  • e
  • s
  • o
  • n
  • a
  • t
  • o
  • k
  • e
  • n
  • t
  • o
  • a
  • u
  • t
  • h
  • e
  • n
  • t
  • i
  • c
  • a
  • t
  • e
  • t
  • o
  • O
  • p
  • e
  • n
  • S
  • h
  • i
  • f
  • t
  • .
  • T
  • h
  • i
  • s
  • c
  • a
  • n
  • e
  • i
  • t
  • h
  • e
  • r
  • b
  • e
  • a
  • u
  • s
  • e
  • r
  • o
  • r
  • a
  • s
  • e
  • r
  • v
  • i
  • c
  • e
  • a
  • c
  • c
  • o
  • u
  • n
  • t
  • .
  • F
  • o
  • r
  • e
  • x
  • a
  • m
  • p
  • l
  • e
  • :
  • $
  • o
  • c
  • c
  • r
  • e
  • a
  • t
  • e
  • s
  • e
  • r
  • v
  • i
  • c
  • e
  • a
  • c
  • c
  • o
  • u
  • n
  • t
  • a
  • n
  • s
  • i
  • b
  • l
  • e
  • s
  • a
  • $
  • o
  • a
  • d
  • m
  • p
  • o
  • l
  • i
  • c
  • y
  • a
  • d
  • d
  • c
  • l
  • u
  • s
  • t
  • e
  • r
  • r
  • o
  • l
  • e
  • t
  • o
  • u
  • s
  • e
  • r
  • c
  • l
  • u
  • s
  • t
  • e
  • r
  • a
  • d
  • m
  • i
  • n
  • s
  • y
  • s
  • t
  • e
  • m
  • :
  • s
  • e
  • r
  • v
  • i
  • c
  • e
  • a
  • c
  • c
  • o
  • u
  • n
  • t
  • :
  • d
  • e
  • f
  • a
  • u
  • l
  • t
  • :
  • a
  • n
  • s
  • i
  • b
  • l
  • e
  • s
  • a

Options

parameter required default choices comments
host
no 127.0.0.1
Hostname or address of the OpenShift API endpoint. By default, this is expected to be the current inventory host.
inline
no
The inline definition of the resource. This is mutually exclusive with name, namespace and kind.
kind
yes
The kind of the resource upon which to take action.
name
no
The name of the resource on which to take action.
namespace
no
The namespace of the resource upon which to take action.
port
no 8443
The port number of the API endpoint.
state
yes
  • present
  • absent
If the state is present, and the resource doesn't exist, it shall be created using the inline definition. If the state is present and the resource exists, the definition will be updated, again using an inline definition. If the state is absent, the resource will be deleted if it exists.
token
yes
The token with which to authenticate agains the OpenShift cluster.

Examples

- name: Create project
  oc:
    state: present
    inline:
      kind: ProjectRequest
      metadata:
        name: ansibletestproject
      displayName: Ansible Test Project
      description: This project was created using Ansible
    token: << redacted >>

- name: Delete a service
  oc:
    state: absent
    name: myservice
    namespace: mynamespace
    kind: Service
    token: << redacted >>

- name: Add project role Admin to a user
  oc:
    state: present
    inline:
      kind: RoleBinding
      metadata:
        name: admin
        namespace: mynamespace
      roleRef:
        name: admin
      userNames:
        - "myuser"
      token: << redacted >>

- name: Obtain an object definition
  oc:
   state: present
   name: myroute
   namespace: mynamespace
   kind: Route
   token: << redacted >>

Return Values

Common return values are documented here Return Values, the following are the fields unique to this module:

name description returned type sample
url
The URL to the requested resource.
success string
result
The resource that was created, changed, or otherwise determined to be present. In the case of a deletion, this is the response from the delete request.
success string
method
The HTTP method that was used to take action upon the resource
success string

Status

This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.

For help in developing on modules, should you be so inclined, please read Community Information & Contributing, Testing Ansible and Developing Modules.

© 2012–2017 Michael DeHaan
© 2017 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/oc_module.html