ompal shekhawat
ompal shekhawat

Reputation: 49

SaltStack: file.managed returning result: none

I am new to saltstack. I am just trying to copy a config file from saltmaster to minion with below workspace structure:

[root@saltmaster-xyz]# pwd
/srv/salt
[root@saltmaster-xyz]# ls
minion-file-copy  top.sls
[root@saltmaster-xyz]# ls minion-file-copy/
init.sls

[root@saltmaster-xyz]# cat top.sls
base:
  'minion001':
    - minion-file-copy


[root@saltmaster-xyz]# cat minion-file-copy/init.sls
file_copy:
  file.managed:
    - name: /tmp/content.cfg
    - source: salt://content.cfg
    - makedirs: True
    - force: true
    - template: jinja

[root@saltmaster-xyz]# salt 'minion001' state.apply minion-file-copy

minion001:
----------
          ID: file_copy
    Function: file.managed
        Name: /tmp/content.cfg
      Result: None
     Comment: The file /tmp/content.cfg is set to be changed
              Note: No changes made, actual changes may
              be different due to other states.
     Started: 20:58:14.008169
    Duration: 101.709 ms
     Changes:
              ----------
              newfile:
                  /tmp/ompal/content.cfg

Summary for minion001
------------
Succeeded: 1 (unchanged=1, changed=1)
Failed:    0
------------
Total states run:     1
Total run time: 101.709 ms

Here the result is showing none in output and in minion there is no file create with content.cfg name in /tmp directory.

Upvotes: 3

Views: 874

Answers (1)

whytewolf
whytewolf

Reputation: 714

the output suggests that state.apply is getting test=true somewhere in it's config. test=true can come from many places such as pillar. it does not have to be sent just on the command line.

see https://docs.saltproject.io/en/latest/ref/states/testing.html#default-test for more about how states treat test in the config.

note that pillar settings also count towards most kinds of config information for a minion.

Upvotes: 2

Related Questions