ansible example
作者:互联网
Ansible Role
修改文件一行
- name: modify hard limit of max open files number
lineinfile:
path: /etc/security/limits.conf
regexp: '^root hard nofile'
insertafter: EOF
line: 'root hard nofile 654321'
文件是否存在
- name: verify if the binary is exist
stat:
path: "{{ deploy_dir }}/bin"
register: stat_binary
变量名不能有 “-”
rpm 解压
- name: unzip rpm file
shell: "{{ item }}"
with_items:
- "cd {{ deploy_dir }} && rpm2cpio {{ nebula_packages.name }} |cpio -div"
- "mv {{ deploy_dir }}/usr/local/nebula/bin {{ deploy_dir }}/"
- "mv {{ deploy_dir }}/usr/local/nebula/etc {{ deploy_dir }}/"
- "mv {{ deploy_dir }}/usr/local/nebula/share {{ deploy_dir }}/"
- "mv {{ deploy_dir }}/usr/local/nebula/scripts {{ deploy_dir }}/"
when:
- not stat_binary.stat.exists
- pkg == 'rpm'
标签:deploy,nebula,ansible,mv,usr,local,example,dir 来源: https://www.cnblogs.com/kouwei/p/16491628.html