Compare commits
2 Commits
c308225b56
...
renovate/p
| Author | SHA1 | Date | |
|---|---|---|---|
| fd466288df | |||
|
f12fe903de
|
@@ -22,11 +22,11 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
path: "palkx.users"
|
path: "palkx.users"
|
||||||
- name: Setup Python 3
|
- name: Setup Python 3
|
||||||
uses: actions/setup-python@v5
|
uses: actions/setup-python@v6
|
||||||
with:
|
with:
|
||||||
python-version: "3.x"
|
python-version: "3.14"
|
||||||
- name: Intall test dependencies
|
- name: Intall test dependencies
|
||||||
run: pip3 install yamllint ansible-lint
|
run: pip3 install yamllint==1.37.1 ansible-lint==25.12.0
|
||||||
- name: Lint code with yamllint
|
- name: Lint code with yamllint
|
||||||
run: "yamllint ."
|
run: "yamllint ."
|
||||||
- name: Lint code with yamllint
|
- name: Lint code with yamllint
|
||||||
@@ -38,10 +38,12 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
distro:
|
distro:
|
||||||
- rockylinux9
|
- rockylinux9
|
||||||
|
- rockylinux10
|
||||||
- ubuntu2204
|
- ubuntu2204
|
||||||
- ubuntu2404
|
- ubuntu2404
|
||||||
- debian11
|
- debian11
|
||||||
- debian12
|
- debian12
|
||||||
|
- debian13
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout the codebase
|
- name: Checkout the codebase
|
||||||
@@ -49,11 +51,11 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
path: "palkx.users"
|
path: "palkx.users"
|
||||||
- name: Setup Python 3
|
- name: Setup Python 3
|
||||||
uses: actions/setup-python@v5
|
uses: actions/setup-python@v6
|
||||||
with:
|
with:
|
||||||
python-version: "3.x"
|
python-version: "3.14"
|
||||||
- name: Intall test dependencies
|
- name: Intall test dependencies
|
||||||
run: pip3 install ansible molecule molecule-plugins[docker] docker
|
run: pip3 install ansible-core==2.20.0 molecule==25.12.0 molecule-plugins[docker]==25.8.12 docker==7.1.0
|
||||||
- name: Run Molecule tests
|
- name: Run Molecule tests
|
||||||
run: molecule test
|
run: molecule test
|
||||||
env:
|
env:
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
package:
|
package:
|
||||||
update_cache: true
|
update_cache: true
|
||||||
cache_valid_time: 600
|
cache_valid_time: 600
|
||||||
when: ansible_os_family == 'Debian'
|
when: ansible_facts["os_family"] == 'Debian'
|
||||||
|
|
||||||
- name: Ensure build dependencies are installed (RedHat).
|
- name: Ensure build dependencies are installed (RedHat).
|
||||||
package:
|
package:
|
||||||
@@ -16,13 +16,13 @@
|
|||||||
- openssh-server
|
- openssh-server
|
||||||
- openssh-clients
|
- openssh-clients
|
||||||
state: present
|
state: present
|
||||||
when: ansible_os_family == 'RedHat'
|
when: ansible_facts["os_family"] == 'RedHat'
|
||||||
|
|
||||||
- name: Ensure build dependencies are installed (Fedora).
|
- name: Ensure build dependencies are installed (Fedora).
|
||||||
package:
|
package:
|
||||||
name: procps
|
name: procps
|
||||||
state: present
|
state: present
|
||||||
when: ansible_distribution == 'Fedora'
|
when: ansible_facts["distribution"] == 'Fedora'
|
||||||
|
|
||||||
- name: Ensure build dependencies are installed (Debian).
|
- name: Ensure build dependencies are installed (Debian).
|
||||||
package:
|
package:
|
||||||
@@ -30,7 +30,7 @@
|
|||||||
- openssh-server
|
- openssh-server
|
||||||
- openssh-client
|
- openssh-client
|
||||||
state: present
|
state: present
|
||||||
when: ansible_os_family == 'Debian'
|
when: ansible_facts["os_family"] == 'Debian'
|
||||||
|
|
||||||
- name: Ensure auth.log file is present.
|
- name: Ensure auth.log file is present.
|
||||||
copy:
|
copy:
|
||||||
@@ -38,7 +38,7 @@
|
|||||||
content: ""
|
content: ""
|
||||||
force: false
|
force: false
|
||||||
mode: 0644
|
mode: 0644
|
||||||
when: ansible_distribution == 'Debian'
|
when: ansible_facts["distribution"] == 'Debian'
|
||||||
|
|
||||||
roles:
|
roles:
|
||||||
- role: palkx.users
|
- role: palkx.users
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
- name: Create users
|
- name: Create users
|
||||||
ansible.builtin.include_tasks: user.yml
|
ansible.builtin.include_tasks: user.yml
|
||||||
when: ansible_default_ipv4.address in users[username]['passwords'] or users[username]['passwords'].get('default')
|
when: ansible_default_ipv4.address in users[username]['passwords'] or users[username]['passwords'].get('default', '') != ''
|
||||||
with_items: "{{ users.keys() }}"
|
with_items: "{{ users.keys() }}"
|
||||||
loop_control:
|
loop_control:
|
||||||
loop_var: username
|
loop_var: username
|
||||||
|
|||||||
@@ -11,15 +11,15 @@
|
|||||||
ansible.builtin.user:
|
ansible.builtin.user:
|
||||||
name: "{{ username }}"
|
name: "{{ username }}"
|
||||||
password: "{{ users[username]['passwords'].get(ansible_default_ipv4.address) }}"
|
password: "{{ users[username]['passwords'].get(ansible_default_ipv4.address) }}"
|
||||||
when: "ansible_default_ipv4.address in users[username]['passwords'] and
|
when: "ansible_facts['default_ipv4'].address in users[username]['passwords'] and
|
||||||
users[username]['passwords'].get(ansible_default_ipv4.address) != 'default'"
|
users[username]['passwords'].get(ansible_facts['default_ipv4'].address) != 'default'"
|
||||||
|
|
||||||
- name: "Set default password for user `{{ username }}`"
|
- name: "Set default password for user `{{ username }}`"
|
||||||
ansible.builtin.user:
|
ansible.builtin.user:
|
||||||
name: "{{ username }}"
|
name: "{{ username }}"
|
||||||
password: "{{ users[username]['passwords'].get('default') }}"
|
password: "{{ users[username]['passwords'].get('default') }}"
|
||||||
when: "ansible_default_ipv4.address not in users[username]['passwords'] or
|
when: "ansible_facts['default_ipv4'].address not in users[username]['passwords'] or
|
||||||
users[username]['passwords'].get(ansible_default_ipv4.address) == 'default'"
|
users[username]['passwords'].get(ansible_facts['default_ipv4'].address) == 'default'"
|
||||||
|
|
||||||
- name: "Setup ssh key for user `{{ username }}`"
|
- name: "Setup ssh key for user `{{ username }}`"
|
||||||
ansible.posix.authorized_key:
|
ansible.posix.authorized_key:
|
||||||
|
|||||||
Reference in New Issue
Block a user