A
A
ajeysilver2022-03-31 10:45:26
Ansible
ajeysilver, 2022-03-31 10:45:26

How to differentiate execution of ansible roles for different hosts?

Good afternoon! There is one playbook that runs two roles.
The first role - should be executed only on host 1 and host 2 and not touch host 3.
The second role - only on host 3 and not touch 1 and 2.

Can this be implemented within one playbook without splitting it?

PS. The playbook is launched from jenkins.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
mureevms, 2022-03-31
@mureevms

- name: For host1 and host2
  hosts: host1,host2
  roles:
    - role1
    - role2
    - role3

- name: For host3
  hosts: host3
  roles:
    - role2
    - role4

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question