■まえおき
以前Ansibleでいろいろ自動化しようとしてましたが、いろいろあって久しく触ってないです。
使えるモジュールも増えてきたと思う(たぶん)し、なにかと便利なので、家でも使える環境をつくる。
OSの最初の設定はこちら。
参考にさせていただきました。
https://computingforgeeks.com/how-to-install-and-configure-ansible-on-rhel-8-centos-8/
CentOS8 にAnsible をインストールする | Qrunch(クランチ)
■Ansibleインストール
全部rootでやりました。
dnf update -y
dnf install python3 -y
python3 --version
pip3 --version
pip3 install --upgrade pip
dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
dnf install --enablerepo epel-playground ansible
dnf repolist
dnf install --enablerepo epel-playground ansible
# ansible --version
ansible 2.9.10
config file = /etc/ansible/ansible.cfg
configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3.6/site-packages/ansible
executable location = /usr/bin/ansible
python version = 3.6.8 (default, Apr 16 2020, 01:36:27) [GCC 8.3.1 20191121 (Red Hat 8.3.1-5)]
#
systemctl status sshd
ssh-keygen
ssh-copy-id root@<管理する側のIPアドレス>
echo <管理する側のIPアドレス> >>./hosts
# ansible -i ./hosts <管理する側のIPアドレス> -m ping
<管理する側のIPアドレス> | SUCCESS => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/libexec/platform-python"
},
"changed": false,
"ping": "pong"
}
#
OK!!
■まとめ
特につまることなくサクッとできました。いつも情報公開してくれているみなさんに感謝!ありがとう。
次回はWindows、ESXiに向け自動化できるといいことまとめて、
順に実装していきたいと思います。