title: ERROR! This task 'import_playbook' has extra params, which is only allowed in the following modules
body: <p>Please find below my Ansible directory structure.</p>
  
  <pre><code>├── inventories
  │   ├── ansible_host
  │   └── group_vars
  │       ├── all
  │       └── vars
  ├── plays
  │   ├── 01_recovery.yml
  ├── restore_all.yml
  └── roles
      ├── 01_recovery_lostMaster
      │   ├── defaults
      │   │   └── main.yml
      │   ├── files
      │   ├── handlers
      │   │   └── main.yml
      │   ├── meta
      │   │   └── main.yml
      │   ├── README.md
      │   ├── tasks
      │   │   └── main.yml
      │   ├── templates
      │   ├── tests
      │   │   ├── inventory
      │   │   └── test.yml
      │   └── vars
      │       └── main.yml
      ├── remove_failed_master
      │   ├── defaults
      │   │   └── main.yml
      │   ├── files
      │   ├── handlers
      │   │   └── main.yml
      │   ├── meta
      │   │   └── main.yml
      │   ├── README.md
      │   ├── tasks
      │   │   └── main.yml
      │   ├── templates
      │   ├── tests
      │   │   ├── inventory
      │   │   └── test.yml
      │   └── vars
      │       └── main.yml
  </code></pre>
  
  <p>1) Parent Playbook book: <code>restore_all.yml</code></p>
  
  <pre><code>- name: Demo of restore plan
    hosts: localhost
    gather_facts: False
  
    vars_prompt:
      - name: "Action"
        prompt: |
          - Choose Action ?
          - 1] Action 1
          - 2] Action 2
          - Please select anyone action
        private: no
  
    tasks:
  
      - name: Action 1 Details
        when: Action == "1"
        import_playbook: plays/01_recovery.yml
  
      - name: Action 2 Details
        when: Action == "2"
        import_playbook: plays/02_recovery.yml
  </code></pre>
  
  <p>2) <code>01_recovery.yml</code></p>
  
  <pre><code>---
  - name: Restore role
    hosts: localhost
    roles:
      - { role: restore/roles/01_recovery_lostMaster, tags: ['01_recovery_lostMaster'] }
  
  - name: remove failed master
    hosts: master-01
    become: true
    roles:
      - { role: restore/roles/remove_failed_master, tags: ['remove_failed_master'] }
  </code></pre>
  
  <p>Finally, when I run a playbook using the import_playbook, I get the below error.</p>
  
  <pre><code>[root@api localhost]# ansible-playbook restore_all.yml -e "host=localhost"
  [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'
  ERROR! this task 'import_playbook' has extra params, which is only allowed in the following modules: shell, win_shell, include_vars, add_host, raw, include_role, meta, set_fact, include, import_tasks, script, import_role, include_tasks, group_by, command, win_command
  </code></pre>
  
  <p>The error appears to be in <code>'/home/ec2-user/restore/restore_all.yml': line 20, column 7</code>, but may
  be elsewhere in the file depending on the exact syntax problem.</p>
  
  <p>The offending line appears to be:</p>
  
  <pre><code>- name: Action 1 Details
    ^ here
  </code></pre>
  
  <p>And, also I tried with import_tasks, it gave me the below error:</p>
  
  <pre><code>[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'
  ERROR! conflicting action statements: hosts, roles
  </code></pre>
  
  <p>Please can you help to solve my issue from the above-provided scenario?</p>
  
  <p>restore_all.yml --> Import another playbook --> Run one role in localhost and another role in another host.</p>