Monday, March 12, 2018

Ansible "mapping values are not allowed in this context" Error


 When we try to put 2 logic commands into 1 element, like find and copy, we hit below error
The offending line appears to be:

   - name: copy env profile script to the target
      - find:
            ^ here
exception type: <class 'yaml.scanner.ScannerError'>
exception: mapping values are not allowed in this context

The part of related yaml file are
   - name: find and copy  env profile scripts
      - find: 
              paths: /u01/app/ansible/repository
              patterns: 'apex-ext-stg'
        register: file_to_copy
      - copy: src={{ item.path }} dest=/tmp   mode=0775
        with_items: "{{ files_to_copy.files }}" 


"find" and "copy" are 2 different tasks. we need to use block to group them together , or we level it up with "- name"


- name: find and copy  env profile scripts
        - find:
               paths: /u01/app/ansible/repository
               patterns: 'test-ext-stg'
          register: file_to_copy
        - copy: src={{ item.path }} dest=/tmp  mode=0775
          with_items: "{{ files_to_copy.files }}"


- name: find and copy  env profile scripts part1
               paths: /u01/app/ansible/repository
               patterns: 'test-ext-stg'
  register: file_to_copy
- name: find and copy  env profile scripts part2
  copy: src={{ item.path }} dest=/tmp  mode=0775
  with_items: "{{ files_to_copy.files }}"


radha said...

Code works. Keep updating Devops Online Course

Sai Elakiyaa said...

Worth for my valuable time, I am very much satisfied with your blog. Thanks for sharing.

AngularJS Training in Chennai
AWS Training in Chennai
DevOps Training in Chennai
Spoken English Classes in Chennai
Spoken English Class in Chennai

sandeep saxena said...

I like to learn a piece of new information about technology. Im really like your post. Good job.
Struts Training in Chennai
Best Struts Training institute in Chennai
Best Struts Training in Chennai
struts Training in Porur
Wordpress Training in Chennai
Wordpress Training
Spring Training in Chennai
Hibernate Training in Chennai

priya rajesh said...

Excellent blog with unique content, thanks a lot for sharing this. I love to learn more about this topic.
Data Science Training in Chennai
Data Science Certification in Chennai
R Programming Training in Chennai
R analytics Training in Chennai
Machine Learning Training in Chennai
Machine Learning course
Data Science Training in Velachery
Data Science Course in Chennai

Deva Dev said...

Nice Blog thanks for sharing this information...
RPA training in bellandur
RPA training near bellandur
RPA courses in bellandur
RPA courses near bellandur
RPA classes in bellandur
RPA classes near bellandur
AWS training in bellandur
AWS training near bellandur
AWS courses in bellandur
AWS courses near bellandur
AWS classes in bellandur
AWS classes near bellandur

Ajish said...

Nice Post! Thank you for sharing very good post, it was so Nice to read and useful to improve my knowledge as updated one, keep blogging.
ASW training in Electronic City

chandhran said...

It is an excellent blog. Your post is very good and unique.
DevOps Training in Bangalore
DevOps Training in Marathahalli
Best DevOps Training in Marathahalli
DevOps Training Institutes in Marathahalli
DevOps Institute in Marathahalli
DevOps certification in Chennai
DevOps course in Chennai
Best DevOps Training in Chennai
DOT NET Training in Bangalore
PHP Training in Bangalore

Riya Raj said...

It's remarkable. The way you describe the information is awesome. This will really help me out. Thanks for sharing.
VMware Training in Chennai
VMware Course in Chennai
Vmware Training center in Chennai
Vmware Learning
VMware Training
Vmware cloud certification

hrithiksai said...

Very nice blogs!!! i have to learning for lot of information for this sites…Sharing for wonderful information.Thanks for sharing this valuable information to our vision. You have posted a trust worthy blog keep sharing, data science online training

Farhan.Jee said...

As most of the companies are using Python as a basic programming language, there are a lot of job opportunities in Python. Thus online python programming tutorial will be very helpful for your growth in industry. The only need is to select the right course from a right place. data science course in india

B.T said...

List, dictionary and sets are build in data types which allow very high levels of abstraction in a language like python. angular course for beginners

sripadojwar1994 said...

data scientist course in pune with placement was never so easy and adaptable to everyone but here at Excelr We teach you numerous ways of doing Data Science Courses, which are way easy and interesting. Our experienced and expert faculty will help you reach your goal. 100% result oriented strategies are being performed; we offer Data Science Course in pune

data scientist course in pune with placement
Data scientist certification
Data scientist courses

Maneesha said...

It is imperative that we read blog post very carefully. I am already done it and find that this post is really amazing.
data scientist training and placement in hyderabad

Unknown said...

The worst part of it was that the software only worked intermittently and the data was not accurate. You obviously canot confront anyone about what you have discovered if the information is not right. data science course in mysore

360DigiTMG said...

This post is very simple to read and appreciate without leaving any details out. Great work!
data science online training in hyderabad

360DigiTMG said...

This is the first time I visit here. I found such a large number of engaging stuff in your blog, particularly its conversation. From the huge amounts of remarks on your articles, I surmise I am by all accounts not the only one having all the recreation here! Keep doing awesome. It has been important to compose something like this on my site and you have given me a thought.
business analytics course in hyderabad