Is there a way to only run one task in ansible playbook?
For example, in roles/hadoop_primary/tasks/hadoop_master.yml
. I have "start hadoop jo
This can be easily done using the tags
The example of tags is defined below:
---
hosts: localhost
tasks:
- name: Creating s3Bucket
s3_bucket:
name: ansiblebucket1234567890
tags:
- createbucket
- name: Simple PUT operation
aws_s3:
bucket: ansiblebucket1234567890
object: /my/desired/key.txt
src: /etc/ansible/myfile.txt
mode: put
tags:
- putfile
- name: Create an empty bucket
aws_s3:
bucket: ansiblebucket12345678901234
mode: create
permission: private
tags:
- emptybucket
to execute the tags we use the command
ansible-playbook creates3bucket.yml --tags "createbucket,putfile"