diff --git a/roles/deploy/tasks/main.yml b/roles/deploy/tasks/main.yml index 5f93f0d..e50115e 100644 --- a/roles/deploy/tasks/main.yml +++ b/roles/deploy/tasks/main.yml @@ -119,6 +119,7 @@ copy: src=~/.ssh/{{ item }} dest=~/.ssh/{{ item }} mode=0600 with_items: - id_rsa + - id_rsa.pub - known_hosts run_once: true when: "ansible_env['SSH_CLIENT'].split(' ')[0] != inventory_hostname" diff --git a/roles/docker/tasks/main.yml b/roles/docker/tasks/main.yml index 19d8033..4f78a96 100644 --- a/roles/docker/tasks/main.yml +++ b/roles/docker/tasks/main.yml @@ -96,4 +96,5 @@ # 配置 docker 命令软链接,方便单独安装 docker - name: 配置 docker 命令软链接 file: src={{ bin_dir }}/docker dest=/usr/bin/docker state=link + ignore_errors: true when: "'kubeasz' not in install_info.stdout" diff --git a/roles/prepare/tasks/centos.yml b/roles/prepare/tasks/centos.yml index 96b170f..2b67818 100644 --- a/roles/prepare/tasks/centos.yml +++ b/roles/prepare/tasks/centos.yml @@ -32,3 +32,14 @@ dest: /etc/selinux/config regexp: "^SELINUX=" line: "SELINUX=disabled" + +# 优化设置 journal 日志相关,避免日志重复搜集,浪费系统资源 +- name: 禁止rsyslog获取journald日志 + lineinfile: + dest: /etc/rsyslog.conf + state: present + regexp: 'ModLoad imjournal' + line: '#$ModLoad imjournal # provides access to the systemd journal' + +- name: 重启rsyslog服务 + service: name=rsyslog state=restarted diff --git a/roles/prepare/tasks/common.yml b/roles/prepare/tasks/common.yml index bbc452b..108e4c8 100644 --- a/roles/prepare/tasks/common.yml +++ b/roles/prepare/tasks/common.yml @@ -42,16 +42,3 @@ - name: 把SCTP列入内核模块黑名单 copy: src=sctp.conf dest=/etc/modprobe.d/sctp.conf - -# 优化设置 journal 日志相关 -- name: 准备 journal 日志相关目录 - file: name={{ item }} state=directory - with_items: - - "/etc/systemd/journald.conf.d" - - "/var/log/journal" - -- name: 优化设置 journal 日志 - template: src=95-k8s-journald.conf.j2 dest=/etc/systemd/journald.conf.d/95-k8s-journald.conf - -- name: 重启 journald 服务 - service: name=systemd-journald state=restarted diff --git a/roles/prepare/tasks/debian.yml b/roles/prepare/tasks/debian.yml index 0e55bc1..913aaee 100644 --- a/roles/prepare/tasks/debian.yml +++ b/roles/prepare/tasks/debian.yml @@ -28,3 +28,16 @@ dest: /etc/profile regexp: "ulimit -SHn" line: "ulimit -SHn 65535" + +# 优化设置 journal 日志相关,避免日志重复搜集,浪费系统资源 +- name: 准备 journal 日志相关目录 + file: name={{ item }} state=directory + with_items: + - "/etc/systemd/journald.conf.d" + - "/var/log/journal" + +- name: 优化设置 journal 日志 + template: src=95-k8s-journald.conf.j2 dest=/etc/systemd/journald.conf.d/95-k8s-journald.conf + +- name: 重启 journald 服务 + service: name=systemd-journald state=restarted