Skip to content

Commit 5e6ee52

Browse files
committed
fix: molecule tests
1 parent 79983da commit 5e6ee52

File tree

11 files changed

+38
-18
lines changed

11 files changed

+38
-18
lines changed

extensions/molecule/audit/converge.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
gather_facts: false
55
tasks:
66
- name: Testing role
7-
ansible.builtin.include_role:
7+
ansible.builtin.import_role:
88
name: pgalonza.linux.audit
99
tasks_from: main.yml
1010
vars:

extensions/molecule/bash_profile/converge.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
gather_facts: false
55
tasks:
66
- name: Testing role
7-
ansible.builtin.include_role:
7+
ansible.builtin.import_role:
88
name: pgalonza.linux.bash_profile
99
tasks_from: main.yml
10+
vars:
11+
bash_prompt_users:
12+
- test_user
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
- name: Prepare
3+
hosts: all
4+
gather_facts: false
5+
tasks:
6+
- name: Collect only os_family facts
7+
ansible.builtin.setup:
8+
gather_subset:
9+
- '!all'
10+
- os_family
11+
- name: Create test user
12+
ansible.builtin.user:
13+
name: test_user
14+
create_home: true

extensions/molecule/bash_profile/tests/test_general.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ def test_massage_file(host):
77
def test_profile_file(host):
88
distro_name = host.system_info.distribution
99
print(distro_name)
10-
user_home = host.user().home
10+
user_home = host.user('test_user').home
1111

1212
if distro_name in ['debian', 'ubuntu']:
1313
profile_name = '.profile'

extensions/molecule/nginx/converge.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@
99
- '!all'
1010
- os_family
1111
- name: Testing role
12-
ansible.builtin.include_role:
12+
ansible.builtin.import_role:
1313
name: pgalonza.linux.nginx
1414
tasks_from: main.yml

extensions/molecule/prepare/converge.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
gather_facts: false
55
tasks:
66
- name: Testing role
7-
ansible.builtin.include_role:
7+
ansible.builtin.import_role:
88
name: pgalonza.linux.prepare
99
tasks_from: main.yml
1010
vars:
11-
ansible_user: test_user
11+
owner_user: test_user
1212
ssh_key_dir: /tmp
1313
deploy_user: test_ansible

extensions/molecule/prepare/prepare.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
path: "/tmp/{{ item }}"
3333
loop:
3434
- id_rsa
35-
- ansible_id_rsa
35+
- test_ansible_id_rsa
3636
delegate_to: localhost

extensions/molecule/security/converge.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
gather_facts: false
55
tasks:
66
- name: Testing role
7-
ansible.builtin.include_role:
7+
ansible.builtin.import_role:
88
name: pgalonza.linux.security
99
tasks_from: main.yml
1010
vars:

roles/prepare/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ Role Variables
2121
[SSHD documentation](https://man.openbsd.org/sshd_config)
2222
* sshd_port
2323

24+
* owner_user - personal linux user
25+
2426
Dependencies
2527
------------
2628

roles/prepare/defaults/main.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33

44
sshd_port: 22
55
ssh_key_dir: ~/.ssh
6-
deploy_user: ansible
6+
deploy_user: ansible
7+
owner_user: "{{ ansible_user }}"

0 commit comments

Comments
 (0)