Ansible blockinfile 错误
Ansible blockinfile error
我正在尝试使用 blockinfile,所以我正在做一些测试。
我有下一个任务,但它给我一个语法错误。
- name: Prueba
blockinfile:
dest: /opt/a
block: | pruebaa
pruebaaa
这是我遇到的错误:
ERROR! Syntax Error while loading YAML.
The error appears to have been in '/home/ikerlan/ansiblePlaybooks/hadoop-Ansible/roles/comun/tasks/main.yml': line 39, column 12, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
dest: /opt/a
block: | pruebaa
^ here
我的完整main.yml是下一个
#NAMENODES
#Los siguientes comandos solo se ejecutaran en los namenodes
- name: Archivo de configuracion zoo.cfg
template: src=zoo.cfg.j2 dest=/opt/zookeeper-3.4.7/conf/zoo.cfg
- name: Prueba
blockinfile:
dest: /opt/a
block: | pruebaa
pruebaaa
- name: Crear carpeta ZooData
file: path=/opt/ZooData state=directory mode=0755
#command: mkdir -p /opt/ZooData/ creates=/opt/ZooData/
- name: Permisos ZooData
command: chown vagrant /opt/ZooData/
- name: Crear carpeta name
file: path=/hdfs/name state=directory mode=0755
#command: mkdir -p /hdfs/name/ creates=/hdfs/name/
- name: Permisos hdfs/name
command: chown vagrant /hdfs/name/
- name: Crear carpeta journalnode
file: path=/hdfs/journalnode state=directory mode=0755
#command: mkdir -p /hdfs/journalnode/ creates=/hdfs/journalnode/
- name: Permisos hdfs/journalnode
command: chown vagrant /hdfs/journalnode/
- name: Archivo de configuracion slaves
template: src=slaves.j2 dest=/opt/hadoop-2.7.1/etc/hadoop/slaves
任何帮助都会很棒。谢谢
我想 |
字符后应该有一个换行符。此外,剧本(或一般的 YAML 文件)必须以 ---
.
开头
我没有 ansible 2.0 来测试这个。在 块之后不能有任何字符:| 试试这个:
blockinfile:
dest: /opt/a
block: |
pruebaa
pruebaaa
我正在尝试使用 blockinfile,所以我正在做一些测试。 我有下一个任务,但它给我一个语法错误。
- name: Prueba
blockinfile:
dest: /opt/a
block: | pruebaa
pruebaaa
这是我遇到的错误:
ERROR! Syntax Error while loading YAML.
The error appears to have been in '/home/ikerlan/ansiblePlaybooks/hadoop-Ansible/roles/comun/tasks/main.yml': line 39, column 12, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
dest: /opt/a
block: | pruebaa
^ here
我的完整main.yml是下一个
#NAMENODES
#Los siguientes comandos solo se ejecutaran en los namenodes
- name: Archivo de configuracion zoo.cfg
template: src=zoo.cfg.j2 dest=/opt/zookeeper-3.4.7/conf/zoo.cfg
- name: Prueba
blockinfile:
dest: /opt/a
block: | pruebaa
pruebaaa
- name: Crear carpeta ZooData
file: path=/opt/ZooData state=directory mode=0755
#command: mkdir -p /opt/ZooData/ creates=/opt/ZooData/
- name: Permisos ZooData
command: chown vagrant /opt/ZooData/
- name: Crear carpeta name
file: path=/hdfs/name state=directory mode=0755
#command: mkdir -p /hdfs/name/ creates=/hdfs/name/
- name: Permisos hdfs/name
command: chown vagrant /hdfs/name/
- name: Crear carpeta journalnode
file: path=/hdfs/journalnode state=directory mode=0755
#command: mkdir -p /hdfs/journalnode/ creates=/hdfs/journalnode/
- name: Permisos hdfs/journalnode
command: chown vagrant /hdfs/journalnode/
- name: Archivo de configuracion slaves
template: src=slaves.j2 dest=/opt/hadoop-2.7.1/etc/hadoop/slaves
任何帮助都会很棒。谢谢
我想 |
字符后应该有一个换行符。此外,剧本(或一般的 YAML 文件)必须以 ---
.
我没有 ansible 2.0 来测试这个。在 块之后不能有任何字符:| 试试这个:
blockinfile:
dest: /opt/a
block: |
pruebaa
pruebaaa