Ansible task to create service object using inline definition

0 votes
Can you help me write an Ansible task to create a service object from an inline definition? Thank you
Jun 11 in Ansible by Travis
68 views

1 answer to this question.

0 votes

You can use the k8s module for this purpose. It helps manage all k8s objects. Have a look at this example:

- name: Create service object from an inline definition
  k8s:
    state: present
    definition:
      apiVersion: v1
      kind: Service
      metadata:
        name: webpage
        namespace: testing
        labels:
          app: galaxy
          service: webpage
      spec:
        selector:
          app: galaxy
          service: webpage
        ports:
        - protocol: TCP
          targetPort: 8000
          name: port-8000-tcp
          port: 8000
answered Jun 11 by Tanya

Related Questions In Ansible

0 votes
1 answer

devops , how to create user using ansible playbook

root doesn't need a password to switch ...READ MORE

answered Jul 16, 2018 in Ansible by Kalgi
• 2,620 points
122 views
0 votes
1 answer

How can I create a new user using ansible ploybook?

You're switching from the root user. Root ...READ MORE

answered Mar 29, 2018 in Ansible by DareDev
• 6,810 points
122 views
+13 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 26, 2018 in DevOps & Agile by DragonLord999
• 8,380 points
180 views
0 votes
1 answer
0 votes
1 answer
0 votes
2 answers

How to create MySQL tables using Ansible?

--- - hosts: dbserver   tasks:    - name: create a table ...READ MORE

answered Mar 19 in Ansible by Ankit Tyagi
1,059 views