YONGFEIUALL

izheyi.com


  • Home

  • Archives

  • Categories

  • Tags

  • About

  • Search

Salt - Targeting

Posted on 2018-03-04 | In SaltStack |

是指那些minion会作为运行命令或是执行状态的目标。这些目标可以是一个主机名,系统信息,定义的分组,甚至是自定义的绑定的对象。

Targeting的匹配方式:

  • Minion Id 匹配

    1
    2
    3
    [root@Automation ~]# salt 192.168.244.130 test.ping
    192.168.244.130:
    True
  • 通配符匹配

    1
    2
    3
    [root@Automation ~]# salt 192.168.* test.ping
    192.168.244.130:
    True
  • 正则表达式匹配

  • 列表匹配
  • Grains匹配
  • Node groups匹配
  • Pillar匹配

Salt - 环境安装的问题:Vagrant Up起不来

Posted on 2018-02-28 | In SaltStack |

按照官网的步骤,执行Vagrant Up,没有反应,只是鼠标闪动,Google了很多,都说是Vagrant和Virtualbox版本不兼容,Windows真不行。就下载了老版本,Vbox: 4.3.40, Vagrant: 1.9.5。

版本不兼容

Vagrant Up可以运行了,但是有以下错误:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
D:\salt learn\salt-vagrant-demo>vagrant up
Bringing machine 'master' up with 'virtualbox' provider...
Bringing machine 'minion1' up with 'virtualbox' provider...
Bringing machine 'minion2' up with 'virtualbox' provider...
==> master: Box 'bento/ubuntu-16.04' could not be found. Attempting to find and install...
master: Box Provider: virtualbox
master: Box Version: >= 0
The box 'bento/ubuntu-16.04' could not be found or
could not be accessed in the remote catalog. If this is a private
box on HashiCorp's Atlas, please verify you're logged in via
`vagrant login`. Also, please double-check the name. The expanded
URL and error message are shown below:

URL: ["https://atlas.hashicorp.com/bento/ubuntu-16.04"]
Error: The requested URL returned error: 404 Not Found

这是因为:所有的Vagrant boxes都Move到了app.vagrantup.com。

在Vagrantfile里加入以下命令:

1
Vagrant::DEFAULT_SERVER_URL.replace('https://vagrantcloud.com')

重新Vagrant Up,运行成功。

配置问题

下载VM完成后,失败:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
D:\salt learn\salt-vagrant-demo>vagrant up
Bringing machine 'master' up with 'virtualbox' provider...
Bringing machine 'minion1' up with 'virtualbox' provider...
Bringing machine 'minion2' up with 'virtualbox' provider...
==> master: Checking if box 'bento/ubuntu-16.04' is up to date...
There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.

Command: ["hostonlyif", "create"]

Stderr: 0%...
Progress state: E_FAIL
VBoxManage.exe: error: Failed to create the host-only adapter
VBoxManage.exe: error: Code E_FAIL (0x80004005) - Unspecified error (extended info not available)
VBoxManage.exe: error: Context: "int __cdecl handleCreate(struct HandlerArg *,int,int *)" at line 66 of file VBoxManageHostonly.cpp

解决方法:
在安装目录下(c:\Program Files (x86)\Vagrant\embedded\gems\gems\vagrant-1.7.4\plugins\providers\virtualbox\action.rb),注释以下代码:

1
2
3
4
b.use PrepareNFSSettings
#b.use ClearNetworkInterfaces
#b.use Network
b.use ForwardPorts

Salt - 安装SaltStack

Posted on 2018-02-27 | In SaltStack |

官方Demo环境安装

A Salt Demo using Vagrant,(Git, VirtualBox and Vagrant must already be installed.)请参考:Salt Vagrant Demo

过程中遇到的问题,搞了好久,Windows系统就是麻烦:Vagrant Up起不来

I HATE WINDOWS!!! 到处是坑,I GIVE UP,还是自己搭建环境吧,不用官方教程了。 以下自己捣鼓:

Salt安装

在SaltMaster主机上安装salt-master:yum -y install salt-master
在Minion主机上安装salt-minion:yum -y install salt-minion

