执行一个本地脚本并传参数

执行一个本地脚本并传参数

playbook方式

# a.shuptimeecho $1# a.sh 就在这个playbook的同级目录- hosts: 10.10.1.72 tasks: – name: exe #shell: /home/gcpadmin/ansible_work/adhoc/a.sh script: a.sh xx register: aa – debug: msg: “{{ aa.stdout }}”

role方式

drwxrwxr-x. 2 gcpadmin gcpadmin 21 Aug 12 15:06 defaultsdrwxrwxr-x. 2 gcpadmin gcpadmin 17 Aug 12 15:23 filesdrwxrwxr-x. 2 gcpadmin gcpadmin 21 Aug 12 11:31 handlersdrwxrwxr-x. 2 gcpadmin gcpadmin 21 Aug 12 11:31 meta-rw-rw-r–. 1 gcpadmin gcpadmin 1328 Aug 12 11:31 README.mddrwxrwxr-x. 2 gcpadmin gcpadmin 66 Aug 12 15:23 tasksdrwxrwxr-x. 2 gcpadmin gcpadmin 37 Aug 12 11:31 testsdrwxrwxr-x. 2 gcpadmin gcpadmin 21 Aug 12 11:31 varsfiles/ 下有a.sh tasks如下:- name: exe script: a.sh xx register: aa- debug: msg: “{{ aa.stdout }}”$ansible-playbook test.ymlPLAY [10.xxxx] **************************************************************************************************TASK [vmware.provisning.disk : exe] ********************************************************************************changed: [10.xxxx]TASK [vmware.provisning.disk : debug] ******************************************************************************ok: [10.xxxx] => { “msg”: ” 15:24:38 up 4:50, 2 users, load average: 0.00, 0.01, 0.04\r\nxx\r\n”}PLAY RECAP *********************************************************************************************************1xxxx : ok=2 changed=1 unreachable=0 failed=0

vagrant share 报错处理

vagrant share 报错处理

vagrant/opt/vagrant/embedded/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require’: cannot load such file — vagrant-share/helper/api (LoadError) from /opt/vagrant/embedded/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require’ from /opt/vagrant/embedded/gems/gems/vagrant-share-1.1.7/lib/vagrant-share/activate.rb:244:in `<encoded>’ from /opt/vagrant/embedded/gems/gems/vagrant-share-1.1.7/lib/vagrant-share/activate.rb:16:in `RGLoader_load’ from /opt/vagrant/embedded/gems/gems/vagrant-share-1.1.7/lib/vagrant-share/activate.rb:16:in `<top (required)>’ from /opt/vagrant/embedded/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require’ from /opt/vagrant/embedded/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require’ from /opt/vagrant/embedded/gems/gems/vagrant-share-1.1.7/lib/vagrant-share.rb:23:in `block in <class:Plugin>’ from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/lib/vagrant/cli.rb:75:in `call’ from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/lib/vagrant/cli.rb:75:in `block (2 levels) in help’ from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/lib/vagrant/registry.rb:49:in `block in each’ from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/lib/vagrant/registry.rb:48:in `each’ from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/lib/vagrant/registry.rb:48:in `each’ from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/lib/vagrant/cli.rb:69:in `block in help’ from /opt/vagrant/embedded/lib/ruby/2.2.0/optparse.rb:917:in `initialize’ from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/lib/vagrant/cli.rb:57:in `new’ from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/lib/vagrant/cli.rb:57:in `help’ from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/lib/vagrant/cli.rb:32:in `execute’ from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/lib/vagrant/environment.rb:308:in `cli’ from /opt/vagrant/embedded/gems/gems/vagrant-1.9.4/bin/vagrant:127:in `<main>’解决:
安装vagrant share插件。 因为这个vagrantfile里面设置了共享目录。

迁移至openjdk报错

迁移至openjdk报错

最近打算统一一下oracle的vendor,所以都像openjdk上来迁移。可能是应用类型的原因,大部分系统都没问题,只是今天发现一个报错:

用ansible自动供应vmware虚拟机

用ansible自动供应vmware虚拟机

1.1 简述

一直以来,打开邮箱被ticket糊一脸的事情时有发生。我一直在想,能不能以一种简单的方案(不花老板的钱)来供应(provisioning)虚拟机呢? 我不喜欢openstack,因为太重,太复杂,除了自服务其它那些编排功能暂时也用不上。我也不喜欢vmware的云套件,因为不想和vmware有太深的羁绊,毕竟不是所有企业都是vmware用户。 所以我一直在寻找一种简单粗暴的办法。

rhel 7 安装 Rocket.Chat

rhel 7 安装 Rocket.Chat

1安装 epel

1.1centos

yum -y install epel-release nano && yum -y update

1.2rhel

rpm -vih http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-2.noarch.rpm

2安装包

yum install -y nodejs curl GraphicsMagick npm mongodb-org-server mongodb-org gcc-c++

3 mongodb安装

vi /etc/yum.repos.d/mongodb.repo
加入: