Rosa-Luxemburgstiftung-Berlin / ansible-opnsense

Ansible role to configure OPNsense firewalls
18 stars 8 forks source link

Partial playbook execution not working: dhcp #57

Closed rvalle closed 9 months ago

rvalle commented 9 months ago

I am attempting to use tags to update my router partially.

the actual use case I am using is update only dhcp entries.

For some reason fetch is not working, although I can see that there is an always tag. I works only if I explicitly include the "fetch" tag. I am not sure what the reason is, but it could be that the always applies only to the include-tasks, and the tasks inside are all "fetch" only.

Then there is the application and reload, I think they also need the always tag. when: config.changed will not be processed unless the task is selected by tags first, I think.

Partial execution would be a nice to have feature as configuration of the router keeps growing. would provide more agility while building the router configuration.

rvalle commented 9 months ago

it may also help to use a block for the last set of tasks: clean, copy, upload, reload.... all should be processed always when the config has changed, etc.

zerwes commented 9 months ago

Hello @rvalle We use selective runs using tags to. Our fetch method is a little bit different (see https://github.com/Rosa-Luxemburgstiftung-Berlin/ansible-opnsense-playbook)

I'll have a look at the fetch issue and be back soon ...

The block hint has to be considered in #12

rvalle commented 9 months ago

I see @zerwes

in your setup you do an tagged import role, while in the vanilla role it is an include_tasks. Perhaps they behave differently. I think they have to be applied always instead of fetch.

Yes, finer grain handlers would be a great tool too.

I think these features will make a difference during configuration work on the firewalls, making it more agile.

zerwes commented 9 months ago

well, by enforcing the tag inheritance for the always tag on the included task, the fetch task is now implicit invoked, except it is explicitly excluded by adding fetch or alwaysto --skip-tags hope this helps

zerwes commented 9 months ago

@rvalle I just took the chance and implemented a dhcp handler for #12 on the branch issue-12-dhcp-handler would you mind testing this?

zerwes commented 9 months ago

58 works for me ...

just using ansible-playbook -t dhcp,copy ... will bypass the big reload and leave you with the right dhcp config in /var/dhcpd//etc/dhcpd.conf and a reloaded service ... can you approve this?

rvalle commented 9 months ago

thanks!!!