From 2dded296b1bdf4e8deff9d5eae39ca7a1c10720a Mon Sep 17 00:00:00 2001 From: uvok cheetah Date: Tue, 31 Oct 2023 17:09:08 +0100 Subject: Linting! indentation, naming, quoting, parameters, modes --- apt_proxy.yml | 6 +++--- fixsources.yml | 2 +- hello_world.yml | 12 +++++++----- roles/common/tasks/main.yml | 2 +- roles/dns/tasks/main.yml | 2 +- roles/router/tasks/main.yml | 5 +++-- roles/router/tasks/tinc.yml | 7 +++++-- root_ls_color.yml | 14 +++++++------- router.yml | 8 ++++---- upgrade.yml | 34 +++++++++++++++++----------------- 10 files changed, 49 insertions(+), 43 deletions(-) diff --git a/apt_proxy.yml b/apt_proxy.yml index 6aeabe6..6b66ae0 100644 --- a/apt_proxy.yml +++ b/apt_proxy.yml @@ -6,6 +6,6 @@ copy: src: files/apt_proxy.conf dest: /etc/apt/apt.conf.d/proxy - mode: 0640 - force: no - backup: yes + mode: "0640" + force: false + backup: true diff --git a/fixsources.yml b/fixsources.yml index e572cb6..ab187d4 100644 --- a/fixsources.yml +++ b/fixsources.yml @@ -1,3 +1,4 @@ +--- - name: Fixup sources.list hosts: internal tasks: @@ -13,4 +14,3 @@ regexp: "ftp.uni-bayreuth.de/debian-security" replace: "security.debian.org/debian-security" backup: true - diff --git a/hello_world.yml b/hello_world.yml index 67b340d..66af787 100644 --- a/hello_world.yml +++ b/hello_world.yml @@ -1,10 +1,12 @@ +--- # To run this, name this file hello_world.yml and run the following in the same directory # ansible-playbook hello_world.yml -i 'local,' --connection=local -- name: hello world example +- name: Hello world example hosts: all tasks: - - name: Create a directory - file: - path=hello_world - state=directory + - name: Create a directory + file: + path: hello_world + state: directory + mode: '0600' diff --git a/roles/common/tasks/main.yml b/roles/common/tasks/main.yml index bf2dd00..627190f 100644 --- a/roles/common/tasks/main.yml +++ b/roles/common/tasks/main.yml @@ -1,5 +1,5 @@ --- -- name: install basic +- name: Install basic package: name: - rsync diff --git a/roles/dns/tasks/main.yml b/roles/dns/tasks/main.yml index 0a2120b..d824945 100644 --- a/roles/dns/tasks/main.yml +++ b/roles/dns/tasks/main.yml @@ -1,5 +1,5 @@ --- -- name: install DNS software +- name: Install DNS software package: name: - dnsmasq diff --git a/roles/router/tasks/main.yml b/roles/router/tasks/main.yml index ee09493..c319b4a 100644 --- a/roles/router/tasks/main.yml +++ b/roles/router/tasks/main.yml @@ -1,5 +1,5 @@ --- -- name: install routing software +- name: Install routing software package: name: - tinc @@ -13,9 +13,10 @@ - tinc is defined - tinc.configure is defined - tinc.configure -- name: copy munin plugin +- name: Copy munin plugin copy: src: munin_bird dest: /usr/local/share/munin/plugins/bird + mode: '0750' tags: - munin diff --git a/roles/router/tasks/tinc.yml b/roles/router/tasks/tinc.yml index 682fa0f..2673a59 100644 --- a/roles/router/tasks/tinc.yml +++ b/roles/router/tasks/tinc.yml @@ -1,21 +1,25 @@ +--- - name: Ensure tinc directory exists ansible.builtin.file: path: '/etc/tinc/tn_int/' state: directory + mode: '0750' - name: Install tinc.conf template template: src: tinc.conf.j2 dest: /etc/tinc/tn_int/tinc.conf + mode: '0750' tags: - tconfig - name: Install tinc-up template template: src: tinc-up.j2 dest: /etc/tinc/tn_int/tinc-up + mode: '0740' tags: - tconfig - name: Copy remaining files - synchronize: + ansible.posix.synchronize: src: tn_int/ dest: /etc/tinc/tn_int/ archive: false @@ -26,7 +30,6 @@ path: "/etc/tinc/tn_int/{{ item }}" mode: "0740" with_items: - - tinc-up - tinc-down tags: - exec diff --git a/root_ls_color.yml b/root_ls_color.yml index c40232b..2eee03b 100644 --- a/root_ls_color.yml +++ b/root_ls_color.yml @@ -1,11 +1,11 @@ +--- - name: Make sure colorful ls hosts: internal gather_facts: false tasks: - - name: Add line - lineinfile: - path: ~/.bashrc - state: present - search_string: "alias ls='ls --color=auto'" - line: "alias ls='ls -F --color=auto'" - + - name: Add line + lineinfile: + path: ~/.bashrc + state: present + search_string: "alias ls='ls --color=auto'" + line: "alias ls='ls -F --color=auto'" diff --git a/router.yml b/router.yml index 0c6191b..4383112 100644 --- a/router.yml +++ b/router.yml @@ -1,6 +1,6 @@ --- -- hosts: routing +- name: "Install Router role" + hosts: routing roles: - - role: "roles/router" - - role: "roles/common" - + - role: "router" + - role: "common" diff --git a/upgrade.yml b/upgrade.yml index 2be8cce..4beddd4 100644 --- a/upgrade.yml +++ b/upgrade.yml @@ -1,21 +1,21 @@ +--- - name: Upgrade packages hosts: internal gather_facts: false tasks: - - name: Update and upgrade - apt: - update_cache: true - upgrade: safe - cache_valid_time: 3600 - register: result - - name: Dump debug result - debug: - var: result - - name: Check if reboot required - stat: - path: /var/run/reboot-required - register: reboot_required_file - - name: Reboot if required - reboot: - when: reboot_required_file.stat.exists == true - + - name: Update and upgrade + apt: + update_cache: true + upgrade: safe + cache_valid_time: 3600 + register: result + - name: Dump debug result + debug: + var: result + - name: Check if reboot required + stat: + path: /var/run/reboot-required + register: reboot_required_file + - name: Reboot if required + reboot: + when: reboot_required_file.stat.exists -- cgit v1.2.3