From dd4ba90a3325cd1af3a5f08e171e5fae77c338d2 Mon Sep 17 00:00:00 2001 From: cradle8810 Date: Tue, 23 Apr 2024 16:40:07 +0900 Subject: [PATCH] =?UTF-8?q?rui.hayaworld.local=E3=81=AB=E4=BE=9D=E5=AD=98?= =?UTF-8?q?=E3=81=99=E3=82=8Btasks=E3=81=AELint=E7=B5=90=E6=9E=9C=E3=82=92?= =?UTF-8?q?=E5=8F=8D=E6=98=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rui.yml | 29 +++++++++++++++++++++-------- tasks/rui/dnsmasq.yml | 16 +++++++++++----- tasks/rui/journalctl.yml | 1 + tasks/rui/rsyslog-rui.yml | 2 ++ 4 files changed, 35 insertions(+), 13 deletions(-) diff --git a/rui.yml b/rui.yml index 2b38707..f7c93da 100644 --- a/rui.yml +++ b/rui.yml @@ -1,5 +1,6 @@ --- -- hosts: rui +- name: Play for rui.hayaworld.local + hosts: rui remote_user: hayato gather_facts: false become: true @@ -13,7 +14,9 @@ - inventories/host_vars/hosts_hayaworld.yml handlers: - - import_tasks: handlers/main.yml + - name: Restart handler tasks + ansible.builtin.import_tasks: + file: handlers/main.yml tasks: - name: Set Hostname @@ -22,9 +25,11 @@ tags: - network - - import_tasks: tasks/authorized_keys.yml + - name: Put authorized Key + ansible.builtin.import_tasks: + file: tasks/authorized_keys.yml - - name: put motd + - name: Put motd ansible.builtin.copy: src: templates/rui/etc/motd dest: /etc/motd @@ -45,15 +50,23 @@ - system - name: Show hosts(5) - debug: + ansible.builtin.debug: msg: "{{ lookup('template', './templates/rui/etc/hosts.j2') }}" tags: - debug - dryrun - - import_tasks: tasks/rui/dnsmasq.yml - - import_tasks: tasks/rui/journalctl.yml - - import_tasks: tasks/rui/rsyslog-rui.yml + - name: Setup dnsmask + ansible.builtin.import_tasks: + file: tasks/rui/dnsmasq.yml + + - name: Setup journalctl + ansible.builtin.import_tasks: + file: tasks/rui/journalctl.yml + + - name: Setup rsyslog + ansible.builtin.import_tasks: + file: tasks/rui/rsyslog-rui.yml tags: - rsyslog - dnsmasq diff --git a/tasks/rui/dnsmasq.yml b/tasks/rui/dnsmasq.yml index 2235151..b49a11d 100644 --- a/tasks/rui/dnsmasq.yml +++ b/tasks/rui/dnsmasq.yml @@ -5,12 +5,13 @@ dest: /etc/dnsmasq.conf owner: root group: root + mode: '0644' notify: "Restart dnsmasq" tags: - dnsmasq - name: Show dnsmasq.conf - debug: + ansible.builtin.debug: msg: "{{ lookup('template', './templates/rui/etc/dnsmasq.conf.j2') }}" tags: - debug @@ -22,12 +23,13 @@ dest: /etc/dnsmasq.d/resolv.txt owner: root group: root + mode: '0644' notify: "Restart dnsmasq" tags: - dnsmasq - name: Show dnsmasq.resolv.txt - debug: + ansible.builtin.debug: msg: "{{ lookup('template', './templates/rui/etc/dnsmasq.d/resolv.txt.j2') }}" tags: - debug @@ -39,12 +41,13 @@ dest: /etc/dnsmasq.d/dhcp_static.conf owner: root group: root + mode: '0644' notify: "Restart dnsmasq" tags: - dnsmasq - name: Show static DHCP config - debug: + ansible.builtin.debug: msg: "{{ lookup('template', './templates/rui/etc/dnsmasq.d/dhcp_static.conf.j2') }}" tags: - debug @@ -56,12 +59,13 @@ dest: /etc/dnsmasq.d/cname.conf owner: root group: root + mode: '0644' notify: "Restart dnsmasq" tags: - dnsmasq - name: Show cname config - debug: + ansible.builtin.debug: msg: "{{ lookup('template', './templates/rui/etc/dnsmasq.d/cname.conf.j2') }}" tags: - debug @@ -73,12 +77,13 @@ dest: /etc/dnsmasq.d/blocklist.conf owner: root group: root + mode: '0644' notify: "Restart dnsmasq" tags: - dnsmasq - name: Show cname config - debug: + ansible.builtin.debug: msg: "{{ lookup('template', './templates/rui/etc/dnsmasq.d/blocklist.conf.j2') }}" tags: - debug @@ -90,6 +95,7 @@ dest: /etc/hosts owner: root group: root + mode: '0644' notify: "Restart dnsmasq" tags: - dnsmasq diff --git a/tasks/rui/journalctl.yml b/tasks/rui/journalctl.yml index 3dc882b..dec9767 100644 --- a/tasks/rui/journalctl.yml +++ b/tasks/rui/journalctl.yml @@ -6,4 +6,5 @@ dest: /etc/systemd/journald.conf owner: root group: root + mode: '0644' notify: "Restart systemd-journald" diff --git a/tasks/rui/rsyslog-rui.yml b/tasks/rui/rsyslog-rui.yml index 471185f..512833c 100644 --- a/tasks/rui/rsyslog-rui.yml +++ b/tasks/rui/rsyslog-rui.yml @@ -6,6 +6,7 @@ dest: /etc/rsyslog.conf owner: root group: root + mode: '0644' notify: "Restart rsyslog" - name: Put logrotate.conf(5) @@ -14,4 +15,5 @@ dest: /etc/logrotate.conf owner: root group: root + mode: '0644' notify: "Restart rsyslog"