Difference between revisions of "CentOS 7.x Running an ansible task only once"
From Notes_Wiki
(Created page with "<yambe:breadcrumb>CentOS_7.x_ansible_tips_and_tricks|CentOS 7.x ansible tips and tricks</yambe:breadcrumb> =CentOS 7.x Running an ansible task only once= ==Running a task onl...") |
m |
||
Line 1: | Line 1: | ||
[[Main Page|Home]] > [[CentOS]] > [[CentOS 7.x]] > [[CentOS 7.x DevOps|DevOps]] > [[CentOS 7.x automated configuration|Automated Configuration]] > [[CentOS 7.x ansible|Ansible]] > [[CentOS 7.x ansible tips and tricks]] > [[CentOS 7.x Running an ansible task only once]] | |||
==Running a task only once per run== | ==Running a task only once per run== | ||
Line 22: | Line 21: | ||
[[Main Page|Home]] > [[CentOS]] > [[CentOS 7.x]] > [[CentOS 7.x DevOps|DevOps]] > [[CentOS 7.x automated configuration|Automated Configuration]] > [[CentOS 7.x ansible|Ansible]] > [[CentOS 7.x ansible tips and tricks]] > [[CentOS 7.x Running an ansible task only once]] |
Latest revision as of 15:33, 28 August 2022
Home > CentOS > CentOS 7.x > DevOps > Automated Configuration > Ansible > CentOS 7.x ansible tips and tricks > CentOS 7.x Running an ansible task only once
Running a task only once per run
To run task only once per playbook run (ie not again and again for every host), use:
run_once: true
Running a task only once even among re-run of the same playbook
To run task only once even if playbook is re-run use creates option of shell module such as:
shell: <thing to be done only once>; touch /root/thing_done args: creates: /root/thing_done
Refer http://stackoverflow.com/questions/26409164/ansible-ignore-the-run-once-configuration-on-task
Home > CentOS > CentOS 7.x > DevOps > Automated Configuration > Ansible > CentOS 7.x ansible tips and tricks > CentOS 7.x Running an ansible task only once