個人のansible作業ディレクトリを構成し、自動の秘密のないymlファイルを書き込みます

mkdir / root / 2019ansible

cd / root / 2019ansible

vim ansible.cfg

[デフォルト]

在庫=ホスト

remote_user = root

vimホスト

[ウェブサーバー]

node1.sina.com

node2.sina.com

vim auth_key.yml

---

-名前:承認済みキーを構成する

  ホスト:すべて

  タスク:

  -名前:認証キー

    authorized_key:

    ユーザー:root

    状態:プレゼント

    キー: "{{lookup( 'file'、 '/root/.ssh/id_rsa.pub')}}"

 

コマンドを実行する

ansible-playbook auth_key.yml -k

73件の元の記事を公開 賞賛4 20,000回以上の閲覧

おすすめ

転載: blog.csdn.net/qq_27592485/article/details/103187656