我有一个自定义应用程序(myApp),它将日志写入文件'/ var/log/myApp'.我可以看到正在编写的日志,它工作正常.现在我正在尝试为此文件设置logrotate,为此我创建了一个配置文件'/etc/logrotate.d/myApp',其内容是 -
/var/log/myApp {
missingok
size +10k
start 0
nocompress
create 0600 root root
rotate 10
postrotate
/etc/init.d/rsyslog restart > /dev/null 2>&1 || true
endscript
}
Run Code Online (Sandbox Code Playgroud)
现在,如果我这样做,logrotate -dv /etc/logrotate.d/myApp我没有看到任何错误,当logrotate -f /etc/logrotate.d/myApp执行时,即强制logrotate旋转日志.但是当日志文件大小超过10k时,日志不会自动旋转.任何帮助,将不胜感激.
我的 Makefile 有以下步骤
create:
do create stuff
# extra ansible adhoc command to wait for ssh
setup:
do other stuff
Run Code Online (Sandbox Code Playgroud)
我想在do create stuff等待所有主机都可以访问其 ssh 端口之后添加一个步骤,但我不想提交一个额外的剧本来执行此操作:
- hosts: all
tasks:
- name: wait for ssh port
wait_for:
host: '{{ ansible_ssh_host }}'
port: 22
timeout: 300
delegate_to: localhost
Run Code Online (Sandbox Code Playgroud)
我尝试使用一个临时命令来运行上面的命令,但使用本地操作
ansible all -i inventory -m local_action -a 'wait_for port=22 timeout=300'
Run Code Online (Sandbox Code Playgroud)
但这不是正确的原因
ERROR! this task 'local_action' has extra params, which is only allowed in the following modules: command, win_command, shell, win_shell, script, …Run Code Online (Sandbox Code Playgroud) 我创建了一个秘密并更新它以具有lambda旋转功能
我的秘密看起来像
aws secretsmanager list-secret-version-ids --secret-id envir/username
{
"Versions": [
{
"VersionId": "90179cd3-daa1-48e4-9fe5-dde0a4cf22e4",
"VersionStages": [
"AWSPREVIOUS"
],
"LastAccessedDate": 1524528000.0,
"CreatedDate": 1524568488.358
},
{
"VersionId": "60576823-5d98-4360-af53-7e1f909b88d0",
"VersionStages": [
"AWSCURRENT"
],
"LastAccessedDate": 1524528000.0,
"CreatedDate": 1524568827.466
}
],
"ARN": "arn:aws:secretsmanager:eu-west-1:8282828282828:secret:username-YdgbPA",
"Name": "envir/username"
}
Run Code Online (Sandbox Code Playgroud)
当我尝试旋转它时,我收到此错误
An error occurred (InvalidRequestException) when calling the RotateSecret operation: A previous rotation isn’t complete. That rotation will be reattempted.
Run Code Online (Sandbox Code Playgroud)
如果我没有问题触发lambda函数,我可以毫无问题地轮换秘密.
有人有什么想法吗?
相关链接:
AWSPENDING状态.我需要使用Ansible脚本添加没有密码的组和用户(nologin用户)。
我执行以下命令:
$ansible-playbook deploy_nagios_client.yml -i hosts -e hosts=qa1-jetty -v
Run Code Online (Sandbox Code Playgroud)
下边是 main.yml
---
# Create Nagios User and Group
- name: Add group "nagios"
group: name=nagios
become: true
- name: Add user "nagios"
user: name=nagios groups=nagios password="" shell=/bin/bash append=yes comment="Nagios nologin User" state=present
become: true
Run Code Online (Sandbox Code Playgroud)
我有这个结构
hosts
host_vars/server-foo/public.yml
group_vars/staging/public.yml
Run Code Online (Sandbox Code Playgroud)
在hosts文件中我已经定义了这样一个组
[staging]
server-foo
Run Code Online (Sandbox Code Playgroud)
我试图定义一个只适用于的变量server-foo,所以我将该行添加到文件中host_vars/server-foo/public.yml
bar: true
Run Code Online (Sandbox Code Playgroud)
当我尝试运行剧本时,我得到一个错误
fatal: [staging-accounts] => error while evaluating conditional: bar
Run Code Online (Sandbox Code Playgroud)
如果我添加bar: true到group_vars/staging/public.yml,则将变量的回升没有任何问题.
我有什么想法吗?我相信我一直在遵循ansible建议的方法来定义主机特定变量.