当前位置: 首页 > news >正文

查备案网站备案泰州网站建设价位

查备案网站备案,泰州网站建设价位,重庆商业网站有哪些,房管局网站建设目录常规操作系统发行版与操作系统家族1. RedHat 发行版家族2. Debian 发行版家族3. Suse 发行版家族4. Gentoo 发行版家族5. Archlinux 发行版家族6. Mandrake 发行版家族7. Solaris 发行版家族8. AIX9. Alpine 操作系统家族10. macOS – Darwin11. FreeBSD12. HP-UX13. Windo…

目录

  • 常规操作系统发行版与操作系统家族
    • 1. RedHat 发行版家族
    • 2. Debian 发行版家族
    • 3. Suse 发行版家族
    • 4. Gentoo 发行版家族
    • 5. Archlinux 发行版家族
    • 6. Mandrake 发行版家族
    • 7. Solaris 发行版家族
    • 8. AIX
    • 9. Alpine 操作系统家族
    • 10. macOS – Darwin
    • 11. FreeBSD
    • 12. HP-UX
    • 13. Windows
    • 14. 其他发行版示例
    • 15. ansible变量的两种使用方式 - ansible_facts字典引用、ansible_xxx_xxx变量名

Ansible是系统管理员、开发工程师、网络工程师等常用的自动化工具,通过编写Playbook,可以执行不同的管理任务。当需要根据不同的操作系统执行对应的操作的时候,就需要在Playbook中提前对目标操作系统进行检测,此时就需要用到ansible的内置变量 - facts的值。通过判断变量 ansible_facts['os_family']或者 ansible_facts[distribution]实现对远程被控主机操作系统家族以及发行版的检测。

在这里插入图片描述

常规操作系统发行版与操作系统家族

1. RedHat 发行版家族

下面的发行版均是来自RedHat 操作系统家族的成员:

  • RedHat
  • CentOS
  • Fedora
  • Scientific
  • CloudLinux
  • OracleLinux
  • Amazon
  • XenServer
  • OpenEuler

检测操作系统家族和发行版的使用方式如下:

# ansible_os_family
when: ansible_facts['os_family'] == "RedHat" # CentOS 8, CentOS 7,Fedora 33, Amazon Linux 2, e.t.c# ansible_distribution
when: ansible_facts['distribution'] == "CentOS" # CentOS 8,7,6
when: ansible_facts['distribution'] == "Amazon" # Amazon Linux
when: ansible_facts['distribution'] == "Fedora" # Fedora 33,32,31,..
when: (ansible_facts['distribution'] == "CentOS" and ansible_facts['distribution_major_version'] == "8") # CentOS 8 only

2. Debian 发行版家族

Debian家族的发行版成员主要如下:

  • Debian
  • Ubuntu

检测操作系统家族和发行版的使用方式如下:

# ansible_os_family
when: ansible_facts['os_family'] == "Debian" # Debian 10,9,..,Ubuntu 20.04,18.04,e.t.c# ansible_distribution
when: ansible_facts['distribution'] == "Debian" # Debian 10,9,8,..
when: ansible_facts['distribution'] == "Ubuntu" # Ubuntu 20.04, 18.04, 16.04,..
when: (ansible_facts['distribution'] == "Debian" and ansible_facts['distribution_major_version'] == "10") # Only Debian 10
when: (ansible_facts['distribution'] == "Ubuntu" and ansible_facts['distribution_major_version'] == "20") # Only Ubuntu 20.04

3. Suse 发行版家族

SUSE发行版系列的主要成员如下:

  • SUSE
  • SLED – SUSE Linux Enterprise Desktop
  • SLES – SUSE Linux Enterprise Server

检测操作系统家族和发行版的使用方式如下:

# ansible_os_family
when: ansible_facts['os_family'] == "Suse"# ansible_distribution
when: ansible_facts['distribution'] == "SLES"

4. Gentoo 发行版家族

