Ujjawal Khare
Ujjawal Khare

Reputation: 796

Unable to execute bashrc function using ANSIBLE

I am trying to execute a bashrc function "enableSsh" using ANSIBLE. I am using below ANSIBLE code to get this done but getting error: enableSsh command not found.

- name: Switch to user root and enable ssh
  become: yes
  become_user: root
  become_method: su
  shell: . .bashrc && enableSsh
  args:
    executable: /bin/bash

Note: I tested it removing enableSsh and reloading bashrc is working fine. enableSsh is a function defined in remote server's bashrc file and works fine if execute directly from command line.

Upvotes: 2

Views: 369

Answers (1)

Alassane Ndiaye
Alassane Ndiaye

Reputation: 4777

This is not an issue with Ansible, this is a shortcoming of the alias command as explained here.

Upvotes: 1

Related Questions