diff --git a/.config/ansible-lint-ignore.txt b/.config/ansible-lint-ignore.txt index a291862..2f0597b 100644 --- a/.config/ansible-lint-ignore.txt +++ b/.config/ansible-lint-ignore.txt @@ -84,14 +84,12 @@ roles/common/tasks/main.yml deprecated-local-action roles/common/tasks/main.yml deprecated-module roles/common/tasks/main.yml fqcn[action-core] roles/common/tasks/main.yml fqcn[action] -roles/common/tasks/main.yml jinja[spacing] roles/common/tasks/main.yml name[casing] roles/common/tasks/main.yml name[missing] roles/common/tasks/main.yml no-changed-when roles/common/tasks/main.yml no-handler roles/common/tasks/main.yml risky-shell-pipe roles/common/tasks/munin-node.yml fqcn[action-core] -roles/common/tasks/munin-node.yml jinja[spacing] roles/common/tasks/munin-node.yml name[casing] roles/common/tasks/munin-node.yml no-changed-when roles/common/tasks/nginx.yml fqcn[action-core] @@ -102,13 +100,11 @@ roles/common/tasks/ntp.yml name[casing] roles/common/tasks/ssh-tunnel.yml command-instead-of-shell roles/common/tasks/ssh-tunnel.yml fqcn[action-core] roles/common/tasks/ssh-tunnel.yml fqcn[action] -roles/common/tasks/ssh-tunnel.yml jinja[spacing] roles/common/tasks/ssh-tunnel.yml name[casing] roles/common/tasks/ssh-tunnel.yml name[missing] roles/common/tasks/ssh-tunnel.yml no-handler roles/common/tasks/sysctl.yml fqcn[action-core] roles/common/tasks/sysctl.yml fqcn[action] -roles/common/tasks/sysctl.yml jinja[spacing] roles/common/tasks/sysctl.yml name[casing] roles/common/tasks/sysstat.yml fqcn[action-core] roles/common/tasks/sysstat.yml name[casing] diff --git a/.config/ansible-lint.yml b/.config/ansible-lint.yml index 896a08d..dd2faeb 100644 --- a/.config/ansible-lint.yml +++ b/.config/ansible-lint.yml @@ -3,6 +3,7 @@ profile: production enable_list: - empty-string-compare + - jinja - no-free-form - no-log-password - no-prompting diff --git a/roles/common/tasks/main.yml b/roles/common/tasks/main.yml index 41275d0..0492033 100644 --- a/roles/common/tasks/main.yml +++ b/roles/common/tasks/main.yml @@ -1,6 +1,6 @@ - name: set proxmox password set_fact: - proxmox_password: "{{ lookup('env','PROXMOX_PASSWORD_'+proxmox_var.host.split('.')[0]) }}" + proxmox_password: "{{ lookup('env', 'PROXMOX_PASSWORD_' + proxmox_var.host.split('.')[0]) }}" when: proxmox_var is defined and vm_host is defined and lookup('env','PROXMOX_PASSWORD_'+proxmox_var.host.split('.')[0]) - name: init cache/templates/ @@ -71,7 +71,7 @@ onboot: yes ostemplate: "local:vztmpl/{{ proxmox_var.ostemplate }}" password: "{{ lookup('password', 'credentials/proxmox/' + inventory_hostname) }}" - pubkey: "{{ lookup('file', lookup('env','PROXMOX_SSHPUBKEY')) }}" + pubkey: "{{ lookup('file', lookup('env', 'PROXMOX_SSHPUBKEY')) }}" state: present storage: "{{ proxmox_var.storage }}" swap: "{{ proxmox_var.swap }}" @@ -113,7 +113,7 @@ ostype: "l26" scsi: scsi0: "{{ proxmox_var.storage }}:{{ proxmox_var.disk }},format=raw" - sshkeys: "{{ lookup('file', lookup('env','PROXMOX_SSHPUBKEY')) }}" + sshkeys: "{{ lookup('file', lookup('env', 'PROXMOX_SSHPUBKEY')) }}" state: present when: proxmox_password is defined and (proxmox_var.kvm is defined and proxmox_var.kvm == 1) register: create_vm @@ -139,7 +139,7 @@ ostype: "l26" scsi: scsi0: "{{ proxmox_var.storage }}:{{ proxmox_var.disk }},format=raw" - sshkeys: "{{ lookup('file', lookup('env','PROXMOX_SSHPUBKEY')) }}" + sshkeys: "{{ lookup('file', lookup('env', 'PROXMOX_SSHPUBKEY')) }}" state: present update: yes when: proxmox_password is defined and (proxmox_var.kvm is defined and proxmox_var.kvm == 1) @@ -232,7 +232,7 @@ block: | Host {{ item }} Hostname {{ hostvars[item].proxmox_var.ipv6 }} - with_items: '{{play_hosts}}' + with_items: '{{ play_hosts }}' when: proxmox_password is defined and (create_ct.changed or create_vm.changed) become: no @@ -242,7 +242,7 @@ module: known_hosts name: "{{ hostvars[item].proxmox_var.ipv6 }}" key: "{{ lookup('pipe', 'ssh-keyscan {{ hostvars[item].proxmox_var.ipv6 }}') }}" - with_items: '{{play_hosts}}' + with_items: '{{ play_hosts }}' when: proxmox_password is defined and (create_ct.changed or create_vm.changed) become: no @@ -491,9 +491,9 @@ - name: add ssh key to user backuppc authorized_key: user: backuppc - key: "{{ lookup('file',item) }}" + key: "{{ lookup('file', item) }}" with_fileglob: - - "{{ lookup('env','PWD') }}/public_keys/backuppc-*" + - "{{ lookup('env', 'PWD') }}/public_keys/backuppc-*" - name: create empty /var/www for backuppc file: diff --git a/roles/common/tasks/munin-node.yml b/roles/common/tasks/munin-node.yml index 4b27422..b6346fd 100644 --- a/roles/common/tasks/munin-node.yml +++ b/roles/common/tasks/munin-node.yml @@ -21,7 +21,7 @@ dest: /etc/munin/munin-node.conf regexp: "^host_name {{ inventory_hostname }}" insertafter: "^#host_name" - line: "host_name {{ inventory_hostname }}" + line: "host_name {{ inventory_hostname }}" notify: - restart munin-node diff --git a/roles/common/tasks/ssh-tunnel.yml b/roles/common/tasks/ssh-tunnel.yml index 8007f40..2fd21a3 100644 --- a/roles/common/tasks/ssh-tunnel.yml +++ b/roles/common/tasks/ssh-tunnel.yml @@ -46,5 +46,5 @@ tags: ssh-tunnel when: ansible_hostname == 'osm7' with_fileglob: - - "{{ lookup('env','PWD') }}/public_keys/ansible/{{ user }}-osm3" - - "{{ lookup('env','PWD') }}/public_keys/ansible/{{ user }}-osm101" + - "{{ lookup('env', 'PWD') }}/public_keys/ansible/{{ user }}-osm3" + - "{{ lookup('env', 'PWD') }}/public_keys/ansible/{{ user }}-osm101" diff --git a/roles/common/tasks/sysctl.yml b/roles/common/tasks/sysctl.yml index b6e9959..08e1d33 100644 --- a/roles/common/tasks/sysctl.yml +++ b/roles/common/tasks/sysctl.yml @@ -66,5 +66,5 @@ - name: Allow 2MB huge pages up to 60% of the RAM sysctl: name: vm.nr_overcommit_hugepages - value: "{{ ( ansible_memtotal_mb * 0.6 / 2)|int }}" + value: "{{ (ansible_memtotal_mb * 0.6 / 2) | int }}" sysctl_file: /etc/sysctl.d/ansible.conf