dkreuer / ansible-role-bash-cmd

Ansible role to execute arbitrary bash commands via a role

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ansible-role bash-cmd

Will execute the passed command in the passed dir. Useful for doing things like bundle install and rake db:migrate via a role.

- hosts: defaults
  roles:
    - { role: bash_cmd, dir: '/var/www/my_app', cmd: 'bundle install' }
    - { role: bash_cmd, dir: '/var/www/my_app', cmd: 'bundle exec rake db:migrate' }

Additionally you can specify the role to only run on a single node. Useful for things that would cause errors if run on multiple hosts.

- hosts: defaults
  roles:
    - { role: bash_cmd, dir: '/var/www/my_app', cmd: 'bundle install' }
    - { role: bash_cmd, dir: '/var/www/my_app', cmd: 'bundle exec rake db:migrate', single_node: true }

License

  • MIT

About

Ansible role to execute arbitrary bash commands via a role

License:MIT License