主要成员如下:

  • Gentoo

检测操作系统家族和发行版的使用方式如下:

# ansible_os_family
when: ansible_facts['os_family'] == "Gentoo"# ansible_distribution
when: ansible_facts['distribution'] == "Gentoo"

5. Archlinux 发行版家族

主要成员如下:

  • Archlinux

检测操作系统家族和发行版的使用方式如下:

# ansible_os_family
when: ansible_facts['os_family'] == "Archlinux"# ansible_distribution
when: ansible_facts['distribution'] == "Archlinux"

6. Mandrake 发行版家族

主要成员如下:

  • Mandriva

检测操作系统家族和发行版的使用方式如下:

# ansible_os_family
when: ansible_facts['os_family'] == "Mandrake"# ansible_distribution
when: ansible_facts['distribution'] == "Mandriva"

7. Solaris 发行版家族

主要成员如下:

  • Solaris
  • Nexenta
  • OmniOS
  • OpenIndiana
  • SmartOS

检测操作系统家族和发行版的使用方式如下:

# ansible_os_family
when: ansible_facts['os_family'] == "Solaris"# ansible_distribution
when: ansible_facts['distribution'] == "OmniOS"
when: ansible_facts['distribution'] == "SmartOS"

8. AIX

检测操作系统家族和发行版的使用方式如下:

# ansible_os_family
when: ansible_facts['os_family'] == "AIX"

9. Alpine 操作系统家族

主要成员如下:

  • Alpine Linux

检测操作系统家族和发行版的使用方式如下:

# ansible_os_family
when: ansible_facts['os_family'] == "Alpine"# ansible_distribution
when: ansible_facts['distribution'] == "Alpine"

10. macOS – Darwin

检测操作系统家族和发行版的使用方式如下:

# ansible_os_family
when: ansible_facts['os_family'] == "Darwin"

11. FreeBSD

主要成员如下:

  • FreeBSD

检测操作系统家族和发行版的使用方式如下:

# ansible_os_family
when: ansible_facts['os_family'] == "FreeBSD"

12. HP-UX

主要成员如下:

  • HP-UX

检测操作系统家族和发行版的使用方式如下:

# ansible_os_family
when: ansible_facts['os_family'] == "HP-UX"

13. Windows

检测操作系统家族和发行版的使用方式如下:

# ansible_os_family
when: ansible_facts['os_family'] == "Windows"

14. 其他发行版示例

  • VMware ESXi
    检测操作系统家族和发行版的使用方式如下:
# ansible_distribution
when: ansible_facts['distribution'] == "VMwareESX"
  • OpenWrt
    检测操作系统家族和发行版的使用方式如下:
# ansible_distribution
when: ansible_facts['distribution'] == "OpenWrt"
  • CoreOS
    检测操作系统家族和发行版的使用方式如下:
# ansible_distribution
when: ansible_facts['distribution'] == "Coreos"
  • ALT Linux
    检测操作系统家族和发行版的使用方式如下:
# ansible_distribution
when: ansible_facts['distribution'] == "Altlinux"

15. ansible变量的两种使用方式 - ansible_facts字典引用、ansible_xxx_xxx变量名

除了上述的通过ansible_facts内置变量查询操作系统发行版的方式之外,还可以通过setup模块输出的完整变量名的方式来查询。具体如下:

列出所有的facts变量:

albertqee@ZBG7W:postgresql-17.5$ ansible all -i 'u24u04s1,' -m setup | egrep family
[WARNING]: Platform linux on host u24u04s1 is using the discovered Python
interpreter at /usr/bin/python3.12, but future installation of another Python
interpreter could change the meaning of that path. See
https://docs.ansible.com/ansible-
core/2.18/reference_appendices/interpreter_discovery.html for more information."ansible_os_family": "Debian",
albertqee@ZBG7W:postgresql-17.5$

在playbook中使用两种方式列出操作系统发行版:

