cp a file on remote | Missing become password

111 views
Skip to first unread message

MaTi Villagra

unread,
Aug 3, 2015, 12:58:29 PM8/3/15
to Ansible Project
Hello.

I have ansible 1.9.2 running [elementary OS], the task is simple I want to copy a file named file1.txt on a remote node [debian Jessie] PATH = /root/file1.txt

I sucesfully ssh without using a text password from my elemtary OS to my debian Jessie [ ssh -l debian gateway.linux.rocks ]

File : motd/tasks/main.yml

- name: copy a file
  copy: src=file1.txt dest=/root/file1.txt owner=root mode=0600
  tags:
         - simple

I have groups_vars/servers definition for this node as

---
ansible_ssh_user: debian

So the user to ssh is debian.

Under my site.yml I have

---
- name: apply common configuration to servers nodes
  hosts: servers
  roles:
     - { role: motd, sudo: yes }

The role named is motd and I set to used sudo:yes, the user on the remote is debian with has sudo priv's.

I also test to defined the role as

- { role: easy, become: yes, become_method: sudo }

Anyway, running triggers

ansible-playbook site.yml  -t simple

The -t simple is I just simple created a tag.

TASK: [motd | copy a file] ****************************************************
fatal: [gateway.linux.rocks] => Missing become password

FATAL: all hosts have already failed -- aborting

Question 1. To be able to do this I need to add a line like debian ALL=(ALL) NOPASSWD:ALL to the sudoers on the remote host called gateway.linux.rocks [debian Jessie]

Question 2. If I Run ansible-playbook site.yml  -t simple  -K || Ask me for SUDO password: enter the correct one, the task run sucesfully, but debian the user on the remote [debian Jessie hostname = gateway.linux.rocks] is member of sudo. So I don't understand.

Thanks in advance.
Reply all
Reply to author
Forward
0 new messages