Answer the question
In order to leave comments, you need to log in
How to perform an action for a single host in ansible-playbook?
Hello colleagues!
And ansible, I'm not a great specialist, so I ask you not to kick hard with your feet.
#cat hosts
[master]
master
[mirror]
mirror
[slaves]
s1
s2
s3
s4
s5
s6
Answer the question
In order to leave comments, you need to log in
So, actually write a playbook
- hosts: master
pre_tasks:
- name: task will run before roles
copy: ...
roles:
- role: master_role
tasks:
- name: task will run after roles
copy: ...
- hosts: mirror
vars:
var_for_mirror_group: 42
roles:
- role: mirror_role
tasks:
- name: task 1
template: ...
- name: task 2
copy: ...
- hosts: slaves
roles:
- role: slaves_role
- hosts: all
roles:
- role: all_together_role
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question