Open jobcespedes opened 3 years ago
Issues go stale after 90d of inactivity.
Mark the issue as fresh by commenting /remove-lifecycle stale
.
Stale issues rot after an additional 30d of inactivity and eventually close.
Exclude this issue from closing by commenting /lifecycle frozen
.
If this issue is safe to close now please do so with /close
.
/lifecycle stale
Stale issues rot after 30d of inactivity.
Mark the issue as fresh by commenting /remove-lifecycle rotten
.
Rotten issues close after an additional 30d of inactivity.
Exclude this issue from closing by commenting /lifecycle frozen
.
If this issue is safe to close now please do so with /close
.
/lifecycle rotten /remove-lifecycle stale
/lifecycle frozen
@jobcespedes: The label(s) language/ansible
cannot be applied, because the repository doesn't have them.
Feature Request
Dynamic inventory of resources created by a CR of an ansible operator
Describe the problem you need a feature to resolve.
Operating or running ansible tasks over pods generated by a CR of an ansible operator is kind of cumbersome. One could use kubectl connection plugin and add them dynamically during each reconciliation loop using variables. The existing dynamic k8s inventory plugin could be a better fit. However, adding it to an ansible operator requires some steps. In addition, when done, it shows all the pods and services the operator has access and groups them in a way, in my opinion, not intuitive for the operator scope. They could not be filter, for instance.
Describe the solution you'd like.
The operator sdk to already include a dynamic inventory plugin that groups and adds only the pods, and optionally other kind of resources, of the CR the reconciliation loop is running. I would like to run some complementary ansible tasks over some of those pods. How it groups them should be intuitive in order to reference hosts, or groups more probably, in playbooks inside the operator. For instance: the name of a default group of all pods of a CR could be used as:
hosts: {{ ansible_operator_meta.namespace }}__{{ ansible_operator_meta.namespace }}__pods
. In addition, it would be helpful to define custom group formats using labels and add extra ansible variables using annotations. The following example shows: a posible pod definition for it to be considered as part of a CR inventory, to define a custom group membership and extra ansible variables:The custom CR could be:
However, it could complement k8s where some functionality is lacking or to add some logic to an operator.
/language ansible