Issue 1:
From @ekini on 2014-09-30T01:23:55Z

Issue Type:

Feature Idea

Component Name:

lineinfile module

Ansible Version:

All versions.

Environment:

Ubuntu 14.04, and all other.

Summary:

The module "lineinfile" should have an option to remove duplicate lines matched by regexp.

Currently it changes only the last line.

Steps To Reproduce:

Let's say that we have the following lines in sshd_config (don't ask me how I got this):

PasswordAuthentication yes
# some stuff
PasswordAuthentication yes

We run ansible as:

$ansible -c local -m lineinfile -a 'dest=./sshd_config regexp="^[#\s]*PasswordAuthentication.*" line="PasswordAuthentication no"' localhost

Expected Results:

With an option like "remove_dups=yes" we would have:

# some stuff
PasswordAuthentication no

Actual Results:

PasswordAuthentication yes
# some stuff
PasswordAuthentication no

Copied from original issue: ansible/ansible-modules-core#52

Issue 2:
ISSUE TYPE

Bug Report

COMPONENT NAME

ansible-vault

ANSIBLE VERSION

ansible 2.4.0.0
config file = /home/lw/code/work/ansible/ansible.cfg
configured module search path = [u'/home/lw/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /home/lw/code/work/ansible/venv-27-ans-24/local/lib/python2.7/site-packages/ansible
executable location = /home/lw/code/work/ansible/venv-27-ans-24/bin/ansible
python version = 2.7.12 (default, Nov 19 2016, 06:48:10) [GCC 5.4.0 20160609]

AND

ansible 2.5.0
config file = /home/lw/code/work/ansible/ansible.cfg
configured module search path = [u'/home/lw/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /home/lw/code/work/ansible/venv-27-ans/local/lib/python2.7/site-packages/ansible
executable location = /home/lw/code/work/ansible/venv-27-ans/bin/ansible
python version = 2.7.12 (default, Nov 19 2016, 06:48:10) [GCC 5.4.0 20160609]

CONFIGURATION

Configuration unchanged, I have run the same manual check across three versions, 2.3, 2.4 and 2.5 with the same config file. It is the default configuration.

OS / ENVIRONMENT

Linux Ubuntu 16.04 Dell XPS 13

I first installed just the devel version (2.5), after finding this bug, I apt-get installed 2.3 and tested it. After this, to duplicate virtualenv situation, I then installed stable-2.4 via pip in a new venv, then finally installed 2.3 in another separate env.

SUMMARY

Files can be encrypted with:

ansible-vault encrypt foobar.yml

But when you use:

ansible-vault edit foorbar.yml

On 2.4 and 2.5, you receive a prompt to set a new password again, even though the file is already encrypted, you can then drag your version back to 2.3, and it wiill return to "normal/expected behaviour".

EDIT: Also, an additional point (this is actually probably important), is that when you are reprompted to create a "new" password for an already encrypted file, if you input the password originally used for encryption on both of the "set a new password prompts", you will be able to access the file, if you try to set a new password however, that will fail.

STEPS TO REPRODUCE

Install from devel, locate yourself in the role directory and create a file you wish to ansible-vault, use ansible-vault encrypt foobar.yml on the file, then try and run ansible-vault edit foobar.yml, this should occur on 2.4 and 2.5, I first ran the encrypt via 2.5, and I can successfully edit it using 2.3, but not any version higher than 2.3

EXPECTED RESULTS

I expected to be able to get a predictable result from ansible-vault, I expect to be able to encrypt, decrypt, edit and view like I can in 2.3

ACTUAL RESULTS

What

(venv-27-ans) lw@RobertOppenheimer:files$ echo "this is a test" > foobar.yml
(venv-27-ans) lw@RobertOppenheimer:files$ cat foobar.yml
this is a test
(venv-27-ans) lw@RobertOppenheimer:files$ ansible-vault encrypt foobar.yml
New Vault password: _thisisatest_
Confirm New Vault password: _thisisatest_
Encryption successful
(venv-27-ans) lw@RobertOppenheimer:files$ cat foobar.yml
$ANSIBLE_VAULT;1.1;AES256
37623637346261373237633131376234356433353765633366346561363935666634663035313736
3961383762346666626434366635343461613064383066340a643237636566353533623234633231
36626166376463363365396131623030326564666331353962626433653962663731386336646135
3232393131316630660a376437633162613437326633626536656131653461636266346463353366
6330
(venv-27-ans) lw@RobertOppenheimer:files$ ansible-vault edit foobar.yml
New Vault password:

EDIT: Also, an additional point (this is actually probably important), is that when you are reprompted to create a "new" password for an already encrypted file, if you input the password originally used for encryption on both of the "set a new password prompts", you will be able to access the file, if you try to set a new password however, that will fail.