Search code examples
salt-project

salt stack source bashrc each time bashrc is updated


The bashrc files for my minions is a managed file, now I need to source the bashrc file each time it is changed is there a way to do that in salt.

Currently I have this

/home/path/bashrc:
  file.managed:
    - name:  /home/path/.bashrc
    - source:  salt://dir/bashrc
    - user:  path
    - group:  path
  cmd.run:
    - name:  source /home/path/.bashrc
    - user:  path

is this the correct way to do this ?


Solution

  • You can't and don't need to do that - source only works for the currently open terminal session. Salt can't (or shouldn't) abort/interrupt existing terminal sessions just to source a new bashrc.

    A new version of bashrc will be sourced automatically when the user logs in next time.