0基础Linux从入门到精通

2024-09-01 10:42:40 浏览数 (2)

先整理几张图

发展趋势

行业发展行业发展

上图

详情详情

阶段

devops运维开发

代码语言:yml复制

# vim hosts.j2
*
*
{% for host in groups['all'] %}
{{ hostvars[host]['ansible_facts']['default_ipv4']['address'] }} {{ hostvars[host]['ansible_facts']['fqdn'] }} 
{{ hostvars[host]['ansible_facts']['hostname'] }}
{% endfor %}
# vim hosts.yml
---
- name: create myhosts
 hosts: all
 tasks:
 - name: template a file /etc/myhosts
 template:
 src: /home/greg/ansible/hosts.j2
 dest: /etc/myhosts
 #when: '"dev" in group_names'
 when: 'inventory_hostname in groups.dev'
# ansible-playbook hosts.yml

0 人点赞