Infra/ansible/roles/proxmox/tasks/main.yml
2022-04-15 15:51:58 +02:00

35 lines
822 B
YAML

- name: Get users
become: "{{ do_become }}"
command:
argv:
- pvesh
- get
- /access/users
- --output-format=json
register: pve_users
- name: Create users
when: item.username not in (pve_users.stdout | from_json | community.general.json_query('[*].userid') |replace("@pam", ""))
include_tasks: create_user.yml
loop: "{{ users | selectattr('system', 'contains', 'proxmox') | flatten(levels=1) }}"
- name: Disable SWAP sysctl on host
become: true
ansible.posix.sysctl:
name: vm.swappiness
value: "0"
state: present
- name: Disable SWAP on host
become: true
ansible.builtin.command: swapoff -a
- name: Remove swapfile from /etc/fstab on host
become: true
ansible.posix.mount:
name: "{{ item }}"
fstype: swap
state: absent
with_items:
- swap