-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
How to change playbook inventory for each custom resource #6439
Comments
This issue was brought up in the community meeting. We would need inputs from the ansible operator folks to get more idea on this. Tagging @everettraven for help in following this up. |
@yhidai Could you elaborate a bit more on what you are attempting to do? It sounds like on reconciliation of a CR you are wanting to:
Does that sound right? |
@varshaprasad96 @everettraven
Yes, that's right.
apiVersion: redis.example.com
kind: Redis
metadata:
name: redis-standalone
spec:
host:
name: redis-standalone
redis:
version: 7.0.10
memory: 16GiB
apiVersion: redis.example.com
kind: Redis
metadata:
name: redis-standalone
spec:
host:
name: redis-standalone
ipAddress: 10.41.0.38
redis:
version: 7.0.10
memory: 16GiB
|
@yhidai Thanks for the elaboration! I'll have to try and get in contact with some folks that have more ansible experience and how this might be possible. |
@yhidai I was able to reach out to some folks offline and this was their recommendation:
Does this give you enough information to try some of the recommendations? Unfortunately I'm not sure when I would have some time to test these recommendations myself The input directory they are referring to is found here:
|
@everettraven Thank you for the detailed information. From the information you gave me, I understood that using Ansible Operator to manage the IaaS resources I was trying to test was an unexpected usage for Ansible Operator. I understand that Ansible Operator is for managing resources on Kubernetes using Ansible playbooks, is that correct? |
Yeah, this is a use case I've personally never seen but that doesn't mean it can't be done - I just don't know how it should be done :)
Yeah, but there shouldn't be anything that is stopping you from being able to do what you are attempting to do. An additional thing you could try that I didn't think of until now is using a second custom resource for when the VM is created to trigger the redis configuration playbook. So you would have a CR that triggers a playbook to create the VM on your IaaS provider and create a CR that triggers a playbook to configure Redis using the information on that CR |
@everettraven Thank you very much for your kind reply. After learning more about Ansible Operator and Operator SDK functions, I will try it based on the information you gave me. |
Just to follow up on this because I got another recommendation from one of the original authors of the ansible plugin:
|
@yhidai As you mentioned earlier,, Do you have the best practices for running custome ansible playbooks with Ansible Operator? I want to use it for installing k8s and other components. |
@Goend Sorry, I haven't tried the advice given in this issue yet. |
Type of question
Best practices
How to implement a specific feature
Question
What did you do?
I am trying to create an operator with Ansible Operator.
I'm trying to define Redis information in a custom resource, create a VM with an IaaS provider based on that data, and set up Redis.
What did you expect to see?
I would like to change the host that runs Ansible playbooks for each custom resource processed by the reconcile loop.
Is there such functionality in Ansible Operator?
What did you see instead? Under which circumstances?
Environment
Operator type:
/language ansible
Kubernetes cluster type:
vanilla
$ operator-sdk version
$ kubectl version
Additional context
The text was updated successfully, but these errors were encountered: