facebook twitter hatena line email

「Ansible」の版間の差分

提供: 初心者エンジニアの簡易メモ
移動: 案内検索
(ページの作成:「 ==ansible管理側== yum -y install epel-release yum -y install --enablerepo=epel ansible yum -y install docker-python # docker_imageを使う場合はこれもインス...」)
 
(Admin がページ「Asinble」を「Ansible」に、リダイレクトを残さずに移動しました)
 
(同じ利用者による、間の3版が非表示)
行1: 行1:
  
 
==ansible管理側==
 
==ansible管理側==
yum -y install epel-release
+
yum -y install epel-release
yum -y install --enablerepo=epel ansible
+
yum -y install --enablerepo=epel ansible
yum -y install docker-python # docker_imageを使う場合はこれもインストール
+
yum -y install docker-python # docker_imageを使う場合はこれもインストール
  
 
操作するサーバはrsaでノーパス設定でsshで入れるようにする
 
操作するサーバはrsaでノーパス設定でsshで入れるようにする
行15: 行15:
  
 
==dirを作成するサンプル==
 
==dirを作成するサンプル==
- hosts: node
+
filemake.yaml
  tasks:
+
- hosts: node
    - name:
+
  tasks:
      file: path=/tmp/hoge1 state=directory
+
    - name:
 +
      file: path=/tmp/hoge1 state=directory
 +
 
 +
==ansibleコマンド実行==
 +
ansible-playbook filemake.yaml -i hosts
  
 
==参考==
 
==参考==
 
https://qiita.com/hana_shin/items/657a5cff495244465482
 
https://qiita.com/hana_shin/items/657a5cff495244465482

2018年3月16日 (金) 19:08時点における最新版

ansible管理側

yum -y install epel-release
yum -y install --enablerepo=epel ansible
yum -y install docker-python # docker_imageを使う場合はこれもインストール

操作するサーバはrsaでノーパス設定でsshで入れるようにする

ansible管理host

# vi hosts
[server1]
192.168.0.1
[server2]
192.168.0.2

dirを作成するサンプル

filemake.yaml

- hosts: node
  tasks:
    - name:
      file: path=/tmp/hoge1 state=directory

ansibleコマンド実行

ansible-playbook filemake.yaml -i hosts

参考

https://qiita.com/hana_shin/items/657a5cff495244465482