リモートボックスに新しいユーザーを作成し、そのユーザーをsudoユーザーにして、rootユーザーのSSHログインを無効にするAnsibleタスクがあります。その後、リモートボックス上のすべてのタスクがこの新しいユーザーとして実行されます。同じプレイ/プレイブックの新しいユーザーに切り替える方法はありますか?上記のように #!/bin/bash
# Install a new remote us
{% for ... %}。 Iおおよそ次のステップがあります。 - name: Wait for Started status to clear
uri:
url: http://{{ container.ip }}:8080/upgrade/api/v1/upgrades/{{ theuuid }}
return_content: yes
registe