#*************************************************************************
#    > File Name: main.yml
#    > Author: Albert Qee
#    > Created Time: 2025年07月25日 星期五 22时25分19秒
#    > Description: get os family
#    > Usage: ansible-playbook -i 'u24u04s1,' main.yml 
# ************************************************************************- hosts: all remote_user: rootgather_facts: truetasks:- name: display ip addressdebug:msg: "The IP address is {{ ansible_default_ipv4['address'] }}"  - name: display os familydebug:var: ansible_facts['os_family']          # ansible_facts[]字典的形式引用,此时索引名不带前缀的ansible_- name: another way to disply os familydebug:var: ansible_os_family                   # 直接使用setup模块输出的完整变量名的形式引用变量,此时变量名带前缀的ansible_

上述playbook的执行结果如下:

albertqee@ZBG7W:potgresql$ ansible-playbook -i 'u24u04s1,' main.yml PLAY [all] ***********************************************************************************************************************************************************************************TASK [Gathering Facts] ***********************************************************************************************************************************************************************
[WARNING]: Platform linux on host u24u04s1 is using the discovered Python interpreter at /usr/bin/python3.12, but future installation of another Python interpreter could change the meaning
of that path. See https://docs.ansible.com/ansible-core/2.18/reference_appendices/interpreter_discovery.html for more information.
ok: [u24u04s1]TASK [display ip address] ********************************************************************************************************************************************************************
ok: [u24u04s1] => {"msg": "The IP address is 192.168.122.125"
}TASK [display os family] *********************************************************************************************************************************************************************
ok: [u24u04s1] => {"ansible_facts['os_family']": "Debian"            # 通过ansible_facts['os_family]这种ansible_facts字典的方式引用
}TASK [another way to disply os family] *******************************************************************************************************************************************************
ok: [u24u04s1] => {"ansible_os_family": "Debian"                     # 通过直接的完整变量名的方式引用
}PLAY RECAP ***********************************************************************************************************************************************************************************
u24u04s1                   : ok=4    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   albertqee@ZBG7W:potgresql$
http://www.dtcms.com/a/409078.html

相关文章:

  • 网站公众号信息化建设工作计划有了域名之后怎么做自己的网站
  • 太原专业做网站做网站 客户大概会有那些问题
  • 网络营销 网站建设西部数码网站管理助手 ftp上传文件失败
  • 学习搭建网站wordpress 不同权限
  • 企业网站建设与网页制作wordpress云主机名
  • 开设网站步骤网络推广的优势
  • 手机网站给一个wordpress 插件 mysql
  • 网站不收录的解决办法上海发布
  • 建站兔软件常见问题自己做的网站怎么植入erp
  • 滨湖区建设局官方网站wordpress仿人人网
  • 网站seo优化要怎么做咨询公司成本费用包括哪些内容
  • 百度站长 添加网站wordpress中category参数
  • 开饰品店网站建设预算wordpress主题 摄影师
  • 海南智能网站建设设计小制作的制作过程
  • 广东品牌网站建设公司手机app微信网站
  • 景区网站的作用网站打开速度慢wordpress
  • 北京的网站建设公司有哪些开企网站建设
  • 自学网站建设推荐网站开发语言查看器
  • 做网站用什么字体字号php和mysql网站毕业设计
  • 做信息网站的盈利方式有哪些网站建设费用要摊销嘛
  • 蔬菜网站建设东莞阿里网站设计
  • 资源网站搭建网站后台如何用代码上传视频
  • 论坛网站建设联系方式个人简历ppt
  • 长沙做网站推荐北京注册公司网上申请入口
  • 注册网站不需要手机验证的营销型网站制作msgg
  • 网站快照建站之星备案
  • 安徽做网站的公司公众号开发微商城
  • 网站图片放大特效怎么做个人怎么做购物网站
  • 那个网站可以做全景图seo推广技术培训
  • 常规做网站要在工信部认证吗做网站哪里有