-
Notifications
You must be signed in to change notification settings - Fork 741
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add option to bypass .netrc check function
add option to whitelist specific user that need a .netrc file in there home dirs add test for .netrc files if option os_netrc_enabled is false Signed-off-by: Philipp Funk <[email protected]>
- Loading branch information
Philipp Funk
committed
Aug 16, 2022
1 parent
6aa01f0
commit b6d217a
Showing
10 changed files
with
66 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
- name: create '.netrc' in /root | ||
ansible.builtin.copy: | ||
dest: '/root/.netrc' | ||
mode: '0600' | ||
content: | | ||
machine localhost | ||
login root | ||
password ipsum |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--- | ||
- name: test that .netrc in root homedir exists | ||
ansible.builtin.file: | ||
path: '/root/.netrc' | ||
state: file | ||
register: result_test_netrc | ||
|
||
- name: output result if .netrc for user root exists | ||
ansible.builtin.assert: | ||
that: | ||
- "result_test_netrc.state == 'file'" | ||
fail_msg: ".netrc in /root/ not present" | ||
success_msg: ".netrc exists in /root/" | ||
|
||
- name: delete '.netrc' in /root | ||
ansible.builtin.file: | ||
path: '/root/.netrc' | ||
state: absent | ||
when: result_test_netrc.state == 'file' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
- name: Get user accounts | os-09 | ||
command: "awk -F: '{print $1}' /etc/passwd" | ||
changed_when: false | ||
check_mode: false | ||
register: users_accounts | ||
|
||
- name: Delete .netrc-files from system | os-09 | ||
file: | ||
dest: '~{{ item }}/.netrc' | ||
state: 'absent' | ||
loop: '{{ users_accounts.stdout_lines | flatten | default([]) }}' | ||
when: item not in os_netrc_whitelist_user |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters