2017-08-25 1 views
0

次のように私は設定ファイルに行を持っている:Ansibleコメント解除ラインと変更文字列値

# value = False 

私は次のように「#」を削除するためにlineinfileを使用することができます知っている:

- name: Uncomment parameters 
    lineinfile: 
    dest: app.conf 
    regexp: (?i)^\s*#\s*({{ item }}.*) 
    line: \1 
    backrefs: yes 
    with_items: 
    - value 

同じタスクで「False」を「True」に変更する方法があるのだろうか、それとも別のタスクが必要になるのだろうか? (最も可能性の高い置換を使用していますか?)

答えて

0

確かに、他のロジックが追加されていない限り、

- name: Uncomment parameters 
    lineinfile: 
    dest: app.conf 
    regexp: (?i)^\s*#\s*{{ item }}.* 
    line: "{{ item }} = True" 
    backrefs: yes 
    with_items: 
    - value 
関連する問題