You're running afoul of class containment or more precisely the lack
thereof. Covered here
https://puppet.com/blog/class-containment-puppet/
You can swap 'include ipvsadm::config' for 'contain ipvsadm::config'
though you may need more contain statements. If they are third party
modules you'd prefer not to modify, you can create more specific order
between the modules in your profile. something like this might work.
Class['ipvsadm::config'] -> Class['ipvs_keepalived::service']
I'm not a huge fan of creating relationships between components of
modules, but sometimes that's the best way forward.
Watch the use of contain. It can be easy to create dependency cycles
particularly if you're using resources from systemd and yum in your modules.
Ramin
On 11/26/2019 11:33 AM, Abhijeet Rastogi wrote:
> Hi Puppet users,
>
> I have the following code and all resources inside class ipvsadm are not
> executed before all resources in class ipvs_keepalived.
>
> class profile::ipvs {
> # Removed other classes for readability
> include '::ipvs_keepalived'
> include '::ipvsadm'
>
> # Need ipvsadm kernel module changes before keepalived loads the
> ip_vs module
> Class['::ipvsadm'] -> Class['::ipvs_keepalived']
> }
>
>
> But, below is my puppet run log in debug mode, column 1 being the line
> number.
>
> 556445 Debug: Adding relationship fromClass[Ipvsadm] toClass[Ipvs_keepalived] with'before'
> ...
> 556633 Notice: /Stage[main]/Ipvs_keepalived::Service/Service[keepalived]/ensure: ensure changed'stopped' to'running'
>
> ...
> 556776 Notice: /Stage[main]/Ipvsadm::Config/File[/etc/modprobe.d/ipvs.conf]/ensure: defined content as'{md5}eccf22fd99f92d076e2c7b74cff506d1'
>
>
> We can see that even though the resource order was processed in puppet
> run, Ipvs_keepalived::Service decides to execute before Ipvsadm::Config.
>
> I think there's something fundamentally wrong in my approach, will
> appreciate the help.
>
> Thanks,
> Abhijeet
>
> --
> You received this message because you are subscribed to the Google
> Groups "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to
puppet-users...@googlegroups.com
> <mailto:
puppet-users...@googlegroups.com>.
> To view this discussion on the web visit
>
https://groups.google.com/d/msgid/puppet-users/53fbade6-10f5-4973-931a-17bc40be7d50%40googlegroups.com
> <
https://groups.google.com/d/msgid/puppet-users/53fbade6-10f5-4973-931a-17bc40be7d50%40googlegroups.com?utm_medium=email&utm_source=footer>.