2017-06-12 20 views
0

私は初心者です。私が使用している可能:設定ファイルをsudo(CoreOS)として編集する

ansible 2.3.0.0

私は、OpenStackの中でK8Sクラスタのノードをブートストラップするには、以下の脚本を持っている:

- name: bootstrap 
    hosts: coreos 
    become_user: root 
    become_method: su 
    gather_facts: False 
    roles: 
    - defunctzombie.coreos-bootstrap 
    tasks: 
    - lineinfile: 
     path: /etc/coreos/update.conf 
     state: present 
     regexp: '^REBOOT_STRATEGY' 
     line: 'REBOOT_STRATEGY=off' 

私はcoreosで自動再起動がオフにしたい私たちのためにopenstackのインストールに問題があり、再起動が正常に行われず、coreosを頻繁に再起動するとインスタンスを手動でシャットダウンして再起動する必要があります。

とにかく、上記のプレイブックは機能しません。

"The destination directory (/etc/coreos) is not writable by the current user. Error was: [Errno 13] Permission denied: '/etc/coreos/.ansible_tmppQCJrCupdate.conf'" 

だから私の構文が間違っている(運と私が試したいくつかの異なる組み合わせ):私はこのエラーを取得します。

誰かが正しい方向に向けるでしょうか?そして、このプレイブックについて何かを提案してください。

ありがとうございます!

答えて

2

プレイリストをrootユーザーとして実行する代わりに、sudoアクセス権を持つ別のユーザーを使用してください。

これを試してください: - name: bootstrap hosts: coreos user: <user_name> become_method: sudo gather_facts: False roles: - defunctzombie.coreos-bootstrap tasks: - lineinfile: path: /etc/coreos/update.conf state: present regexp: '^REBOOT_STRATEGY' line: 'REBOOT_STRATEGY=off' <user_name>をあなたのユーザーに置き換えてください。

プレイプレーブをansible-playbook <playbook_name> --ask-sudo-pass