playboook syntax?

I still have some problems with the yaml syntax, or something is broken in the parsing (which seems less likely).

[root@se1ts00x andreasda]# ansible-playbook playbook-tc2-resolver.yaml -k
SSH password:
Traceback (most recent call last):
  File "/usr/bin/ansible-playbook", line 100, in <module>
    sys.exit(main(sys.argv[1:]))
  File "/usr/bin/ansible-playbook", line 77, in main
    sudo_pass=sudopass
  File "/usr/lib/python2.6/site-packages/ansible/playbook.py", line 104, in __init__
    self.playbook = self._parse_playbook(playbook)
  File "/usr/lib/python2.6/site-packages/ansible/playbook.py", line 182, in _parse_playbook
    playbook = utils.parse_yaml_from_file(playbook)
  File "/usr/lib/python2.6/site-packages/ansible/utils.py", line 265, in parse_yaml_from_file
    return parse_yaml(data)
  File "/usr/lib/python2.6/site-packages/ansible/utils.py", line 258, in parse_yaml
    return yaml.load(data)
  File "/usr/lib64/python2.6/site-packages/yaml/__init__.py", line 58, in load
    return loader.get_single_data()
  File "/usr/lib64/python2.6/site-packages/yaml/constructor.py", line 42, in get_single_data
    node = self.get_single_node()
  File "/usr/lib64/python2.6/site-packages/yaml/composer.py", line 36, in get_single_node
    document = self.compose_document()
  File "/usr/lib64/python2.6/site-packages/yaml/composer.py", line 55, in compose_document
    node = self.compose_node(None, None)
  File "/usr/lib64/python2.6/site-packages/yaml/composer.py", line 82, in compose_node
    node = self.compose_sequence_node(anchor)
  File "/usr/lib64/python2.6/site-packages/yaml/composer.py", line 111, in compose_sequence_node
    node.value.append(self.compose_node(node, index))
  File "/usr/lib64/python2.6/site-packages/yaml/composer.py", line 84, in compose_node
    node = self.compose_mapping_node(anchor)
  File "/usr/lib64/python2.6/site-packages/yaml/composer.py", line 133, in compose_mapping_node
    item_value = self.compose_node(node, item_key)
  File "/usr/lib64/python2.6/site-packages/yaml/composer.py", line 82, in compose_node
    node = self.compose_sequence_node(anchor)
  File "/usr/lib64/python2.6/site-packages/yaml/composer.py", line 110, in compose_sequence_node
    while not self.check_event(SequenceEndEvent):
  File "/usr/lib64/python2.6/site-packages/yaml/parser.py", line 93, in check_event
    self.current_event = self.state()
  File "/usr/lib64/python2.6/site-packages/yaml/parser.py", line 398, in parse_indentless_sequence_entry
    if self.check_token(BlockEntryToken):
  File "/usr/lib64/python2.6/site-packages/yaml/scanner.py", line 116, in check_token
    self.fetch_more_tokens()
  File "/usr/lib64/python2.6/site-packages/yaml/scanner.py", line 220, in fetch_more_tokens
    return self.fetch_value()
  File "/usr/lib64/python2.6/site-packages/yaml/scanner.py", line 580, in fetch_value
    self.get_mark())
yaml.scanner.ScannerError: mapping values are not allowed here
  in "<string>", line 6, column 11:
        action: template src=/root/andreasda/r ...
              ^
[root@se1ts00x andreasda]# cat playbook-tc2-resolver.yaml

Hi,

the error message is a bit misleading, your error is actually on line 5,
you missed a “:” after the “name” attribute. Here is the corrected version
of your yaml:

Many thanks! I have been staring at that yaml example on the gihub page and still I did not see that missing colon.

Oddly, I get these errors, even though the templating works just fine, since I can see it when I run "ansible -m command -a 'ls -l /tmp/resolv.conf'".

failed: [frostdw01.tc2] => copy src=/var/tmp/ansible.jWg694/source dest=/tmp/resolv.conf => {"changed": true, "failed": true, "md5sum": "42f278b0052ab986d21f12a1b2b5f7a5", "msg": "", "parsed": false}

stderr: [frostdw01.tc2] => Traceback (most recent call last):

  File "/var/tmp/ansible.jWg694/file", line 294, in ?

    changed = set_context_if_different(path, secontext, changed)

  File "/var/tmp/ansible.jWg694/file", line 182, in set_context_if_different

    debug("current secontext is %s" % ':'.join(cur_context))

TypeError: sequence item 0: expected string, NoneType found

The debug line should definitely be removed then.

This is 0.3 or 0.4 (devel)?

–Michael

That is 0.3.1 which I guess mean I should try 0.4 to see if it differ. I will update as soon as the new rpm is ouyt, since this is on a RHEL 6 machine. (Yeah, I have way too many differing machines in my server park...)

-andreas

Ah, I had a git clone on that machine already. Yes, 0.4 works fine.

-andreas