0%

ansible通过脚本获取inventory

很多场景下需要通过脚本按需(动态)获取inventory

  • 脚本必须实现--list--host <hostname>两个参数
  • 可执行权限
  • 结果以标准输出输出(返回)

--list: 返回所有的主机组信息

--host : 返回指定主机的变量信息(或空字典)

阅读全文 »

ansible inventory 插件

查看inventory-plugins列表

1
ansible-doc -t inventory -l

以vultr为例,查看其帮助文档和样例

1
ansible-doc -t inventory vultr

inventory_vultr.yml(配置文件必须以vultr.yml或者vultr.yaml结尾)

1
2
3
plugin: vultr
api_account: test@gmail.com
api_key: 33PGQLTDVPllRALLLLLLEVX24SAKBD4SNWWQ
阅读全文 »

名词解释

LUKS: Linux Unified Key Setup 一种硬盘加密规范,最初为Linux设计

cryptsetup: manage plain dm-crypt and LUKS encrypted volumes 说白了就是CLI

阅读全文 »

PCI(e)

PCI - Peripheral Component Interconnect 一种英特尔牵头推出的用于定义局部总线的标准

PCIe - Peripheral Component Interconnect Express,一种高速串行计算机扩展总线标准

  • 符合PCI总线标准的设备就被称之为PCI设备
  • 现在最常见的扩展槽是PCIe插槽,实际上在你看不见的计算机主板芯片内部,各种硬件控制模块大部分也是以PCIe设备的形式挂载到了一颗或者几颗PCI/PCIe设备树上
  • PCI和PCIe最大区别之一是由并行改为串行

参考深入PCI与PCIe之一:硬件篇

阅读全文 »

IP地址(IPv4)和数字互转

背景概要

IP地址长度: 4字节即32位构成, 分为了4部分

示例: 192.168.0.1

表示方法 第1部分 第2部分 第3部分 第4部分
2进制 11000000 10101000 00000000 00000001
点分10进制 192 168 0 1
阅读全文 »

pip 指定源

~/.pip/pip.conf

1
2
3
4
[global]
index-url = http://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host = mirrors.aliyun.com

or

临时指定

1
pip install pyyaml --user -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com

基于Ubuntu 12.04镜像测试,主要解决装机规范问题,减少沟通成本

首先准备好官方Ubuntu 12.04 Server 64bit 镜像

1
wget http://releases.ubuntu.com/12.04/ubuntu-12.04.5-server-amd64.iso

工作目录准备

1
2
3
mkdir ubuntu_12.04_install
mount -o loop ubuntu-12.04.5-server-amd64.iso /mnt/cd
cp -rT /mnt/cd/* ubuntu_12.04_install/
阅读全文 »

ISOLINUX多系统引导

目录结构如下

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
xiaomao@localvm /home/users/xiaomao $ tree cd_root/
cd_root/
├── isolinux
│   ├── hdt.c32
│   ├── isolinux.bin
│   ├── isolinux.cfg
│   ├── ldlinux.c32
│   ├── libcom32.c32
│   ├── libutil.c32
│   └── menu.c32
├── linux
│   ├── gentoo
│   │   ├── gentoo
│   │   ├── gentoo.igz
│   │   └── image.squashfs
│   └── rescue
│   ├── linux64
│   └── linux64.gz
└── livecd

4 directories, 13 files
阅读全文 »