Ansible Advent Calendar 2013 のネタとして書こうとした残骸があったので、書いてみる。 Ansible は task の実行結果を register という設定で変数に保存できます。 rc でコマンドの exit code に、stdout / stderr で標準出力/標準エラーにアクセスできます。 # mod_passenger.so のインストールされているべきパスを取得する - name: get mod_passenger.so path shell: /opt/ruby-{{ ruby_version }}/bin/passenger-install-apache2-module --snippet | grep passenger_module | awk '{print $3}' register: mod_passenger_path chang
![Ansible でコマンドの出力を後の task で使う](https://cdn-ak-scissors.b.st-hatena.com/image/square/ba40622775ae7d6d8ff7a02b0ee1be3ea53b0a92/height=288;version=1;width=512/https%3A%2F%2Fblog.1q77.com%2Fwp-content%2Fuploads%2F2014%2F07%2Fansible.png)