Not possible to source .bashrc with Ansible

后端 未结 10 1591
耶瑟儿~
耶瑟儿~ 2020-12-02 08:19

I can ssh to the remote host and do a source /home/username/.bashrc - everything works fine. However if I do:

- name: source bashrc
  sudo: no
          


        
10条回答
  •  既然无缘
    2020-12-02 08:46

    The right way should be:

    - hosts: all
      tasks:
        - name: source bashrc file
          shell: "{{ item }}"
          with_items:
             - source ~/.bashrc
             - your other command
    

    Note: it's test in ansible 2.0.2 version

提交回复
热议问题