mirror of https://github.com/ansible/ansible.git
[passwordstore] Use builtin _random_password function instead of pwgen (#25843)
* [password] _random_password -> random_password and moved to util/encrypt.py * [passwordstore] Use built-in random_password instead of pwgen utility * [passwordstore] Add integration testspull/28197/head
parent
f345ba5c38
commit
554496c404
@ -0,0 +1 @@
|
||||
posix/ci/group2
|
@ -0,0 +1,4 @@
|
||||
- include: "package.yml"
|
||||
when: "ansible_distribution_version not in passwordstore_skip_os.get(ansible_distribution, [])"
|
||||
- include: "tests.yml"
|
||||
when: "ansible_distribution_version not in passwordstore_skip_os.get(ansible_distribution, [])"
|
@ -0,0 +1,50 @@
|
||||
- name: "Install package"
|
||||
apt:
|
||||
name: pass
|
||||
state: present
|
||||
when: ansible_pkg_mgr == 'apt'
|
||||
- name: "Install package"
|
||||
yum:
|
||||
name: pass
|
||||
state: present
|
||||
when: ansible_pkg_mgr == 'yum'
|
||||
- name: "Install package"
|
||||
dnf:
|
||||
name: pass
|
||||
state: present
|
||||
when: ansible_pkg_mgr == 'dnf'
|
||||
- name: "Install package"
|
||||
zypper:
|
||||
name: password-store
|
||||
state: present
|
||||
when: ansible_pkg_mgr == 'zypper'
|
||||
- name: "Install package"
|
||||
pkgng:
|
||||
name: "{{ item }}"
|
||||
state: present
|
||||
with_items:
|
||||
- "gnupg"
|
||||
- "password-store"
|
||||
when: ansible_pkg_mgr == 'pkgng'
|
||||
|
||||
|
||||
- name: Find brew binary
|
||||
command: which brew
|
||||
register: brew_which
|
||||
when: ansible_distribution in ['MacOSX']
|
||||
- name: Get owner of brew binary
|
||||
stat:
|
||||
path: "{{ brew_which.stdout }}"
|
||||
register: brew_stat
|
||||
when: ansible_distribution in ['MacOSX']
|
||||
- name: "Install package"
|
||||
homebrew:
|
||||
name: "{{ item }}"
|
||||
state: present
|
||||
update_homebrew: no
|
||||
with_items:
|
||||
- "gnupg2"
|
||||
- "pass"
|
||||
become: yes
|
||||
become_user: "{{ brew_stat.stat.pw_name }}"
|
||||
when: ansible_pkg_mgr == 'homebrew'
|
@ -0,0 +1,36 @@
|
||||
- name: "check name of gpg2 binary"
|
||||
command: which gpg2
|
||||
register: gpg2_check
|
||||
ignore_errors: true
|
||||
|
||||
- name: "set gpg2 binary name"
|
||||
set_fact:
|
||||
gpg2_bin: '{{ "gpg2" if gpg2_check|success else "gpg" }}'
|
||||
|
||||
- name: "remove previous password files and directory"
|
||||
file: dest={{item}} state=absent
|
||||
with_items:
|
||||
- "~/.gnupg"
|
||||
- "~/.password-store"
|
||||
|
||||
- name: "import gpg private key"
|
||||
shell: echo "{{passwordstore_privkey}}" | {{ gpg2_bin }} --import --allow-secret-key-import -
|
||||
|
||||
- name: "trust gpg key"
|
||||
shell: echo "A2A6052A09617FFC935644F1059AA7454B2652D1:6:" | {{ gpg2_bin }} --import-ownertrust
|
||||
|
||||
- name: initialise passwordstore
|
||||
command: pass init passwordstore-lookup
|
||||
|
||||
- name: create a password
|
||||
set_fact:
|
||||
newpass: "{{ lookup('passwordstore', 'test-pass length=8 create=yes') }}"
|
||||
|
||||
- name: fetch password from an existing file
|
||||
set_fact:
|
||||
readpass: "{{ lookup('passwordstore', 'test-pass') }}"
|
||||
|
||||
- name: verify password
|
||||
assert:
|
||||
that:
|
||||
- "readpass == newpass"
|
@ -0,0 +1,62 @@
|
||||
passwordstore_privkey: |
|
||||
-----BEGIN PGP PRIVATE KEY BLOCK-----
|
||||
|
||||
lQOYBFlJF1MBCACwLW/YzhKpTLVnNk8JucBfOKGdZjOzD6EB77vuJZGNt8sUMFuV
|
||||
g3VUkPZln4fZ9tN04tDgUkOdZEZqAHkOJNFUEnRRXlzSK6u7NJwuQOnDhNe3E9uM
|
||||
hsvbaL7rcPNmpra12RhUiwnATSBit5SZf5L80Y60HJxrJchGDilGGdshoyNJ5LZf
|
||||
9r6JfWkSXsQR4EvGatkzVNqNyLYn4sy/ToguH1Et8c61B6DmJ0Jzb+Txh8dl64QQ
|
||||
NbWcXXL7H1CfCR/E1ZtM50d7hyD5N1t9qdgmq6Zm0RC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DAEDhDaEsZD3K8Du1DQ
|
||||
+ZAbputP36PiAcjSnlzAcfs3ZfXMncaGShewOHO1gMH0iTZWv6qHyLNW1oEoQg3y
|
||||
SxHTvI2pKk+gx0FB8wWhd/CocAHJpx9oNUs/7A==
|
||||
=ZF3O
|
||||
-----END PGP PRIVATE KEY BLOCK-----
|
||||
passwordstore_skip_os:
|
||||
Ubuntu: ['12.04']
|
||||
RedHat: ['7.4']
|
||||
CentOS: ['6.9']
|
Loading…
Reference in New Issue