Only apply certain types? #185

Closed
opened 2021-11-20 15:20:59 +00:00 by ungleich-gitea · 7 comments

Created by: toupeira

If you only want to re-apply a specific type on all servers, you have the choice of either doing a full config run (which can take a long time), or using --initial-manifest - to supply a manifest on stdin (which might apply the type on servers that don't define it in the real manifest).

It would be nice if cdist config had something like a --filter TYPE argument which would read the normal manifest, but only apply the given type(s). Not sure how much effort it would be to implement this, especially because of dependencies. If you give me some pointers where to look I'll try poking around the code myself for a bit.

*Created by: toupeira* If you only want to re-apply a specific type on all servers, you have the choice of either doing a full config run (which can take a long time), or using `--initial-manifest -` to supply a manifest on stdin (which might apply the type on servers that don't define it in the real manifest). It would be nice if `cdist config` had something like a `--filter TYPE` argument which would read the normal manifest, but only apply the given type(s). Not sure how much effort it would be to implement this, especially because of dependencies. If you give me some pointers where to look I'll try poking around the code myself for a bit.
ungleich-gitea added the
Stale
label 2021-11-20 15:20:59 +00:00
Author
Owner

closed

closed
Author
Owner

Created by: telmich

I think we will introduce a command line switch for selecting a type that wraps around the initial manifest:

cdist config --to-be-defined "__my_type --with-my-args"

The tagging approach is related, but not the same. With tagging, the dependent types, which are not matched by the selection, would not be executed (useful for install case).

*Created by: telmich* I think we will introduce a command line switch for selecting a type that wraps around the initial manifest: cdist config --to-be-defined "__my_type --with-my-args" The tagging approach is related, but not the same. With tagging, the dependent types, which are not matched by the selection, would not be executed (useful for install case).
Author
Owner

Created by: asteven

I mainly need the tag based approach, but I see the use case for just running certain types.
One open/unsolved question is how to handle dependencies. What if a tagged (or selected based on type) object creates other objects? How are those treated? Should tags be inherited. Same questions/problems also apply to a possible --only-type implementation.

*Created by: asteven* I mainly need the tag based approach, but I see the use case for just running certain types. One open/unsolved question is how to handle dependencies. What if a tagged (or selected based on type) object creates other objects? How are those treated? Should tags be inherited. Same questions/problems also apply to a possible --only-type implementation.
Author
Owner

Created by: toupeira

I guess it can be slightly misleading since any dependent types will necessarily also have to be run, but to me that's fine.

*Created by: toupeira* I guess it can be slightly misleading since any dependent types will necessarily also have to be run, but to me that's fine.
Author
Owner

Created by: telmich

I also think --only-type xyz makes sense.

Markus Koller [Wed, Feb 25, 2015 at 01:42:42AM -0800]:

Interesting, though for it to be usable in the way I'm thinking of, I would
need to add --tag params to pretty much every type call. How about treating
the type name as an implicit default tag, or maybe even add an --only-type
argument?

Something related I've been thinking about is integration with cinv tags,
so I could basically define the "role" a server has through cinv, and then
have a dynamic manifest that will call the relevant types, using further
cinv tags to overwrite cdist params (e.g. SSL certificate names).
On 25 Feb 2015 09:20, "Steven Armstrong" notifications@github.com wrote:

Hi toupeira
I am are working on this. The idea is to give types a way to set tags, and
cdist a way to filter/include/exclude objects based on those tags.
Something like this:

In some manifest

only apply these if cdist is run with tag install

__partition_disk --if-tag install

always apply this

__always_configure

do not apply this when cdist is run with tag install

__do_not_configure_during_install --not-if-tag install

Then when running cdist

only apply objects tagged with install

cdist config --only-tag install localhost

apply untagged objects and those tagged with install

cdist config --include-tag install localhost

apply all objects except those tagged with install

cdist config --exclude-tag install localhost


Reply to this email directly or view it on GitHub
https://github.com/telmich/cdist/issues/379#issuecomment-75922037.


Reply to this email directly or view it on GitHub:
https://github.com/telmich/cdist/issues/379#issuecomment-75931866

New PGP key: 659B 0D91 E86E 7E24 FD15 69D0 C729 21A1 293F 2D24

*Created by: telmich* I also think --only-type xyz makes sense. Markus Koller [Wed, Feb 25, 2015 at 01:42:42AM -0800]: > Interesting, though for it to be usable in the way I'm thinking of, I would > need to add --tag params to pretty much every type call. How about treating > the type name as an implicit default tag, or maybe even add an --only-type > argument? > > Something related I've been thinking about is integration with cinv tags, > so I could basically define the "role" a server has through cinv, and then > have a dynamic manifest that will call the relevant types, using further > cinv tags to overwrite cdist params (e.g. SSL certificate names). > On 25 Feb 2015 09:20, "Steven Armstrong" notifications@github.com wrote: > > > Hi toupeira > > I am are working on this. The idea is to give types a way to set tags, and > > cdist a way to filter/include/exclude objects based on those tags. > > Something like this: > > > > In some manifest > > > > # only apply these if cdist is run with tag install > > > > __partition_disk --if-tag install > > > > # always apply this > > > > __always_configure > > > > # do not apply this when cdist is run with tag install > > > > __do_not_configure_during_install --not-if-tag install > > > > Then when running cdist > > > > # only apply objects tagged with install > > > > cdist config --only-tag install localhost > > > > # apply untagged objects and those tagged with install > > > > cdist config --include-tag install localhost > > > > # apply all objects except those tagged with install > > > > cdist config --exclude-tag install localhost > > > > — > > Reply to this email directly or view it on GitHub > > https://github.com/telmich/cdist/issues/379#issuecomment-75922037. > > --- > > Reply to this email directly or view it on GitHub: > https://github.com/telmich/cdist/issues/379#issuecomment-75931866 ## New PGP key: 659B 0D91 E86E 7E24 FD15 69D0 C729 21A1 293F 2D24
Author
Owner

Created by: toupeira

Interesting, though for it to be usable in the way I'm thinking of, I would
need to add --tag params to pretty much every type call. How about treating
the type name as an implicit default tag, or maybe even add an --only-type
argument?

Something related I've been thinking about is integration with cinv tags,
so I could basically define the "role" a server has through cinv, and then
have a dynamic manifest that will call the relevant types, using further
cinv tags to overwrite cdist params (e.g. SSL certificate names).
On 25 Feb 2015 09:20, "Steven Armstrong" notifications@github.com wrote:

Hi toupeira
I am are working on this. The idea is to give types a way to set tags, and
cdist a way to filter/include/exclude objects based on those tags.
Something like this:

In some manifest

only apply these if cdist is run with tag install

__partition_disk --if-tag install

always apply this

__always_configure

do not apply this when cdist is run with tag install

__do_not_configure_during_install --not-if-tag install

Then when running cdist

only apply objects tagged with install

cdist config --only-tag install localhost

apply untagged objects and those tagged with install

cdist config --include-tag install localhost

apply all objects except those tagged with install

cdist config --exclude-tag install localhost


Reply to this email directly or view it on GitHub
https://github.com/telmich/cdist/issues/379#issuecomment-75922037.

*Created by: toupeira* Interesting, though for it to be usable in the way I'm thinking of, I would need to add --tag params to pretty much every type call. How about treating the type name as an implicit default tag, or maybe even add an --only-type argument? Something related I've been thinking about is integration with cinv tags, so I could basically define the "role" a server has through cinv, and then have a dynamic manifest that will call the relevant types, using further cinv tags to overwrite cdist params (e.g. SSL certificate names). On 25 Feb 2015 09:20, "Steven Armstrong" notifications@github.com wrote: > Hi toupeira > I am are working on this. The idea is to give types a way to set tags, and > cdist a way to filter/include/exclude objects based on those tags. > Something like this: > > In some manifest > > # only apply these if cdist is run with tag install > > __partition_disk --if-tag install > > # always apply this > > __always_configure > > # do not apply this when cdist is run with tag install > > __do_not_configure_during_install --not-if-tag install > > Then when running cdist > > # only apply objects tagged with install > > cdist config --only-tag install localhost > > # apply untagged objects and those tagged with install > > cdist config --include-tag install localhost > > # apply all objects except those tagged with install > > cdist config --exclude-tag install localhost > > — > Reply to this email directly or view it on GitHub > https://github.com/telmich/cdist/issues/379#issuecomment-75922037.
Author
Owner

Created by: asteven

Hi toupeira
I am are working on this. The idea is to give types a way to set tags, and cdist a way to filter/include/exclude objects based on those tags. Something like this:

In some manifest

# only apply these if cdist is run with tag install
__partition_disk --if-tag install
# always apply this
__always_configure
# do not apply this when cdist is run with tag install
__do_not_configure_during_install --not-if-tag install

Then when running cdist

# only apply objects tagged with install
cdist config --only-tag install localhost
# apply untagged objects and those tagged with install
cdist config --include-tag install localhost
# apply all objects except those tagged with install
cdist config --exclude-tag install localhost
*Created by: asteven* Hi toupeira I am are working on this. The idea is to give types a way to set tags, and cdist a way to filter/include/exclude objects based on those tags. Something like this: In some manifest ``` # only apply these if cdist is run with tag install __partition_disk --if-tag install # always apply this __always_configure # do not apply this when cdist is run with tag install __do_not_configure_during_install --not-if-tag install ``` Then when running cdist ``` # only apply objects tagged with install cdist config --only-tag install localhost # apply untagged objects and those tagged with install cdist config --include-tag install localhost # apply all objects except those tagged with install cdist config --exclude-tag install localhost ```
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: ungleich-public/cdist#185
No description provided.