Salt配置

  • 配置salt-master : /etc/salt/master

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    # salt运行的用户,影响到salt的执行权限
    user: root

    #s alt的运行线程,开的线程越多一般处理的速度越快,但一般不要超过CPU的个数
    worker_threads: 10

    # master的管理端口
    publish_port : 4505

    # master跟minion的通讯端口,用于文件服务,认证,接受返回结果等
    ret_port : 4506

    # 如果这个master运行的salt-syndic连接到了一个更高层级的master,那么这个参数需要配置成连接到的这个高层级master的监听端口
    syndic_master_port : 4506

    # 指定pid文件位置
    pidfile: /var/run/salt-master.pid

    # saltstack 可以控制的文件系统的开始位置
    root_dir: /

    # 日志文件地址
    log_file: /var/log/salt_master.log

    # 分组设置
    nodegroups:
    group_all: '*'

    # salt state执行时候的根目录
    file_roots:
    base:
    - /etc/salt/file

    # 设置pillar 的根目录
    pillar_roots:
    base:
    - /etc/salt/pillar
  • 配置salt-minion : /etc/salt/minion

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    # minion的识别ID,可以是IP,域名,或是可以通过DNS解析的字符串
    id: 192.168.0.100

    # salt运行的用户权限
    user: root

    # master的识别ID,可以是IP,域名,或是可以通过DNS解析的字符串
    master : 192.168.0.100

    # master通讯端口
    master_port: 4506

    # 备份模式,minion是本地备份,当进行文件管理时的文件备份模式
    backup_mode: minion

    # 执行salt-call时候的输出方式
    output: nested

    # minion等待master接受认证的时间
    acceptance_wait_time: 10

    # 失败重连次数,0表示无限次,非零会不断尝试到设置值后停止尝试
    acceptance_wait_time_max: 0

    # 重新认证延迟时间,可以避免因为master的key改变导致minion需要重新认证的syn风暴
    random_reauth_delay: 60

    # 日志文件位置
    log_file: /var/logs/salt_minion.log

    # 文件路径基本位置
    file_roots:
    base:
    - /etc/salt/minion/file


    # pillar基本位置
    pillar_roots:
    base:
    - /data/salt/minion/pillar

Salt启动

1
2
3
4
5
# master
service salt-master restart

# minion
service salt-minion restart

ACCEPT CONNECTIONS

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
[root@Automation salt]# salt-key
Accepted Keys:
Denied Keys:
Unaccepted Keys:
192.168.244.130
Rejected Keys:
[root@Automation salt]# salt-key -y -a 192.168.244.130
The following keys are going to be accepted:
Unaccepted Keys:
192.168.244.130
Key for minion 192.168.244.130 accepted.
[root@Automation salt]# salt-key --list-all
Accepted Keys:
192.168.244.130
Denied Keys:
Unaccepted Keys:
Rejected Keys:

验证安装成功

1
2
3
[root@Automation salt]# salt '*' test.ping
192.168.244.130:
True

跟任何人都聊的来

Posted on 2018-02-19 | In 胡璐读书 |

所有交谈技巧都离不开交谈之道:真正在意对方,把对方放在心上。

坚持自己的个性

不管我们是偏向于安静还是表达,都不是错误。我们越是煞费苦心地改变自己,就越会感觉沮丧。

每个人都是独一无二的。沟通的技能不要模仿他人,而且自我学习和成长。

内向 VS 外向

  • 内向型是指通过独处就可以获得能量的人。
  • 外向型是指通过群体交流获得获得能量的人。
  • 内向让交谈更有深度,外向让交谈更具行动力。

要想人际沟通有成效,就要具备两个基本的事实:

  1. 了解并接受自己
  2. 了解并接受对方

交谈的目的不是向对方炫耀你有多么聪明,而是在两之间建立联系。

准备越充分,越自信

一定要自信,至少看上去如此。除了心态,充分的准备,也能让我们自信。
不管你处在什么水平,都有进步的空间。坚持下去,时间长了,你就会养成事前思考和准备的习惯。

保持一颗好奇心,让自己变得有趣

大家同属人类,这就说明彼此之间会有一些类似的经历或者感受,这些相似点就可以拉进彼此之间的距离。

我们没有必要成为各个领域的专家,但每个领域略知一二,就可以成为一个有趣的人。

简单来说,好奇心就是从不同的角度观察常见事物。

学会从他人思维角度出发,把对方放在心上

重点在于我们自身的责任,而不是他人的行为。我们无法控制他人,最多就是给他人带来影响。

学会倾听,别人才能聊的开

拉里金说:“每天早晨我都会想到,今天我所说的任何内容都不会让我增长知识,因此,要想吸取很多知识,就要去倾听。”

学会提问,别人才能聊的透

有效的提问需要注意以下几点:

  • 提一个封闭式问题
  • 然后选择开放式问题。5W1H
  • 仔细倾听对方的回答
  • 重复

过年-还有没有年味

Posted on 2018-02-12 | In 随想 |

一过小年,春节的气氛也越来越浓,一去超市发现东西跟不要钱似的,已开始狂买和吃喝的节奏。在北京切身的感受是人少了好多,其他无感,已经感受不到那种心中过年的味道。

小时候家里穷,盼新年是因为可以有新衣服穿,有好吃的,有压岁钱…所以小孩子都会期待春节的到来,对于那个年代的大人也是一样,忙碌了一年,春节就像是对自己过去一年的奖励,好好犒劳一下自己,期望来年可以过的更好。

