Working in Ansible Tower, I am trying to update the codedeployagent.yml file on a server by copying a new version located in a github repo sub-folder called 'files'. However when I run the template in Ansible Tower, I get the following error (below):
ERROR! Syntax Error while loading YAML.
mapping values are not allowed in this context
The error appears to be in '/tmp/awx/project/files/codedeployagent.yml': line 2, column 14, but may be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
--
:log_aws_wire: false
^ here
It's like Ansible Tower is treating the codedeployagent.yml file as an ansible file when I don't want it to do that, I just want to copy the file.
Could it be because the config file is a .yml format, do I need to change that in the source repo? This is my ansible playbook (below). Any suggestions appreciated, thanks.
---
-
become: yes
hosts: all
remote_user: admin
tasks:
- block:
- name: remove original CodeDeploy Agent config
file:
path: /etc/codedeploy-agent/conf/codedeployagent.yml
state: absent
- name: copy latest CodeDeploy Agent file
template:
dest: /etc/codedeploy-agent/conf/codedeployagent.yml
mode: 420
src: files/codedeployagent.yml
tags:
- config
- name: restart CodeDeploy Agent
service: name=codedeploy-agent state=restarted
vars_files:
- files/codedeployagent.yml
question from:
https://stackoverflow.com/questions/65940424/ansible-tower-problems-copying-yml-config-file 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…