스크립트에서 구문 오류가 발생함

스크립트에서 구문 오류가 발생함

이 플레이북을 실행 중이지만 마지막 작업에서는 실패합니다. 우분투 호스트에서 이것을 실행하십시오.

---
 - hosts: all
   become: yes
   tasks:
   - name: Copy certificate files.
     copy:
        src: "{{ item.src }}"
        dest: "{{ item.dest }}"
        owner: root
        group: root
        mode: 0644
     with_items:
     -  {  src: "/registry_certs/domain.crt", dest: "/usr/local/share/ca-certificates/ca.crt" }

   - command: sudo apt-get install --reinstall ca-certificates
   - command: sudo update-ca-certificates

   - name:  "just force systemd to reread configs (2.4 and above)"
     systemd:
       name: "{{ item }}"
       state: started
       daemon_reload: yes
     with_items:
     - docker
     - kubelet

실수

ubuntu@kops:/etc/ansible$ sudo ansible-playbook certificate_new.yml -l aws  --syntax-check
ERROR! no action detected in task

The error appears to have been in '/etc/ansible/certificate_new.yml': line 18, column 6, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:


   - name:  "just force systemd to reread configs (2.4 and above)"
     ^ here

답변1

Ansible구문 에 따르면 다음과 같이 들여쓰기 및 기타 작업을 수행하고 공백을 하나 더 추가 tasks:해야 합니다 .- name:

---
 - hosts: all
   become: yes
   tasks:
    - name: Copy certificate files.

관련 정보