随着物质生活的提高,过年就显得没有什么特别之处了,想吃想穿,随时都可以;年龄的成长,欲望的增大,各种压力和琐碎的事情,已经完全没有了小时候那种过年的味道,那种急切的期盼。

抢到回家的票了,尽管很晚,尽管回来的票还没着落,但可以回家了。现在的过年不是为了庆祝,而是为了回家,为了陪伴亲人。我们这些在外漂泊的人,当初离开家也是没有其他选择,在外拼搏,成长,想让自己变得更好,而父母也在不经意间变老,想想你一年能回家几次,能跟父母见上几面。树欲静而风不止,子欲养而亲不待,真正值得我们珍惜的不是功名,不是出人头地,而是我们最爱的人。

记住,你一直在路上,有人一直在等你。

Salt - 基础

Posted on 2018-02-04 | In SaltStack |

Salt,一种全新的基础设施管理方式,部署轻松,在几分钟内可运行起来,扩展性好,很容易管理上万台服务器,速度够快,服务器之间秒级通讯。salt底层采用动态的连接总线, 使其可以用于编配, 远程执行, 配置管理等等.

SaltStack Communication

请参见:Salt Communication

SaltStack Component

介绍一些主要的Salt概念:

  • salt master: sends commands and configurations to minions
  • salt minions: receives commands from master

  • execution modules: Execution modules are sets of related functions that perform work on minions.

  • formulas(states): representation of a system configuration, a grouping of one or more state files, possibly with pillar data and configuration files or anything else which defines a neat package for a particular application.

  • grains: static information about minions: include operating system, memory, and many other system properties.

  • pillar: secure user-defined variables stored on master and assigned to minions
  • mine: an area on the master server where the results from regularly executed commands on minions can be stored.

  • top file: matches formulas and pillar data to minions

  • runners: modules that execute on the master server instead of minions.

  • returners: Send data returned by Salt minions to another system, such as a database. Salt returners can run on the Salt minion or on the Salt master.
  • reactor: provides a mechanism for triggering actions in response to generated events.
  • salt SSH: command to run commands on systems without minions

Salt Commands

  • salt-master: This is the master daemon process. You can start the master service with this command directly, or more typically, through an init script or service file.
  • salt-minion: Likewise, this is minion daemon process, used to communicate with the master and execute commands. Most users will also start this from init scripts or service files.
  • salt-key: This tool is used to manage minion public keys. This tool is used to view current keys and to make decisions about public keys sent by prospective minions. It can also generate keys to place on minions out-of-band.
  • salt: This command is used to target minions in order to run ad-hoc execution modules. This is the main tool used for remote execution.
  • salt-ssh: This command allows you to use SSH as an alternative to ZeroMQ for the transport mechanism.
  • salt-run: This command is used to run runner modules on the master server.
  • salt-call: This command is used to run execution modules directly on a minion you are logged into. This is often used to debug problematic commands by bypassing the master.
  • salt-cloud: This command is used to control and provision cloud resources from many different providers. New minions can easily be spun up and bootstrapped.

聊一聊加班这回事

Posted on 2018-01-27 | In 随想 |

加班的认知

天下武功唯快不破,特别是现在的互联网时代追求快,干不完的项目,做不完的事,这也是造成加班是家常便饭的原因之一,而且形成了一种‘风气’。还有一些所谓的专家鼓吹比你优秀的人都加班,你有啥不加班的理由,我很怀疑你们是不是‘托’。是,优秀的人在努力,年轻人也不应该荒废自己本该努力拼搏的年纪,但是加班不是唯一的方式,尤其是机械的硬性加班。

浮躁的社会,焦虑的社会,各方面的原因造成有些年轻人,拿自己能加班来作为自己的一个优势,更有甚者拿加班来评判自己工作努力与否,有些悲哀,有些无奈。甚至有些领导跟下属直言,不能加班的团队是没有前途的,为了加班而加班,是非常愚蠢的行为。当然了,也不能说一定就不加班,有一些紧急突发的情况,有一些你值得去做的事情,为了你心中的梦想。

加班不是敬业,对于脑力劳动者,也可以说是知识工作者,不能以工作时长和加班与否来判断其价值,而要看成果。加班跟这个人是不是好员工没有半毛钱关系,当一个人规定自己按时上下班时,才会充分利用好时间,才会有效率,加班是拉长了时间,其实效率可能是低的。

加班思考

注重工作和生活平衡的人,应该不会喜欢无目的的加班,而生活和工作分不开的人,好像对他来说加不加班也没啥两样。不管你追求的是哪种生活方式,首先得和公司是一致的,毕竟个人和公司相互认同才能更好的合作发展;还有要知道自己想要的是什么,不要刻意的让自己跟别人看齐,无谓的加班和状态,只会让自己感到深深的自我否定。

