我有一个名为的文件authorized_keys。我需要使用Ansible脚本删除特定行。
问题是当我尝试删除包含'+'字符的行时。Ansible无法删除此行。
例如authorized_keys文件是:
.....
abhi foo+bar saken
......(EOF)
Run Code Online (Sandbox Code Playgroud)
我想删除该abhi foo+bar saken行,但Ansible不会因为该+字符而删除此行。
我可以删除不包含+字符的行。
任务:
- name: Delete keys in sysadmin/.ssh/authoriezd_keys
lineinfile: dest=/home/{{name}}/.ssh/authorized_keys
state=absent
regexp='^{{key}}$'
Run Code Online (Sandbox Code Playgroud)
PS:我正在使用Ansible的lineinfile模块
我正在使用ansible-vault来设置密码保护var/main.yml文件.现在我可以在源代码控制系统中推送我的源代码了.之后在生产服务器中部署.假设有人操纵密码或忘记了密码.有没有办法恢复ansible-vault密码或再次设置新密码而不询问旧密码?
提前致谢
我有一个列族和语法如下:
CREATE TABLE sr_number_callrecord (
id int,
callerph text,
sr_number text,
callid text,
start_time text,
plan_id int,
PRIMARY KEY((sr_number), start_time, callerph)
);
Run Code Online (Sandbox Code Playgroud)
我想做的查询如下:
a) select * from dummy where sr_number='+919xxxx8383'
and start_time >='2014-12-02 08:23:18' limit 10;
b) select * from dummy where sr_number='+919xxxxxx83'
and start_time >='2014-12-02 08:23:18'
and callerph='+9120xxxxxxxx0' limit 10;
Run Code Online (Sandbox Code Playgroud)
第一个查询工作正常,但第二个查询给出错误
Bad Request: PRIMARY KEY column "callerph" cannot be restricted
(preceding column "start_time" is either not restricted or by a non-EQ
relation)
Run Code Online (Sandbox Code Playgroud)
如果我在第一个查询中得到结果,在第二个查询中,我只是添加一个
集群密钥以获取过滤结果,行将更少
我想知道以下 2 个命令cat和fold命令之间的区别?我只是使用fold命令,它的作用就像cat命令一样。
fold file1.txt
cat fold.txt (both are using to display the contents of the file)
Run Code Online (Sandbox Code Playgroud)