4 Commits

Author SHA1 Message Date
ea17bd56a5 Merge pull request 'chore(deps): update ansible/ansible-lint action to v25.11.1' (#21) from renovate/actions into master
All checks were successful
Ansible Linter / ansible-lint (push) Successful in 17s
Lint Markdown files / markdown-lint (push) Successful in 5s
2025-11-24 23:05:07 +00:00
dc4e741b85 chore(deps): update ansible/ansible-lint action to v25.11.1
All checks were successful
Ansible Linter / ansible-lint (pull_request) Successful in 16s
Lint Markdown files / markdown-lint (pull_request) Successful in 4s
Lint Markdown files / markdown-lint (push) Successful in 5s
Ansible Linter / ansible-lint (push) Successful in 56s
2025-11-24 23:01:37 +00:00
6679f1602f fix(lint): close bracket
All checks were successful
Lint Markdown files / markdown-lint (push) Successful in 5s
Ansible Linter / ansible-lint (push) Successful in 55s
2025-11-23 16:21:40 +01:00
6469d81fcf fix: rename files to .yaml
Some checks failed
Ansible Linter / ansible-lint (push) Failing after 17s
Lint Markdown files / markdown-lint (push) Successful in 4s
2025-11-23 16:19:51 +01:00
9 changed files with 100 additions and 5 deletions

View File

@@ -14,7 +14,7 @@ jobs:
steps: steps:
- uses: actions/checkout@v5.0.1 - uses: actions/checkout@v5.0.1
- name: Run ansible-lint - name: Run ansible-lint
uses: ansible/ansible-lint@v25.11.0 uses: ansible/ansible-lint@v25.11.1
with: with:
args: "--config-file .ansible-lint" args: "--config-file .ansible-lint"
setup_python: "true" setup_python: "true"

95
tasks/main.yaml Normal file
View File

@@ -0,0 +1,95 @@
---
- name: Load variables
ansible.builtin.include_vars: "{{ ansible_facts['os_family'] }}.yaml"
- name: Verify variables
ansible.builtin.include_vars: "{{ lookup('first_found', params) }}"
vars:
params:
files:
- "{{ ansible_facts['distribution'] }}_verify_vars.yaml"
- "{{ ansible_facts['os_family'] }}_verify_vars.yaml"
- "verify_vars.yaml"
- name: Install sudo
ansible.builtin.package:
name: "{{ item }}"
state: present
with_items: "{{ sudo_users_package_names }}"
- name: Enable includedir directive
ansible.builtin.lineinfile:
dest: /etc/sudoers
state: present
regexp: "^(#)+(\\s)*includedir(\\s)*/etc/sudoers.d"
line: "#includedir /etc/sudoers.d"
validate: 'visudo --check --file %s'
mode: "0440"
owner: "root"
group: "root"
- name: Flush drop-in files of sudoers.d
ansible.builtin.file:
state: "{{ item }}"
path: "/etc/sudoers.d"
owner: "root"
group: "root"
mode: "0750"
with_items:
- absent
- directory
- name: "Create sudoers drop-in file to execute commands for specific unix users"
community.general.sudoers:
name: "{{ item.filename | default(item.user) }}"
state: present
user: "{{ item.user }}"
nopassword: "{{ item.nopassword | default(false) }}"
commands: "{{ item.commands | default('ALL') }}"
with_items:
- "{{ sudo_users_sudoers }}"
when: item.user is defined and item.user | length > 0 and
item.group is not defined and
item.runas is not defined
- name: "Create sudoers drop-in file to execute commands for specific unix users as specific unix user"
community.general.sudoers:
name: "{{ item.filename | default(item.user) }}"
state: present
user: "{{ item.user }}"
runas: "{{ item.runas }}"
nopassword: "{{ item.nopassword | default(false) }}"
commands: "{{ item.commands | default('ALL') }}"
with_items:
- "{{ sudo_users_sudoers }}"
when: item.user is defined and item.user | length > 0 and
item.group is not defined and
item.runas is defined and item.runas | length > 0
- name: "Create sudoers drop-in file to execute commands for specific unix groups"
community.general.sudoers:
name: "{{ item.filename | default(item.group) }}"
state: present
group: "{{ item.group }}"
nopassword: "{{ item.nopassword | default(false) }}"
commands: "{{ item.commands | default('ALL') }}"
with_items:
- "{{ sudo_users_sudoers }}"
when: item.user is not defined and
item.group is defined and item.group | length > 0 and
item.runas is not defined
- name: "Create sudoers drop-in file to execute commands for specific unix groups as specifix unix user"
community.general.sudoers:
name: "{{ item.filename | default(item.group) }}"
state: present
group: "{{ item.group }}"
runas: "{{ item.runas }}"
nopassword: "{{ item.nopassword | default(false) }}"
commands: "{{ item.commands | default('ALL') }}"
with_items:
- "{{ sudo_users_sudoers }}"
when: item.user is not defined and
item.group is defined and item.group | length > 0 and
item.runas is defined and item.runas | length > 0

View File

@@ -1,16 +1,16 @@
--- ---
- name: Load variables - name: Load variables
ansible.builtin.include_vars: "{{ ansible_facts['os_family'] }}.yml" ansible.builtin.include_vars: "{{ ansible_facts['os_family'] }}.yaml"
- name: Verify variables - name: Verify variables
ansible.builtin.include_vars: "{{ lookup('first_found', params) }}" ansible.builtin.include_vars: "{{ lookup('first_found', params) }}"
vars: vars:
params: params:
files: files:
- "{{ ansible_facts['distribution'] }}_verify_vars.yml" - "{{ ansible_facts['distribution'] }}_verify_vars.yaml"
- "{{ ansible_facts['os_family' }}_verify_vars.yml" - "{{ ansible_facts['os_family'] }}_verify_vars.yaml"
- "verify_vars.yml" - "verify_vars.yaml"
- name: Install sudo - name: Install sudo
ansible.builtin.package: ansible.builtin.package: