Skip to content

Commit

Permalink
Update converge.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
vitabaks committed Dec 8, 2024
1 parent c80d1ea commit 1b6f950
Showing 1 changed file with 29 additions and 20 deletions.
49 changes: 29 additions & 20 deletions automation/molecule/default/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,38 @@
gather_facts: true

tasks:
- name: Check PAM configuration for sudo
command: cat /etc/pam.d/sudo
register: pam_sudo_config
changed_when: false
- name: Allow passwordless sudo for all users in sudo group
become: true
become_method: su
ansible.builtin.lineinfile:
path: /etc/sudoers
state: present
regexp: '^%sudo'
line: '%sudo ALL=(ALL) NOPASSWD: ALL'
validate: 'visudo -cf %s'
ignore_errors: yes

Check warning on line 16 in automation/molecule/default/converge.yml

View workflow job for this annotation

GitHub Actions / build

16:22 [truthy] truthy value should be one of [false, true]

Check failure on line 16 in automation/molecule/default/converge.yml

View workflow job for this annotation

GitHub Actions / build

yaml[truthy]

Truthy value should be one of \[false, true]

- name: Debug PAM configuration for sudo
debug:
var: pam_sudo_config.stdout
- name: Ensure user is part of sudo group
become: true
become_method: su
ansible.builtin.user:
name: "{{ ansible_user }}"
groups: sudo
append: true

- name: Update PAM configuration for sudo to allow all
become: true
become_method: su
ansible.builtin.lineinfile:
path: /etc/pam.d/sudo
state: present
regexp: '^auth.*pam_permit.so'
line: 'auth sufficient pam_permit.so'
ignore_errors: yes

Check warning on line 34 in automation/molecule/default/converge.yml

View workflow job for this annotation

GitHub Actions / build

34:22 [truthy] truthy value should be one of [false, true]

Check failure on line 34 in automation/molecule/default/converge.yml

View workflow job for this annotation

GitHub Actions / build

yaml[truthy]

Truthy value should be one of \[false, true]

- name: Disable PAM for sudo in sudoers
become: true
become_method: su
ansible.builtin.lineinfile:
path: /etc/sudoers
state: present
Expand All @@ -22,19 +44,6 @@
validate: 'visudo -cf %s'
ignore_errors: yes

Check warning on line 45 in automation/molecule/default/converge.yml

View workflow job for this annotation

GitHub Actions / build

45:22 [truthy] truthy value should be one of [false, true]

Check failure on line 45 in automation/molecule/default/converge.yml

View workflow job for this annotation

GitHub Actions / build

yaml[truthy]

Truthy value should be one of \[false, true]

- name: Check SELinux status
command: getenforce
register: selinux_status
ignore_errors: yes

- name: Debug SELinux status
debug:
var: selinux_status.stdout

- name: Disable SELinux temporarily
command: setenforce 0
ignore_errors: yes

- name: Test sudo without password

Check failure on line 47 in automation/molecule/default/converge.yml

View workflow job for this annotation

GitHub Actions / build

fqcn[action-core]

Use FQCN for builtin module actions (command).
command: sudo -n true
register: sudo_test
Expand Down

0 comments on commit 1b6f950

Please sign in to comment.