Ansible のバックアップ(No.1) |
|
すごく簡単なので、お気に入りです。
proxy=http://proxy.jomura.net:8080/ #as your own~/.bashrc
export HTTP_PROXY=http://proxy.jomura.net:8080/ #as your own export HTTPS_PROXY=${HTTP_PROXY}
yum clean all && yum -y update && reboot
yum -y install epel-release yum -y install ansible ansible --version
cat << "_EOF_" > inventory.yml redmine_servers: hosts: its.jomura.net #as your own vars: ansible_user: user #as your own ansible_password: user #as your own ansible_su_pass: root #as your own proxy_env: no_proxy: 127.0.0.1,localhost # do not delete # http_proxy: http://proxy.jomura.net:8080 #as your own # https_proxy: http://proxy.jomura.net:8080 #as your own redmine_path: /srv/redmine gitlab_servers: hosts: vcs.jomura.net #as your own vars: ansible_user: user #as your own ansible_password: user #as your own ansible_su_pass: root #as your own proxy_env: no_proxy: 127.0.0.1,localhost # do not delete http_proxy: http://proxy.jomura.net:8080 #as your own https_proxy: http://proxy.jomura.net:8080 #as your own jenkins_servers: hosts: build.jomura.net #as your own vars: ansible_user: user #as your own ansible_password: user #as your own ansible_su_pass: root #as your own proxy_env: no_proxy: 127.0.0.1,localhost # do not delete # http_proxy: http://proxy.jomura.net:8080 #as your own # https_proxy: http://proxy.jomura.net:8080 #as your own _EOF_
[user@localhost ~]$ ssh user@vcs.jomura.net The authenticity of host 'vcs.jomura.net (10.130.146.45)' can't be established. ECDSA key fingerprint is SHA256:yXhFg2AqmDebKZ3fHOwMbVyIijZIlNFQ5B750jcCo+g. ECDSA key fingerprint is MD5:0a:93:88:6e:7f:1f:dd:8c:44:92:af:ab:d5:a5:e6:64. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'vcs.jomura.net' (ECDSA) to the list of known hosts.
echo 'PASSWORD' > ~/.ansible-vault-key chmod 400 ~/.ansible-vault-key
#例 echo -n 'user' | ansible-vault encrypt_string --vault-id ~/.ansible-vault-key --stdin-name 'ansible_password'
#例 ansible_password: !vault | $ANSIBLE_VAULT;1.1;AES256 64613333626230353935646131663335343964303838643835633662666662306361313464646635 3235666362373830626465333036333738356566643133380a396465653735666361336238393138 62313832333839316236326265653934333637393063643066333733333735653636373361303638 3363303664353965660a396439643234363764396461326461383038323864313330336666616436 6663
#例 ansible-playbook -i inventory.yml pb_jenkins_server.yml --vault-id ~/.ansible-vault-key