-1

私の ansible プレイブックでは、ユーザーから 2 つの入力を取得しています。また、オプションである必要がある 3 番目の入力も取得したいと考えていました。ユーザーが var3 の値を指定した場合、プレイブックはタスクを実行する必要があります。これを達成するには?

また、私は ansible に awx オープンソース UI を使用していることを知りたかったので、ホストを選択して ansible awx インベントリでプレイブックを実行します。その後、プレイブックの「ホスト」に何を書くか、そのままにしておくことができます。

 - name: Updating "{{ service_name  }}" server codebase and starting its service.
   hosts: all
   tasks:
    - name: Stopping nginx service
      command: sudo service nginx stop


    - name: Performing git checkout in the specified directory "{{ path  }}"
      command: git checkout .
      args:
        chdir: "{{ path }}"

    - name: Running npm install in the directory "{{ path }}"
      command: npm install
      args:
        chdir: "{{ path }}/node_modules"


    - name: Restarting the "{{ service_name }}" service
      command: sudo service "{{ service_name }}" restart

    - name: Restarting the nginx service
      command: sudo service nginx restart
4

1 に答える 1