Issue 1:
ISSUE TYPE

Bug Report

COMPONENT NAME

lineinfile

ANSIBLE VERSION

2.4.2

SUMMARY

I was trying to take control of a brand new Debian 8.3 machine (AWS, Debian official AMI) via ansible. The default user is admin, the ssh key is present but it seems that is impossible to get root access on this machine without manual intervention which really sucks as is against automation and auto-provisioning.

- hosts: neon
tasks:
- name: Remove require tty
lineinfile: regexp="^\s+\w+\s+requiretty" dest=/etc/sudoers state=absent
become_method: sudo
become_user: root
become: yes

I tried all become methods, no luck.

IOError: [Errno 13] Permission denied: '/etc/sudoers`

Issue 2:
Issue Type:

Bug Report

Ansible Version:

$ ansible --version
ansible 2.0.0 (devel efcad3aa6d) last updated 2015/07/30 15:16:07 (GMT -200)
lib/ansible/modules/core: (detached HEAD ff69ce7912) last updated 2015/07/07 11:42:48 (GMT -200)
lib/ansible/modules/extras: (detached HEAD 4e48ef9eca) last updated 2015/07/07 11:43:20 (GMT -200)
v1/ansible/modules/core: (detached HEAD f8d8af17cd) last updated 2015/07/07 11:43:45 (GMT -200)
v1/ansible/modules/extras: (detached HEAD 495ad450e5) last updated 2015/07/07 11:44:04 (GMT -200)
config file = /etc/ansible/ansible.cfg
configured module search path = None

Ansible Configuration:

The /etc/ansible/ansible.cfg is exactly the same as the version on github.

Environment:

Ubuntu 14.04 LTS

Summary:

Ansible won't work when VagrantFile is at the same level as ansible dir.

The base ansible path is duplicated.

It works though if the Vagrant file is inside a folder, and this folder in turn is at the same level as ansible dir.

Steps To Reproduce:

Create a structure like this:

.
├── ansible
│ ├── group_vars
│ │ └── all
│ └── site.yml
├── directory
│ └── Vagrantfile
└── Vagrantfile

Where ansible/group_vars/all is empty; ansible/site.yml is:

---
- hosts: all
tasks:
- name: Test
assert:
that:
- 1 == 1

VagrantFile is:

Vagrant.configure(2) do |config|

config.vm.box = "ubuntu/trusty64"
config.vm.provision "ansible" do |ansible|
ansible.playbook = "ansible/site.yml"
ansible.host_key_checking = false
ansible.verbose = "v"
end
end

And directory/VagrantFile is:

Vagrant.configure(2) do |config|

config.vm.box = "ubuntu/trusty64"
config.vm.provision "ansible" do |ansible|
ansible.playbook = "../ansible/site.yml"
ansible.host_key_checking = false
ansible.verbose = "v"
end
end

Run vagrant up from the base dir.

Run from the same dir: ansible-playbook --private-key=.vagrant/machines/default/virtualbox/private_key --inventory-file=.vagrant/provisioners/ansible/inventory ansible/site.yml

Expected Results:

The playbook to run sucessfully.

Actual Results:

$ ansible-playbook --private-key=.vagrant/machines/default/virtualbox/private_key --inventory-file=.vagrant/provisioners/ansible/inventory ansible/site.yml
ERROR! the file_name '/home/alfeto/work/ansible_bug/ansible/ansible/group_vars/all' does not exist, or is not readable

Notice how ansible appears twice: /home/alfeto/work/ansible_bug/ansible/ansible/group_vars/all

Extra info:

If ansible-playbook is run instead from directory/, the playbook runs successfully:

/directory$ ansible-playbook --private-key=.vagrant/machines/default/virtualbox/private_key --inventory-file=.vagrant/provisioners/ansible/inventory ../ansible/site.yml

PLAY ****************************************************************************

...