diff options
author | Romain Gonçalves <me@rgoncalves.se> | 2022-10-22 16:41:45 +0200 |
---|---|---|
committer | Romain Gonçalves <me@rgoncalves.se> | 2022-10-22 16:41:45 +0200 |
commit | 0df015e9b5c4aefd4245c94ee98021d2af80ed99 (patch) | |
tree | d9dbf4259500857daf41b627dbc2d116ba92dbc1 /roles/vmm/tasks | |
parent | 1cd2d31e0d5f81ce066121de78c0ed042fc3b6aa (diff) | |
download | rules-0df015e9b5c4aefd4245c94ee98021d2af80ed99.tar.gz |
lint: pass ansible-lint + yamllint
Diffstat (limited to 'roles/vmm/tasks')
-rw-r--r-- | roles/vmm/tasks/autoinstall_configuration.yml | 14 | ||||
-rw-r--r-- | roles/vmm/tasks/disk.yml | 8 | ||||
-rw-r--r-- | roles/vmm/tasks/facts.yml | 4 | ||||
-rw-r--r-- | roles/vmm/tasks/iso.yml | 3 | ||||
-rw-r--r-- | roles/vmm/tasks/main.yml | 16 | ||||
-rw-r--r-- | roles/vmm/tasks/network.yml | 8 |
6 files changed, 27 insertions, 26 deletions
diff --git a/roles/vmm/tasks/autoinstall_configuration.yml b/roles/vmm/tasks/autoinstall_configuration.yml index 1f8cf07..4eccb93 100644 --- a/roles/vmm/tasks/autoinstall_configuration.yml +++ b/roles/vmm/tasks/autoinstall_configuration.yml @@ -1,8 +1,8 @@ - name: include httpd role variables - include_vars: "{{ inventory_dir }}/roles/httpd/defaults/main.yml" + ansible.builtin.include_vars: "{{ inventory_dir }}/roles/httpd/defaults/main.yml" - name: create autoinstall directory - file: + ansible.builtin.file: path: "{{ vmm_autoinstall_dir }}" owner: www group: www @@ -10,7 +10,7 @@ state: directory - name: generate autoinstall configurations - template: &generation_steps + ansible.builtin.template: &generation_steps src: autoinstall.conf.j2 dest: "{{ vmm_autoinstall_dir }}/{{ item.lladdr }}-install.conf" owner: www @@ -20,14 +20,14 @@ loop: "{{ vmm_vms }}" - name: generate autoupgrade configurations - template: + ansible.builtin.template: <<: *generation_steps dest: "{{ vmm_autoinstall_dir }}/{{ item.lladdr }}-upgrade.conf" when: item.image == "openbsd" loop: "{{ vmm_vms }}" - name: generate disklabel configurations - template: + ansible.builtin.template: <<: *generation_steps src: disklabel.j2 dest: "{{ vmm_autoinstall_dir }}/{{ item.lladdr }}-disklabel.conf" @@ -35,7 +35,7 @@ loop: "{{ vmm_vms }}" - name: generate httpd configuration - template: + ansible.builtin.template: <<: *generation_steps src: httpd.conf.j2 dest: "{{ httpd_configuration_dir }}/autoinstall.conf" @@ -43,7 +43,7 @@ group: 0 - name: link openbsd vm kernel to host kernel - file: + ansible.builtin.file: src: /bsd.sp dest: "{{ vmm_image_openbsd_kernel_prefix }}.{{ item.name }}" owner: 0 diff --git a/roles/vmm/tasks/disk.yml b/roles/vmm/tasks/disk.yml index 95427c6..01fdc48 100644 --- a/roles/vmm/tasks/disk.yml +++ b/roles/vmm/tasks/disk.yml @@ -1,5 +1,5 @@ - name: create disks - command: + ansible.builtin.command: cmd: vmctl create -s "{{ item.size }}" "{{ item.name }}.{{ vmm_disk_format }}" chdir: "{{ vmm_disk_dir }}" loop: "{{ vmm_vms }}" @@ -10,13 +10,13 @@ - "'File exists' not in result.stderr" - name: retrieve existing disks - find: + ansible.builtin.find: path: "{{ vmm_disk_dir }}" patterns: "*.{{ vmm_disk_format }}" register: result - name: append disks informations to vms facts - set_fact: + ansible.builtin.set_fact: vmm_vms_tmp: > {{ vmm_vms_tmp | default([]) + [ item | combine({ "disk": result.files @@ -25,5 +25,5 @@ loop: "{{ vmm_vms }}" - name: save variables - set_fact: + ansible.builtin.set_fact: vmm_vms: "{{ vmm_vms_tmp }}" diff --git a/roles/vmm/tasks/facts.yml b/roles/vmm/tasks/facts.yml index 8362afb..c3ae20c 100644 --- a/roles/vmm/tasks/facts.yml +++ b/roles/vmm/tasks/facts.yml @@ -1,5 +1,5 @@ - name: generate lladdr variable for virtual machines - set_fact: + ansible.builtin.set_fact: vmm_vms_tmp: > {{ vmm_vms_tmp | default([]) + [ item | combine({ "lladdr": item.name @@ -11,5 +11,5 @@ loop: "{{ vmm_vms }}" - name: save variables - set_fact: + ansible.builtin.set_fact: vmm_vms: "{{ vmm_vms_tmp }}" diff --git a/roles/vmm/tasks/iso.yml b/roles/vmm/tasks/iso.yml index 0811ac1..320e7ca 100644 --- a/roles/vmm/tasks/iso.yml +++ b/roles/vmm/tasks/iso.yml @@ -1,7 +1,8 @@ - name: download latest iso files - get_url: + ansible.builtin.get_url: url: "{{ item.url }}" dest: "{{ vmm_iso_dir }}/{{ item.name }}-latest.iso" checksum: "{{ item.checksum }}" + mode: 0644 tags: task_iso loop: "{{ vmm_iso }}" diff --git a/roles/vmm/tasks/main.yml b/roles/vmm/tasks/main.yml index bb0d501..7e1359e 100644 --- a/roles/vmm/tasks/main.yml +++ b/roles/vmm/tasks/main.yml @@ -1,5 +1,5 @@ - name: create vmm directories - file: + ansible.builtin.file: path: "{{ item }}" owner: 0 group: 0 @@ -11,26 +11,26 @@ - "{{ vmm_disk_dir }}" - name: include facts generation - include_tasks: facts.yml + ansible.builtin.include_tasks: facts.yml - name: include autoinstall generation - include_tasks: autoinstall_configuration.yml + ansible.builtin.include_tasks: autoinstall_configuration.yml tags: task_autoinstall_configuration - name: include iso management - include_tasks: iso.yml + ansible.builtin.include_tasks: iso.yml tags: task_iso - name: include disk management - include_tasks: disk.yml + ansible.builtin.include_tasks: disk.yml tags: task_disk - name: include network management - include_tasks: network.yml + ansible.builtin.include_tasks: network.yml tags: task_network - name: generate vmm configuration - template: + ansible.builtin.template: src: vm.conf.j2 dest: "{{ vmm_configuration_file }}" owner: 0 @@ -40,7 +40,7 @@ - lint vmm configuration - name: restart and enable vmd - service: + ansible.builtin.service: name: vmd state: restarted enabled: true diff --git a/roles/vmm/tasks/network.yml b/roles/vmm/tasks/network.yml index 9886e59..82f3597 100644 --- a/roles/vmm/tasks/network.yml +++ b/roles/vmm/tasks/network.yml @@ -1,11 +1,11 @@ - name: start ip forwarding - command: sysctl net.inet.ip{{ item }}.forwarding=1 + ansible.builtin.command: sysctl net.inet.ip{{ item }}.forwarding=1 loop: "{{ vmm_network_forwarded_ips }}" register: result changed_when: item ~ "->" ~ item not in result.stdout_lines - name: enable ip forwarding - lineinfile: + ansible.builtin.lineinfile: path: /etc/sysctl.conf regexp: "^net.inet.ip{{ item }}.forwarding=" line: "net.inet.ip{{ item }}.forwarding=1" @@ -16,7 +16,7 @@ loop: "{{ vmm_network_forwarded_ips }}" - name: create network switch - lineinfile: + ansible.builtin.lineinfile: path: "/etc/hostname.{{ vmm_network_switch.interface }}" regexp: &network_line "add {{ ansible_default_ipv4.interface }}" line: *network_line @@ -26,4 +26,4 @@ create: true - name: start network switch # noqa: no-changed-when - command: "sh /etc/netstart {{ vmm_network_switch.interface }}" + ansible.builtin.command: "sh /etc/netstart {{ vmm_network_switch.interface }}" |