プログラマーの調べ物

プログラマーが調べ物をするときに役に立つサイトを作ります。

2017-07-14から1日間の記事一覧

Ansibleでリモートサーバのコマンドやシェルスクリプトを実行

リモートのサーバ上にあるhoge.shを実行してみる。 # cat hoge.sh #!/bin/sh echo "hogeeee" exit 0 [root@localhost script]# これをAnsibleホストから実行するには、以下のようなPlaybookを書く。 $ cat command.yml - name: execute shell script hosts: …

Ansibleで別のサーバにNginxをインストールしてみる

正直、感動した。 こんなに簡単にサーバが作れるなんて…。 site.ymlを以下のように書く。 $ cat site.yml --- - name: Ansible Example hosts: all become: true tasks: - name: Install libselinux-python yum: name: libselinux-python state: present - n…

Ansibleのpingを使って接続確認をしたら "to use the 'ssh' connection type with passwords, you must install the sshpass program"エラーが出た。

以下のホスト情報で接続を確認。 $ cat hosts vm-machine ansible_host=192.168.62.130 ansible_port=22 ansible_user=root ansible_ssh_pass=root_pass 以下のコマンド実行。 ansible all -i hosts -m ping すると、"to use the 'ssh' connection type with…

vagrant upを実行したら"VirtualBox is complaining that the kernel module is not loaded."というエラーが出た

vagrant upでエラーが出た。 VirtualBox is complaining that the kernel module is not loaded. Please run `VBoxManage --version` or open the VirtualBox GUI to see the error message which should contain instructions on how to fix this error. 指…

CentOS7にVagrantをインストール

まずはVirtualBoxをインストール 標準リポジトリにはVirtualBoxは含まれていないため、VirtualBoxコミュニティが公式に提供しているリポジトリからインストールする。 # yum install epel-release # cd /etc/yum.repos.d # wget http://download.virtualbox.…

pipでAnsibleをインストールしたときにエラーが出た

Ansibleをインストール 以下のコマンドでインストールする。 # pip2 install ansible すると、以下のようなエラーが発生。 unable to execute gcc: No such file or directory error: command 'gcc' failed with exit status 1 ----------------------------…

CentOS7にpipをインストールする

python-devel を入れる yum -y install python-devel pip を入れる packageをアップデートする yum -y update python-pip をインストールする yum -y install python-pip で、いけるはずが、エラー。 [root@localhost ~]# yum -y install python-pip 読み込…