Eu tenho a seguinte tarefa em uma função chamada tomcat:
- name: copy tomcat file settings
copy:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
owner: tomcat
group: tomcat
mode: "{{ item.mode }}"
with_items:
- { src: logrotate-tomcat7, dest: /etc/logrotate.d/tomcat7, mode: 0644 }
- { src: keystore.pks, dest: /var/lib/tomcat7/webapps, mode: 0644 }
- { src: jmxremote.access, dest: /etc/tomcat7, mode: 0644 }
- { src: jmxremote.password, dest: /etc/tomcat7, mode: 0600 }
Quando executo o manual que chama a função tomcat, vejo a seguinte saída:
TASK [devops-server : copy tomcat file settings] *********************************
changed: [10.71.10.11] => (item={u'dest': u'/etc/logrotate.d/tomcat7', u'src': u'logrotate-tomcat7', u'mode': 420})
changed: [10.71.10.11] => (item={u'dest': u'/var/lib/tomcat7/webapps', u'src': u'keystore.pks', u'mode': 420})
changed: [10.71.10.11] => (item={u'dest': u'/etc/tomcat7', u'src': u'jmxremote.access', u'mode': 420})
failed: [10.71.10.11] (item={u'dest': u'/etc/tomcat7', u'src': u'jmxremote.password', u'mode': 384}) => {"checksum": "2203ad1530a3bc06732043ba67d129b5364505ce", "details": "bad symbolic permission for mode: 384", "failed": true, "gid": 91, "group": "tomcat", "item": {"dest": "/etc/tomcat7", "mode": 384, "src": "jmxremote.password"}, "mode": "0644", "msg": "mode must be in octal or symbolic form", "owner": "tomcat", "path": "/etc/tomcat7/jmxremote.password", "size": 52, "state": "file", "uid": 91}
...ignoring
Obviamente, o modo 0600 funciona na linha de comando da minha instância do EC2:
ec2-user@devops-01 ~]$ sudo chmod 0600 /etc/tomcat7/jmxremote.password
ec2-user@devops-01 ~]$ ls -l /etc/tomcat7/jmxremote.password
-rw------- 1 tomcat tomcat 52 Oct 28 16:18 /etc/tomcat7/jmxremote.password
Então, o que dá? Isso é um bug Ansível ou estou faltando alguma coisa?