Is there an ansible strategy that takes host groups into account?

Viewed 162

We use an inventory file and ansible. We have many micro services and sometimes we have different instances for internal and external use. AFAIK, the builtin ansible strategies (free, host_pinned, serial) ignore the groups. Is there a strategy that works like host_pinned but on a per group basis?

Example inventory:

[my-service-external]
my-external-hosts[01:57].example.com

[my-service-internal]
my-internal-hosts[1:3].example.com

[my-service:children]
my-service-external
my-service-internal

Example playbook.yml:

---
- name: ping
  hosts: my-service
  strategy: host_pinned
  serial:
    - 1
    - "30%"
  tasks:
    - name: ping
      ansible.builtin.ping: 

If this playbook would do something that would actually impact the service, like restarting some application server, all internal hosts would go down at pretty much the same time and possibly cause an outage.

0 Answers
Related