{"action":"created","issue":{"url":"https://api.github.com/repos/saltstack/salt/issues/31938","repository_url":"https://api.github.com/repos/saltstack/salt","labels_url":"https://api.github.com/repos/saltstack/salt/issues/31938/labels{/name}","comments_url":"https://api.github.com/repos/saltstack/salt/issues/31938/comments","events_url":"https://api.github.com/repos/saltstack/salt/issues/31938/events","html_url":"https://github.com/saltstack/salt/issues/31938","id":141456897,"number":31938,"title":"cannot get salt to replace a file","user":{"login":"gzcwnk","id":8229394,"avatar_url":"https://avatars.githubusercontent.com/u/8229394?v=3","gravatar_id":"","url":"https://api.github.com/users/gzcwnk","html_url":"https://github.com/gzcwnk","followers_url":"https://api.github.com/users/gzcwnk/followers","following_url":"https://api.github.com/users/gzcwnk/following{/other_user}","gists_url":"https://api.github.com/users/gzcwnk/gists{/gist_id}","starred_url":"https://api.github.com/users/gzcwnk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gzcwnk/subscriptions","organizations_url":"https://api.github.com/users/gzcwnk/orgs","repos_url":"https://api.github.com/users/gzcwnk/repos","events_url":"https://api.github.com/users/gzcwnk/events{/privacy}","received_events_url":"https://api.github.com/users/gzcwnk/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/saltstack/salt/labels/Question","name":"Question","color":"942192"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/saltstack/salt/milestones/37","html_url":"https://github.com/saltstack/salt/milestones/Blocked","labels_url":"https://api.github.com/repos/saltstack/salt/milestones/37/labels","id":343741,"number":37,"title":"Blocked","description":"Issues which are blocked in some way, whether they need further discussion, clarification, justification, or are blocked for some other reason.","creator":{"login":"basepi","id":702318,"avatar_url":"https://avatars.githubusercontent.com/u/702318?v=3","gravatar_id":"","url":"https://api.github.com/users/basepi","html_url":"https://github.com/basepi","followers_url":"https://api.github.com/users/basepi/followers","following_url":"https://api.github.com/users/basepi/following{/other_user}","gists_url":"https://api.github.com/users/basepi/gists{/gist_id}","starred_url":"https://api.github.com/users/basepi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/basepi/subscriptions","organizations_url":"https://api.github.com/users/basepi/orgs","repos_url":"https://api.github.com/users/basepi/repos","events_url":"https://api.github.com/users/basepi/events{/privacy}","received_events_url":"https://api.github.com/users/basepi/received_events","type":"User","site_admin":false},"open_issues":392,"closed_issues":777,"state":"open","created_at":"2013-05-28T22:24:12Z","updated_at":"2016-03-22T18:46:29Z","due_on":null,"closed_at":null},"comments":13,"created_at":"2016-03-17T02:08:35Z","updated_at":"2016-03-22T19:22:43Z","closed_at":null,"body":"What am i doing wrong please?  for some reason the file does not get added to the server...\r\n\r\nmy code is,\r\n========\r\n```sls\r\nrsyslog-logsetup:\r\n  cmd.run:\r\n    - name: 'mkdir -p /var/rsyslog'\r\n\r\nrsyslog-backup:\r\n  cmd.run:\r\n    - name: 'mv /etc/rsyslog.conf /etc/orig-rsyslog.conf'\r\n\r\nsyslog-backup:\r\n  cmd.run:\r\n    - name: 'mv /etc/syslog.conf /etc/orig-syslog.conf'\r\n\r\n#rhel6\r\n{% if grains['oscodename'] == 'Santiago' %}\r\n\r\n/etc/rsyslog.conf:\r\n  file.managed:\r\n    - source: salt://6-rsyslog2.conf\r\n    - user: root\r\n    - group: root\r\n    - mode: 644\r\n    - backup: minion\r\n\r\n{% endif %}\r\n\r\n#rhel7\r\n{% if grains['oscodename'] == 'Maipo' %}\r\n/etc/rsyslog.conf:\r\n  file.managed:\r\n    - source: salt://7-rsyslog2.conf\r\n    - user: root\r\n    - group: root\r\n    - mode: 644\r\n    - backup: minion\r\n\r\n{% endif %}\r\n\r\n\r\n#rhel5\r\n{% if grains['oscodename'] == 'Tikanga' %}\r\nsyslog-restart:\r\n  cmd.run:\r\n    - name: 'service syslog restart'\r\n{% endif %}\r\n\r\n#rhel6\r\n{% if grains['oscodename'] == 'Santiago' %}\r\nrsyslog-restart:\r\n  cmd.run:\r\n    - name: 'service rsyslog restart'\r\n{% endif %}\r\n```\r\n========\r\n\r\nrun looks like this,\r\n\r\n===========\r\n```\r\n-bash-4.1# salt -l debug -t 3600 vuwunicogsadbc1.ods.vuw.ac.nz state.sls rsyslog2\r\n[DEBUG   ] Reading configuration from /etc/salt/master\r\n[DEBUG   ] Using cached minion ID from /etc/salt/minion_id: vuwunicorhsat03.vuw.ac.nz\r\n[DEBUG   ] Missing configuration file: /root/.saltrc\r\n[DEBUG   ] Configuration file path: /etc/salt/master\r\n[WARNING ] Insecure logging configuration detected! Sensitive data may be logged.\r\n[DEBUG   ] Reading configuration from /etc/salt/master\r\n[DEBUG   ] Using cached minion ID from /etc/salt/minion_id: vuwunicorhsat03.vuw.ac.nz\r\n[DEBUG   ] Missing configuration file: /root/.saltrc\r\n[DEBUG   ] MasterEvent PUB socket URI: ipc:///var/run/salt/master/master_event_pub.ipc\r\n[DEBUG   ] MasterEvent PULL socket URI: ipc:///var/run/salt/master/master_event_pull.ipc\r\n[DEBUG   ] Initializing new AsyncZeroMQReqChannel for ('/etc/salt/pki/master', 'vuwunicorhsat03.vuw.ac.nz_master', 'tcp://127.0.0.1:4506', 'clear')\r\n[DEBUG   ] LazyLoaded local_cache.get_load\r\n[DEBUG   ] get_iter_returns for jid 20160317145908494197 sent to set(['vuwunicogsadbc1.ods.vuw.ac.nz']) will timeout at 15:59:08.518709\r\n[DEBUG   ] jid 20160317145908494197 return from vuwunicogsadbc1.ods.vuw.ac.nz\r\n[DEBUG   ] LazyLoaded highstate.output\r\n[DEBUG   ] LazyLoaded nested.output\r\n[DEBUG   ] LazyLoaded nested.output\r\n[DEBUG   ] LazyLoaded nested.output\r\nvuwunicogsadbc1.ods.vuw.ac.nz:\r\n----------\r\n          ID: rsyslog-logsetup\r\n    Function: cmd.run\r\n        Name: mkdir -p /var/rsyslog\r\n      Result: True\r\n     Comment: Command \"mkdir -p /var/rsyslog\" run\r\n     Started: 14:59:08.813101\r\n    Duration: 17.198 ms\r\n     Changes:   \r\n              ----------\r\n              pid:\r\n                  13118\r\n              retcode:\r\n                  0\r\n              stderr:\r\n              stdout:\r\n----------\r\n          ID: rsyslog-backup\r\n    Function: cmd.run\r\n        Name: mv /etc/rsyslog.conf /etc/orig-rsyslog.conf\r\n      Result: False\r\n     Comment: Command \"mv /etc/rsyslog.conf /etc/orig-rsyslog.conf\" run\r\n     Started: 14:59:08.830640\r\n    Duration: 16.528 ms\r\n     Changes:   \r\n              ----------\r\n              pid:\r\n                  13119\r\n              retcode:\r\n                  1\r\n              stderr:\r\n                  mv: cannot stat '/etc/rsyslog.conf': No such file or directory\r\n              stdout:\r\n----------\r\n          ID: syslog-backup\r\n    Function: cmd.run\r\n        Name: mv /etc/syslog.conf /etc/orig-syslog.conf\r\n      Result: False\r\n     Comment: Command \"mv /etc/syslog.conf /etc/orig-syslog.conf\" run\r\n     Started: 14:59:08.847457\r\n    Duration: 16.562 ms\r\n     Changes:   \r\n              ----------\r\n              pid:\r\n                  13120\r\n              retcode:\r\n                  1\r\n              stderr:\r\n                  mv: cannot stat '/etc/syslog.conf': No such file or directory\r\n              stdout:\r\n\r\nSummary for vuwunicogsadbc1.ods.vuw.ac.nz\r\n------------\r\nSucceeded: 1 (changed=3)\r\nFailed:    2\r\n------------\r\nTotal states run:     3\r\n[DEBUG   ] jid 20160317145908494197 found all minions set(['vuwunicogsadbc1.ods.vuw.ac.nz'])\r\nERROR: Minions returned with non-zero exit code\r\n```\r\n==========="},"comment":{"url":"https://api.github.com/repos/saltstack/salt/issues/comments/199973438","html_url":"https://github.com/saltstack/salt/issues/31938#issuecomment-199973438","issue_url":"https://api.github.com/repos/saltstack/salt/issues/31938","id":199973438,"user":{"login":"jfindlay","id":702905,"avatar_url":"https://avatars.githubusercontent.com/u/702905?v=3","gravatar_id":"","url":"https://api.github.com/users/jfindlay","html_url":"https://github.com/jfindlay","followers_url":"https://api.github.com/users/jfindlay/followers","following_url":"https://api.github.com/users/jfindlay/following{/other_user}","gists_url":"https://api.github.com/users/jfindlay/gists{/gist_id}","starred_url":"https://api.github.com/users/jfindlay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jfindlay/subscriptions","organizations_url":"https://api.github.com/users/jfindlay/orgs","repos_url":"https://api.github.com/users/jfindlay/repos","events_url":"https://api.github.com/users/jfindlay/events{/privacy}","received_events_url":"https://api.github.com/users/jfindlay/received_events","type":"User","site_admin":false},"created_at":"2016-03-22T19:22:43Z","updated_at":"2016-03-22T19:22:43Z","body":"Your first error is that you have a jinja syntax error.  If you want to comment out jinja code, you need to use jinja comments `{#` `#}`.\r\n```sls\r\nrsyslog-logsetup:\r\n  cmd.run:\r\n    - name: 'mkdir -p /var/rsyslog'\r\n\r\nrsyslog-backup:\r\n  cmd.run:\r\n    - name: 'mv /etc/rsyslog.conf /etc/orig-rsyslog.conf'\r\n\r\nsyslog-backup:\r\n  cmd.run:\r\n    - name: 'mv /etc/syslog.conf /etc/orig-syslog.conf'\r\n\r\n#rhel6\r\n{% if grains['oscodename'] == 'Santiago' %}\r\n\r\n/etc/rsyslog.conf:\r\n  file.managed:\r\n    - source: salt://6-rsyslog2.conf\r\n    - user: root\r\n    - group: root\r\n    - mode: 644\r\n    - backup: minion\r\n\r\n{% endif %}\r\n\r\n#rhel7\r\n{#{% if grains['oscodename'] == 'Maipo' %}#}\r\n{% if 'Maipo' in grains['oscodename'] %}\r\n/etc/rsyslog.conf:\r\n  file.managed:\r\n    - source: salt://7-rsyslog2.conf\r\n    - user: root\r\n    - group: root\r\n    - mode: 644\r\n    - backup: minion\r\n\r\n{% endif %}\r\n\r\n\r\n#rhel5\r\n{% if grains['oscodename'] == 'Tikanga' %}\r\nsyslog-restart:\r\n  cmd.run:\r\n    - name: 'service syslog restart'\r\n{% endif %}\r\n\r\n#rhel6\r\n{% if grains['oscodename'] == 'Santiago' %}\r\nrsyslog-restart:\r\n  cmd.run:\r\n    - name: 'service rsyslog restart'\r\n{% endif %}\r\n\r\n#rhel7\r\n{% if 'Maipo' in grains['oscodename'] %}\r\nrsyslog-restart:\r\n  cmd.run:\r\n    - name: 'systemctl restart rsyslog.service'\r\n{% endif %}\r\n```"}}