CentOS 7.x Running an ansible task only once
From Notes_Wiki
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