I wrote as follows in playbook:
- name: Ensure config files of logstash and elasticsearch are in
place
copy: src={{ item.src }}
dest={{ item.dst }}
owner=root group=root mode=0644
notify:
- restart logstash
- restart redis-server
- restart elasticsearch
with_items:
- {name: 'logstash', src: 'central.conf', dst:
'/etc/logstash/conf.d/central.conf'}
- {name: 'redis-server', src: 'redis.conf', dst:
'dest=/etc/redis/redis.conf'}
- {name: 'elasticsearch', src: 'elasticsearch.yml', dst:
'/etc/elasticsearch/elasticsearch.yml'}
The output says:
TASK: [logstash | Ensure config files of logstash, redis-server and
elasticsearch are in place] ***
ok: [logstash] => (item={'src': 'central.conf', 'dst':
'/etc/logstash/conf.d/central.conf', 'name': 'logstash'})
failed: [logstash] => (item={'src': 'redis.conf', 'dst':
'dest=/etc/redis/redis.conf', 'name': 'redis-server'}) => {"failed": true,
"item": {"dst": "dest=/etc/redis/redis.conf", "name": "redis-server",
"src": "redis.conf"}, "md5sum": "9bacd6c1cc22266cbf4813df133f3f2f"}
msg: Destination directory dest=/etc/redis does not exist
ok: [logstash] => (item={'src': 'elasticsearch.yml', 'dst':
'/etc/elasticsearch/elasticsearch.yml', 'name': 'elasticsearch'})
But if I write as follows:
- name: Ensure redis-server config file is in place
copy: src=redis.conf
dest=/etc/redis/redis.conf
owner=root group=root mode=0644
notify:
- restart redis-server
- name: Ensure config files of logstash and elasticsearch are in
place
copy: src={{ item.src }}
dest={{ item.dst }}
owner=root group=root mode=0644
notify:
- restart logstash
# - restart redis-server
- restart elasticsearch
with_items:
- {name: 'logstash', src: 'central.conf', dst:
'/etc/logstash/conf.d/central.conf'}
# - {name: 'redis-server', src: 'redis.conf', dst:
'dest=/etc/redis/redis.conf'}
- {name: 'elasticsearch', src: 'elasticsearch.yml', dst:
'/etc/elasticsearch/elasticsearch.yml'}
All the things goes well. As "/etc/redis" really exists, so I don't know
why... Can any one help with this case?
The whole code is at https://github.com/RichardCao/logging-for-openstack,
tag is "server in one".
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/7a722e23-9949-44a2-9da3-2c99287355c6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.