user2665732
user2665732

Reputation: 504

Missing become password in ansible playbook

I am trying to create playbook for deploy with simple scenario: login to server and clone/update open github repo. All access parameters written in ~/.ssh/config

Here are my files:

  1. hosts

    [staging]

    staging

  2. deploy.yml

    - hosts: staging
      tasks:
      - name: Update code
      git: repo=https://github.com/travis-ci-examples/php.git dest=hello_ansible
    

    When I am trying to run ansible-playbook -s deploy.yml -i hosts, it outputs error like this:

GATHERING FACTS *************************************************************** fatal: [staging] => Missing become password

TASK: [Update code] *********************************************************** FATAL: no hosts matched or all hosts have already failed -- aborting

I have tried to add sudo: False and become: False, but it does not seem to have any effect. I assume this operation should not request sudo password as I am trying work with files in ssh user's home directory.

I am sorry if my question is a bit lame, but I do not have much experience with Ansible.

Upvotes: 0

Views: 3737

Answers (1)

Alec  Collier
Alec Collier

Reputation: 1523

It is asking for the sudo password because you are using the -s option. It seems like you do not want to use sudo for this task so try running the command without -s.

ansible-playbook deploy.yml -i hosts

Upvotes: 3

Related Questions