pass sudo password in playbook command

Hi,

I have a playbook(test.yml) which installs some packages on a server.

  • name: playbook to install lamp stack
    hosts: test
    user: root
    sudo: yes
    tasks:
  • name: Install Apache
    action: apt pkg=apache2 state=present

Now when I run the playbook using “ansible-playbook -v -i inventory_test test.yml --ask-pass”, It asks me for root password and when I give the pass, it works fine.
I would like to know whether there is a way to pass the password in the command itself and not use --ask-pass option.

Thanks,

Using --ask-sudo-pass will prompt for a different password specific to sudo.