Phpansible/Phpansible — pull request #22 by fabiorphp (2014-02-02 15:07:29+00:00)
Title: Yaml parser

In tests with Yaml parser, I used Symfony\Yaml and Yaml (Pecl).

The Yaml (Pecl) was the best for do it, because the format generated is more like the Ansible playbook.yml, unlike the Symfony\Yaml.

Look the tests and results:

yaml.php
```php
'Nginx - Install Webserver',
'action' => 'pkg=nginx state=installed',
),
array(
'name' => 'Nginx - Create host folder',
'file' => 'path={{ document_root }} state=directory'
),
array(
'name' => 'Nginx - Configure Host',
'template' => 'src=files/nginx.conf dest={{ nginx_folder }}/sites-available/{{ server_name }}'
),
array(
'name' => 'Nginx - Applying configuration',
'command' => 'ls -s {{ nginx_folder }}/sites-available'
)
);
// Symfony\Yaml
print_r($dumper->dump($yaml));

// Yaml (Pecl)
print_r(yaml_emit($yaml));
```

Results:
```
// Symfony\Yaml
[{ name: 'Nginx - Install Webserver', action: 'pkg=nginx state=installed' }, { name: 'Nginx - Create host folder', file: 'path={{ document_root }} state=directory' }, { name: 'Nginx - Configure Host', template: 'src=files/nginx.conf dest={{ nginx_folder }}/sites-available/{{ server_name }}' }, { name: 'Nginx - Applying configuration', command: 'ls -s {{ nginx_folder }}/sites-available' }]

// Yaml (Pecl)
---
- name: Nginx - Install Webserver
action: pkg=nginx state=installed
- name: Nginx - Create host folder
file: path={{ document_root }} state=directory
- name: Nginx - Configure Host
template: src=files/nginx.conf dest={{ nginx_folder }}/sites-available/{{ server_name
}}
- name: Nginx - Applying configuration
command: ls -s {{ nginx_folder }}/sites-available
...
```

In this case, I propose that we should use YAML (Pecl).