你是因为时间管理差,工作效率低而加班?还是因为确实是组织分配给了你干不完的活?还是像有些软件园里做的一样,工作吃住都在园区,回去也是无聊,那就通过加班来打发下班后无聊的时间?还是因为回家要带孩子辅导作业,面对家庭的琐事,为了逃避这些而选择加班?还是为了你的梦想?

单纯的从加班来看,加班其实是件很容易的事情,也不见得是坏事情,不提倡加班,也不反对加班,但是最重要的是要弄明白为什么加班,目的和意义是啥。加班不能让你成长,思考才能。愿大家都能按照自己的意愿找到属于自己的生活方式,能够一直做自己,我觉得这是这个时代最奢侈的一件事。

闺女七岁了

Posted on 2018-01-21 | In 丁丁 |

时间过的真快,转眼你就七岁了,七是个很神奇的数字,比如人生每隔七年都是一个自我选择和改变的时间点,比如七年之痒……希望你的第一个七年是快乐的,幸福的,尽管对你也有严格,有批评,有发火,有时候甚至是不公平。

这七年你成长了很多,从一个呱呱坠地的婴儿到一个小学生,从只会哇哇大哭到有自己的思想,爸爸妈妈看到现在的你,真的很欣慰,祝贺你的成长。


说实话有时候你的缠人真的很‘烦’^_^对你认死理,你所谓的‘听话’也很无奈……但比起这些,我最害怕的是我知道有一天你会离爸爸妈妈而去,去寻找自己的人生。虽然很害怕,但还是会祝福你,希望你能找到属于自己的幸福和人生,请记住你的身后永远都会站着爸爸妈妈。


其实养一个孩子最大的成本是时间成本,从你来到这个世界时的手足无措,到慢慢的可以抱起你,可以把你放在肩头,再到现在想办法在学习上“对付”你(o^^o)只有认真自己去带了,才知道其他的成本跟时间比起来都不算啥。所以我也希望你长大后回想自己的童年时,想到的不光有快乐,还有爸爸、妈妈、以及所有家人对你的爱。

新任经理人管理必修课

Posted on 2018-01-20 | In 胡璐读书 |

回顾这近两年从业务到主管的晋升,有不少困难和迷茫,尽管级别高了,但是如何管好人,带好团队,怎么顺利的完成角色的转变,依然有很大的挑战,还有很多东西需要学习,很长的路要走。

做领导后有何不同

不知道该怎么给团队安排任务
往下对团队负责,往上对领导,要双面负责

  1. 做经理后,是不是做我之前最擅长的事情
    以前只管理自己,个人目标
    现在管理他人,团队目标
    跟之前完全不一样,需要培养领导力,建立流程,解决问题,决策能力
  2. 权力
    我是领导我有权,为什么不听我的?
    增加的是你的职权,同时也带给你责任
    权利的来源:职权、专家权利、影响力
    影响力来自于创造双赢的结果
    观察在行使职权的过程中是不是获得了信任,是不是建立了双赢的关系
  3. 自由
    更多事情占用很多时间,开会,沟通
    经理人花大量时间在‘人’身上, 由事到人
  4. 一切都在掌控之中
    你会面对各方面带来的限制,你需要能够来处理
    管理者都会有纠结和痛苦
  5. 有人教我
    而现实是你要:
    自我反思
    总结觉察

领导力两难

  1. 领导责任
    为了下属而做, 指导和管理下属
  2. 业务责任
    为了老板而做, 上级交办自己要完成的

对下属,抢下属的工作,或表示不信任,或表示不懂管理
对自己,停滞不前,也会让自己丧失进一步提升的机会

领导力缺口

是下属没追求,还是领导没要求

目标设定法

  1. 了解自己的现在的位置
  2. 明确目的地
  3. 我如何到达

目标设定原则

  1. SMART原则
Read more »

小强升职记 - 时间管理故事书

Posted on 2018-01-15 | In 胡璐读书 |

双十一打包买的书,以为是职场的书,没啥可看的,结果发现是写时间管理的书,非常值的读。

一直都会有思考,职业价值观是什么?通俗的讲可能应当是活着是为了啥?每天忙来忙去的工作到底是为了什么?为什么每天弄的都这么忙?从这本书里感受到了共鸣,找到了一些答案,很有启发。

新窗口打开查看大图

衣柜整理法流程图:

1…171819…40
唐胡璐

唐胡璐

i just wanna live while i am alive

393 posts
42 categories
74 tags
RSS
LinkedIn Weibo GitHub E-Mail
Creative Commons
© 2022 唐胡璐
Powered by Hexo
|
Theme — NexT.Pisces v5.1.4