-1

これは私がこれまでに持っているものです:

- hosts: test
  tasks:
    - name: check existence of line in the target file to replace if there
      command: grep fs.file-max /etc/sysctl.conf
      changed_when: false
      failed_when: false
      register: file_test
    - name: add config line to the file and reload
      lineinfile:
        path: /etc/sysctl.conf
        line: fs.file-max = 65000
      when: item.rc == 1
      with_items:
        - '{{ file_test.results }}'
      command: sysctl -a

ただし、次のように失敗し続けます。

The error appears to be in '/root/playbooks/sysctl.yml': line 8, column 7, but may                                    
be elsewhere in the file depending on the exact syntax problem.                                                      
                                                                                                                      
The offending line appears to be:                                                                                    
                                                                                                                      
      register: file_test                                                                                             
    - name: add config line to the file and reload                                                                    
      ^ here                

インデントを修正し、これを行う方法を変更しようとしましたが、何も得られません。

4

1 に答える 1